Add ModelChain support to ModelConfigService and make ModelDialog dynamic (#22914)

This commit is contained in:
kevinjwang1
2026-03-19 15:22:26 -07:00
committed by GitHub
parent 0e66f545ca
commit 06a7873c51
11 changed files with 1014 additions and 18 deletions
+42
View File
@@ -1081,6 +1081,20 @@ const SETTINGS_SCHEMA = {
ref: 'ModelResolution',
},
},
modelChains: {
type: 'object',
label: 'Model Chains',
category: 'Model',
requiresRestart: true,
default: DEFAULT_MODEL_CONFIGS.modelChains,
description:
'Availability policy chains defining fallback behavior for models.',
showInDialog: false,
additionalProperties: {
type: 'array',
ref: 'ModelPolicy',
},
},
},
},
@@ -2877,6 +2891,34 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
},
},
},
ModelPolicy: {
type: 'object',
description:
'Defines the policy for a single model in the availability chain.',
properties: {
model: { type: 'string' },
isLastResort: { type: 'boolean' },
actions: {
type: 'object',
properties: {
terminal: { type: 'string', enum: ['silent', 'prompt'] },
transient: { type: 'string', enum: ['silent', 'prompt'] },
not_found: { type: 'string', enum: ['silent', 'prompt'] },
unknown: { type: 'string', enum: ['silent', 'prompt'] },
},
},
stateTransitions: {
type: 'object',
properties: {
terminal: { type: 'string', enum: ['terminal', 'sticky_retry'] },
transient: { type: 'string', enum: ['terminal', 'sticky_retry'] },
not_found: { type: 'string', enum: ['terminal', 'sticky_retry'] },
unknown: { type: 'string', enum: ['terminal', 'sticky_retry'] },
},
},
},
required: ['model'],
},
};
export function getSettingsSchema(): SettingsSchemaType {