From 6bf4d2ef3cf5e79993dfa4f93132bef64d9f55e3 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Wed, 14 Feb 2024 10:27:08 +1300 Subject: [PATCH] Fix model identification when creating conversations PR #181 introduced a model ID field so that models could be switched out without breaking existing conversations. However, the new conversation endpoint incorrectly uses the model name instead of ID, so without this fix it was not possible to have a model with a different ID and name. --- src/routes/conversation/+server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/conversation/+server.ts b/src/routes/conversation/+server.ts index e7f4c8a7e2..1863d2cd76 100644 --- a/src/routes/conversation/+server.ts +++ b/src/routes/conversation/+server.ts @@ -55,7 +55,7 @@ export const POST: RequestHandler = async ({ locals, request }) => { embeddingModel = conversation.embeddingModel; } - const model = models.find((m) => m.name === values.model); + const model = models.find((m) => (m.id || m.name) === values.model); if (!model) { throw error(400, "Invalid model");