fix(dsh): recognize configured native models and pin diagnosis selection
Core regression / Python 3.12 core, intervention UI and release configuration (push) Failing after 20s
Core regression / JavaScript syntax (push) Successful in 4s
Core regression / Python 3.12 core, intervention UI and release configuration (pull_request) Failing after 20s
Core regression / JavaScript syntax (pull_request) Successful in 3s

This commit is contained in:
阿白叔 committed 2026-11-05 17:40:50 +08:00
1 parent eba935e710
commit 8837587ce9
9 files changed
+149 -36

No files matched your search

+17
View File
@@ -148,6 +148,12 @@ export async function apply(ctx){
if(request.model_budget_ms!==undefined&&(!Number.isFinite(request.model_budget_ms)||request.model_budget_ms<=0||request.model_budget_ms>300000)){
emit({status:'failed',error:'invalid_incident_request'});return;
}
const selection=request.model_selection;
if(selection!==undefined&&(!selection||typeof selection!=='object'||Array.isArray(selection)||
Object.keys(selection).some(key=>!['provider','model','reasoningEffort'].includes(key))||
['provider','model',...selection.reasoningEffort===undefined?[]:['reasoningEffort']].some(key=>typeof selection[key]!=='string'||!selection[key].length||selection[key].length>256||/[\x00-\x1f]/.test(selection[key])))){
emit({status:'failed',error:'invalid_incident_request'});return;
}
let cancel;
const cancelled=new Promise(resolve=>{cancel=resolve;});
const active={incidentId:request.incident_id,sessionId:null,cancelled:false,stopReason:null,cancel};
@@ -160,6 +166,17 @@ export async function apply(ctx){
active.sessionId=sessionId;
incidentSessions.set(request.incident_id,sessionId);
checkCancelled();
if(selection){
const agent=ctx.agents.get(sessionId);
// The public selectModel API also changes the user's global default.
await ctx.agents.serializeImageAdmission(agent,async()=>{
const resolved=await ctx.llm.resolveCallConfig(selection);
checkCancelled();
ctx.agents.selectForNextRequest(agent,{provider:resolved.provider,model:resolved.model,
...resolved.reasoningEffort===undefined?{}:{reasoningEffort:resolved.reasoningEffort}});
});
checkCancelled();
}
await ctx.sessionController.rename({sessionId,title:('DSH自动诊断 · '+(request.snapshot.task_name||request.snapshot.issue_code)).slice(0,128)});
}
active.sessionId=sessionId;