mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-13 12:06:06 -05:00
Streamlined Preferences Setup and Default Model (#148)
* Update: Streamlinded setup and Default Model * Update: version increment
This commit is contained in:
@@ -36,7 +36,8 @@ export interface EventProps {
|
||||
client: Client
|
||||
log: LogMethod
|
||||
msgHist: Queue<UserMessage>
|
||||
ollama: Ollama
|
||||
ollama: Ollama,
|
||||
defaultModel: String
|
||||
}
|
||||
export type EventCallback<T extends EventKeys> = (
|
||||
props: EventProps,
|
||||
@@ -64,7 +65,8 @@ export function registerEvents(
|
||||
client: Client,
|
||||
events: Event[],
|
||||
msgHist: Queue<UserMessage>,
|
||||
ollama: Ollama
|
||||
ollama: Ollama,
|
||||
defaultModel: String
|
||||
): void {
|
||||
for (const { key, callback } of events) {
|
||||
client.on(key, (...args) => {
|
||||
@@ -73,7 +75,7 @@ export function registerEvents(
|
||||
|
||||
// Handle Errors, call callback, log errors as needed
|
||||
try {
|
||||
callback({ client, log, msgHist, ollama }, ...args)
|
||||
callback({ client, log, msgHist, ollama, defaultModel }, ...args)
|
||||
} catch (error) {
|
||||
log('[Uncaught Error]', error)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,10 @@ export async function normalMessage(
|
||||
}
|
||||
} catch(error: any) {
|
||||
console.log(`[Util: messageNormal] Error creating message: ${error.message}`)
|
||||
sentMessage.edit(`**Response generation failed.**\n\nReason: ${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}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user