From 8d3a8f9098a7bf2b799920f9af0d66cbe978c4e7 Mon Sep 17 00:00:00 2001 From: Kevin Dang Date: Sat, 7 Jun 2025 12:56:00 -0700 Subject: [PATCH] Update: error message and config creation --- src/events/messageCreate.ts | 3 +-- src/utils/messageNormal.ts | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 5ec6fa0..587dc48 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -71,9 +71,8 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client userConfig = await new Promise((resolve, reject) => { getUserConfig(`${message.author.username}-config.json`, (config) => { if (config === undefined) { - openConfig(`${message.author.username}-config.json`, 'message-style', false) openConfig(`${message.author.username}-config.json`, 'switch-model', defaultModel) - reject(new Error('No User Preferences is set up.\n\nCreating preferences file with \`message-style\` set as \`false\` for regular message style.\nPlease try chatting again.')) + reject(new Error(`No User Preferences is set up.\n\nCreating new preferences file for ${message.author.username}\nPlease try chatting again.`)) return } diff --git a/src/utils/messageNormal.ts b/src/utils/messageNormal.ts index a438e41..969f388 100644 --- a/src/utils/messageNormal.ts +++ b/src/utils/messageNormal.ts @@ -74,10 +74,11 @@ export async function normalMessage( } } catch (error: any) { console.log(`[Util: messageNormal] Error creating message: ${error.message}`) - if (error.message.includes('try pulling it first')) - sentMessage.edit(`**Response generation failed.**\n\nReason: You do not have the ${model} downloaded. Ask an admin to pull it using the \`pull-model\` command.`) - else - sentMessage.edit(`**Response generation failed.**\n\nReason: ${error.message}`) + if (error.message.includes('fetch failed')) + error.message = 'Missing ollama service on machine' + else if (error.message.includes('try pulling it first')) + error.message = `You do not have the ${model} downloaded. Ask an admin to pull it using the \`pull-model\` command.` + sentMessage.edit(`**Response generation failed.**\n\nReason: ${error.message}`) } })