Fix model identification when creating conversations (#820)
Browse filesPR #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>
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");
|