From bd40076dc18d7afd08d3ced8a3753a95a7beb9e2 Mon Sep 17 00:00:00 2001 From: Kris Date: Fri, 14 Mar 2025 13:11:44 -0400 Subject: [PATCH] FIX: need to create model when testing new embedding (#1192) --- .../discourse/components/ai-embedding-editor.gjs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/ai-embedding-editor.gjs b/assets/javascripts/discourse/components/ai-embedding-editor.gjs index 4b4777c8..ff6fbe02 100644 --- a/assets/javascripts/discourse/components/ai-embedding-editor.gjs +++ b/assets/javascripts/discourse/components/ai-embedding-editor.gjs @@ -240,7 +240,20 @@ export default class AiEmbeddingEditor extends Component { this.testRunning = true; try { - const configTestResult = await this.args.model.testConfig(data); + let testModel; + + // new embeddings + if (this.args.model.isNew || this.selectedPreset) { + testModel = this.store.createRecord("ai-embedding", { + ...this.selectedPreset, + ...data, + }); + } else { + // existing embeddings + testModel = this.args.model; + } + + const configTestResult = await testModel.testConfig(data); this.testResult = configTestResult.success; if (this.testResult) {