set default roles for json as well

git push
This commit is contained in:
Dallin Romney 2025-02-11 19:36:11 -08:00
parent 6e21873488
commit 41785c920c
3 changed files with 18 additions and 7 deletions

View file

@ -326,6 +326,7 @@ async function intermediateToFinalConfig(
...model.requestOptions,
...config.requestOptions,
};
model.roles = model.roles ?? ["chat"]; // Default to chat role if not specified
}
if (allowFreeTrial) {

View file

@ -235,13 +235,15 @@ function ModelSelect() {
useEffect(() => {
setOptions(
allModels.map((model) => {
return {
value: model.title,
title: modelSelectTitle(model),
apiKey: model.apiKey,
};
}),
allModels
.filter((m) => !m.roles || m.roles.includes("chat"))
.map((model) => {
return {
value: model.title,
title: modelSelectTitle(model),
apiKey: model.apiKey,
};
}),
);
}, [allModels]);

View file

@ -16,6 +16,14 @@ export default defineConfig({
},
},
},
server: {
cors: {
origin: "*",
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
allowedHeaders: ["*", "Content-Type", "Authorization"],
credentials: true,
},
},
test: {
globals: true,
environment: "jsdom",