fix: refresh upstream catalog facts without invalidating saved credentials

This commit is contained in:
Agent Workbench Dev
2026-11-06 20:23:47 +08:00
parent 6917603d21
commit ae5123c569
3 changed files with 108 additions and 7 deletions
+3 -3
View File
@@ -37,10 +37,10 @@ export function catalogModel(item, config = {}) {
const efforts = ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'].filter(value => supported(caps.effort?.[value]) === 'supported');
const modes = ['disabled', 'enabled', 'adaptive'].filter(value => supported(caps.thinking?.types?.[value]) === 'supported');
const features = Object.fromEntries(['thinking', 'effort', 'pdf_input', 'structured_outputs', 'server_tools', 'code_execution', 'batch', 'citations', 'context_management'].map(key => [key, supported(caps[key])]));
return { id, name: field(item.display_name ?? item.name ?? id), owner: field(item.owned_by ?? item.provider, 100),
return { id, name: field(item.display_name ?? item.displayName ?? item.name ?? id), owner: field(item.owned_by ?? item.provider, 100),
lifecycle: ['active', 'deprecated', 'retired'].includes(item.lifecycle) ? item.lifecycle : null,
contextLimit: positive(item.context_length ?? item.max_input_tokens ?? item.context_window),
maxOutputTokens: positive(item.max_output_tokens ?? item.max_tokens ?? item.top_provider?.max_completion_tokens),
contextLimit: positive(item.context_length ?? item.max_input_tokens ?? item.context_window ?? item.inputTokenLimit),
maxOutputTokens: positive(item.max_output_tokens ?? item.max_tokens ?? item.top_provider?.max_completion_tokens ?? item.outputTokenLimit),
capabilityDeclarations: declarations, features, efforts, modes, parameters,
metadataSource: 'upstream-model-list' };
}