feat: add model center and pool routing

This commit is contained in:
Agent Workbench Dev
2026-10-30 16:52:05 +08:00
parent 9770a536bd
commit fb58a41e08
18 changed files with 778 additions and 11 deletions
+4 -2
View File
@@ -141,7 +141,8 @@ export class Runtime {
const project = this.store.project(session.projectId);
safePath(project);
const controller = new AbortController();
const config = structuredClone(this.store.config);
const initialConfig = structuredClone(this.store.config);
const config = this.provider.prepareConfig ? this.provider.prepareConfig(initialConfig, this.store) : initialConfig;
if (config.mode !== 'demo') this.provider.validate(config);
const record = this.store.beginRun(session, content, resume, config, { instructionSource });
const run = { controller, id: record.id, taskId: record.taskId, project, record, config };
@@ -232,7 +233,8 @@ export class Runtime {
planned.record.requestAttempts = Math.max(planned.record.requestAttempts, progress.attempt ?? 0);
stepRecord.modelAttempts = Math.max(stepRecord.modelAttempts, progress.attempt ?? 0);
requestEvent.phase = progress.phase; requestEvent.attempts = progress.attempt;
requestEvent.label = progress.phase === 'retrying' ? '正在重试模型连接' : progress.phase === 'completed' ? '模型响应已收到' : progress.phase === 'failed' ? '模型连接失败' : '请求模型服务';
if (progress.connectionId) { requestEvent.connectionId = progress.connectionId; requestEvent.modelAttemptId = progress.modelAttemptId; requestEvent.actualModel = progress.model; }
requestEvent.label = progress.switching ? '正在切换模型池连接' : progress.phase === 'retrying' ? '正在重试模型连接' : progress.phase === 'completed' ? '模型响应已收到' : progress.phase === 'failed' ? '模型连接失败' : '请求模型服务';
requestEvent.output = progress.phase === 'retrying' ? '第 ' + progress.attempt + ' 次请求失败,将自动重试(最多 ' + progress.maxAttempts + ' 次)。'
: progress.phase === 'completed' ? '模型响应已收到;工具请求将在校验后执行。'
: progress.diagnostic?.message ?? '正在等待模型响应。';