From e2bd1e978c5282db77131530b538a9df2c6cb505 Mon Sep 17 00:00:00 2001 From: awesomerobot Date: Thu, 13 Mar 2025 16:48:35 -0400 Subject: [PATCH] FIX: need to create model when testing new embedding --- .../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 4b4777c88..ff6fbe02b 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) {