From 76926820b57d49f4edca79b7731e01775bc5e02a 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 f622987d27..164e5877a7 100644 --- a/src/routes/conversation/+server.ts +++ b/src/routes/conversation/+server.ts @@ -39,7 +39,7 @@ export const POST: RequestHandler = async ({ locals, request }) => { ); } - 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");