zacps-lt nsarrazin HF staff commited on
Commit
7849c30
1 Parent(s): e04d4e8

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 <sarrazin.nathan@gmail.com>

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");