u
This commit is contained in:
@@ -18,6 +18,10 @@ const ALLOWED_KEYS = new Set([
|
||||
'systemprompt-prefix',
|
||||
'systemprompt-suffix',
|
||||
'default-model',
|
||||
'modelslug',
|
||||
'modelslugflag',
|
||||
'modelreasoning',
|
||||
'modelslugimage',
|
||||
]);
|
||||
|
||||
const WRITEONLY_KEYS = new Set([
|
||||
@@ -59,6 +63,17 @@ export default function set(provider) {
|
||||
if (typeof input.value !== 'string') {
|
||||
throw new Error('Invalid setting');
|
||||
}
|
||||
const trimmedVal = input.value.trim();
|
||||
let value = input.value;
|
||||
if (key === 'modelslug' && !trimmedVal) {
|
||||
value = 'openai/gpt-6-luna';
|
||||
}
|
||||
if (key === 'modelslugflag' && !['', 'floor', 'nitro'].includes(trimmedVal)) {
|
||||
throw new Error('Invalid setting');
|
||||
}
|
||||
if (key === 'modelreasoning' && !['none', 'low', 'medium', 'high'].includes(trimmedVal)) {
|
||||
throw new Error('Invalid setting');
|
||||
}
|
||||
|
||||
const runner = makeRunner(provider, tx);
|
||||
const frontend = Boolean(input.frontend);
|
||||
@@ -71,7 +86,7 @@ export default function set(provider) {
|
||||
await runner.query(upsertSql, {
|
||||
companyId,
|
||||
key,
|
||||
value: input.value,
|
||||
value,
|
||||
frontend: isSqlite ? (frontend ? 1 : 0) : frontend,
|
||||
writeonly: isSqlite ? (writeonly ? 1 : 0) : writeonly,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user