fix: advance offline demo from original conversation

This commit is contained in:
Agent Workbench Dev
2026-11-06 06:55:29 +08:00
parent c9c77c7ee6
commit b8a5f95018
11 changed files with 112 additions and 8 deletions
+3 -1
View File
@@ -352,7 +352,9 @@ export class Provider {
const body = completionBody(config, messages, tools);
assertPlannedRequest(body, requestPlan);
if (config.executionMode !== 'unrestricted' && config.inputImages?.length && (!config.modelRouting || !this.hub || config.mode==='demo')) throw new Error('图片请求必须通过模型中心的视觉能力选路,尚未发送。');
if (config.mode === 'demo') return this.demo(messages, project, config);
// Planned requests may end with a synthetic user-role state note. The
// offline script follows the original conversation after wire verification.
if (config.mode === 'demo') return this.demo(requestPolicy.demoHistory ?? messages, project, config);
this.validate(config);
const execute = async (selected, key, input, progress) => {
return this.request(selected, protocolRoute(selected), input, signal, key, progress, { ...(config.modelRouting ? { attempts: 1 } : {}), ...requestPolicy,
+1 -1
View File
@@ -484,7 +484,7 @@ export class Runtime {
response = externalEngine
? await this.engineRunner().complete(session, run, planned.messages, progressHandler, planned.record, tools)
: await this.provider.complete(requestConfig, planned.messages, run.project, signal, progressHandler, planned.record, tools,
{maxBudgetAttempts:planned.record.maxBudgetAttempts,beforeDispatch:({previousFailure}={})=>checkModelDispatchBudget(this.store,session,run.record,requestConfig,planned.body,0,previousFailure)});
{ ...(config.mode === 'demo' ? { demoHistory: session.providerMessages } : {}), maxBudgetAttempts:planned.record.maxBudgetAttempts,beforeDispatch:({previousFailure}={})=>checkModelDispatchBudget(this.store,session,run.record,requestConfig,planned.body,0,previousFailure)});
if (response.compatibility?.length && requestEvent) { requestEvent.compatibility = response.compatibility; this.store.save(session); }
this.requestPlanner().finish(session, planned.record, { response, attempts: planned.record.requestAttempts });
if (run.worker && !externalEngine && !responseAccounted) {