diff --git a/src/bot/features/commands/shared/ask-command.ts b/src/bot/features/commands/shared/ask-command.ts index c23da30..3399f7a 100644 --- a/src/bot/features/commands/shared/ask-command.ts +++ b/src/bot/features/commands/shared/ask-command.ts @@ -42,13 +42,14 @@ feature.command("ubiquityos", logHandle("command-ubiquityos"), chatAction("typin const outputStyle = "Concise and coherent responses in paragraphs that directly address the user's question."; - const similarityThreshold = 0.9; const question = ctx.message?.text.replace("/ubiquityos", "").trim(); if (!question) { return ctx.reply("Please provide a question to ask UbiquityOS."); } + const { similarityThreshold, model } = PluginContext.getInstance().config.aiConfig; + const similarText = await Promise.all([ embeddings.findSimilarComments(question, 1 - similarityThreshold), embeddings.findSimilarIssues(question, 1 - similarityThreshold), @@ -69,7 +70,7 @@ feature.command("ubiquityos", logHandle("command-ubiquityos"), chatAction("typin embeddingsSearch: rerankedText, additionalContext: [], outputStyle, - model: PluginContext.getInstance().config.aiConfig.model, + model, }), { parse_mode: "Markdown", diff --git a/src/types/plugin-inputs.ts b/src/types/plugin-inputs.ts index ecfac86..aa3b857 100644 --- a/src/types/plugin-inputs.ts +++ b/src/types/plugin-inputs.ts @@ -27,12 +27,14 @@ export const pluginSettingsSchema = T.Object({ model: T.String({ default: "openai/o1-mini" }), baseUrl: T.String({ default: "https://api.openai.com/v1" }), maxCompletionTokens: T.Number({ default: 5000 }), + similarityThreshold: T.Number({ default: 0.9 }), }), T.Object({ kind: T.Literal("OpenRouter"), model: T.String({ default: "openai/o1-mini" }), baseUrl: T.String({ default: "https://openrouter.ai/api/v1" }), maxCompletionTokens: T.Number({ default: 5000 }), + similarityThreshold: T.Number({ default: 0.9 }), }), ], { default: { kind: "OpenAi", model: "openai/o1-mini", baseUrl: "https://api.openai.com/v1" }, maxCompletionTokens: 5000 }