zacps-lt nsarrazin HF Staff commited on
Commit
361869e
·
unverified ·
1 Parent(s): 6fb5de7

Fix model identification when creating conversations (#820)

Browse files

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.

Co-authored-by: Nathan Sarrazin <[email protected]>

Files changed (1) hide show
  1. src/routes/conversation/+server.ts +1 -1
src/routes/conversation/+server.ts CHANGED
@@ -39,7 +39,7 @@ export const POST: RequestHandler = async ({ locals, request }) => {
39
  );
40
  }
41
 
42
- const model = models.find((m) => m.name === values.model);
43
 
44
  if (!model) {
45
  throw error(400, "Invalid model");
 
39
  );
40
  }
41
 
42
+ const model = models.find((m) => (m.id || m.name) === values.model);
43
 
44
  if (!model) {
45
  throw error(400, "Invalid model");