Skip to content

Commit bd40076

Browse files
authored
FIX: need to create model when testing new embedding (#1192)
1 parent 3533cd1 commit bd40076

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

assets/javascripts/discourse/components/ai-embedding-editor.gjs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,20 @@ export default class AiEmbeddingEditor extends Component {
240240
this.testRunning = true;
241241

242242
try {
243-
const configTestResult = await this.args.model.testConfig(data);
243+
let testModel;
244+
245+
// new embeddings
246+
if (this.args.model.isNew || this.selectedPreset) {
247+
testModel = this.store.createRecord("ai-embedding", {
248+
...this.selectedPreset,
249+
...data,
250+
});
251+
} else {
252+
// existing embeddings
253+
testModel = this.args.model;
254+
}
255+
256+
const configTestResult = await testModel.testConfig(data);
244257
this.testResult = configTestResult.success;
245258

246259
if (this.testResult) {

0 commit comments

Comments
 (0)