fix(bioflow): sendCardResult 创建任务后补 connectJobEvents 订阅,恢复文件/参数引导等任务事件触发
This commit is contained in:
@@ -2570,6 +2570,38 @@ export const useChatStore = defineStore('chat', {
|
||||
updateSessionQuiet(sessionId, {
|
||||
meta: { bioflow: { active_job_id: bf.active_job_id, chain: bf.chain || '' } },
|
||||
}).catch(() => {});
|
||||
// 修复:skill 化 S3 改走 sendCardResult 后丢失了任务事件订阅——
|
||||
// 补上 connectJobEvents,把 stage_await_files / stage_await_confirm /
|
||||
// stage_failed / job_done 桥接进消息块(guidance 气泡 + 各卡片)。
|
||||
try {
|
||||
const bioflow = useBioflowStore();
|
||||
const jobId = bf.active_job_id;
|
||||
bioflow.connectJobEvents(jobId, sessionId, {
|
||||
onEvent: (type, data, seq) => {
|
||||
const frame = patchBioflowEvent(aMsg, { type, data });
|
||||
if (frame) this.scrollSeq++;
|
||||
if (type === 'stage_await_confirm' && data) {
|
||||
patchBioflowGuidance(aMsg, data.guidance);
|
||||
patchBioflowForm(aMsg, data);
|
||||
this.scrollSeq++;
|
||||
} else if (type === 'stage_await_files' && data) {
|
||||
patchBioflowGuidance(aMsg, data.guidance || data.message);
|
||||
patchBioflowFile(aMsg, data);
|
||||
this.scrollSeq++;
|
||||
} else if (type === 'stage_failed' && data) {
|
||||
patchBioflowGuidance(aMsg, data.guidance);
|
||||
patchBioflowDiagnosis(aMsg, data);
|
||||
this.scrollSeq++;
|
||||
} else if (type === 'job_done' && data) {
|
||||
patchBioflowGuidance(aMsg, data.guidance);
|
||||
if (data.delivery) patchBioflowDelivery(aMsg, data.delivery);
|
||||
const blk = patchBioflowArchiveSuggest(aMsg, data.job_id || jobId);
|
||||
if (blk) blk.jobId = data.job_id || jobId;
|
||||
this.scrollSeq++;
|
||||
}
|
||||
},
|
||||
});
|
||||
} catch { /* EventSource 不可用:任务事件仍由快照兜底 */ }
|
||||
}
|
||||
try {
|
||||
await this._persistFinal(aMsg, sessionId, 'done', { raw: aMsg.raw });
|
||||
|
||||
Reference in New Issue
Block a user