fix(bioflow): sendCardResult 从 raw.bioflow 读 active_job_id(BFF 归一化剥离顶层 bioflow 导致订阅没建立)
This commit is contained in:
@@ -506,6 +506,7 @@ export function patchBioflowGuidance(aMsg, text) {
|
||||
// 自然语言引导气泡(方案:自然语言主通道,卡片辅助)——弹卡片前先插入一条 text 块。
|
||||
if (!text) return null;
|
||||
const html = renderMarkdown(String(text));
|
||||
console.log('[bioflow-guidance] text=', String(text).slice(0, 40), 'html非空=', Boolean(html));
|
||||
if ((aMsg.blocks || []).some((b) => b && b.type === 'text' && b.html === html)) return null;
|
||||
aMsg.blocks.push({ type: 'text', html });
|
||||
return true;
|
||||
@@ -2565,7 +2566,8 @@ export const useChatStore = defineStore('chat', {
|
||||
aMsg.status = 'done';
|
||||
});
|
||||
// session↔job 绑定持久化:complete 的 bioflow.active_job_id → meta.bioflow
|
||||
const bf = p.bioflow || {};
|
||||
// BFF 归一化剥离了顶层 bioflow,active_job_id 在 raw.bioflow 里
|
||||
const bf = p.bioflow || (p.raw && p.raw.bioflow) || {};
|
||||
if (bf.active_job_id) {
|
||||
updateSessionQuiet(sessionId, {
|
||||
meta: { bioflow: { active_job_id: bf.active_job_id, chain: bf.chain || '' } },
|
||||
@@ -2576,6 +2578,7 @@ export const useChatStore = defineStore('chat', {
|
||||
try {
|
||||
const bioflow = useBioflowStore();
|
||||
const jobId = bf.active_job_id;
|
||||
console.log('[bioflow-guidance] sendCardResult 建立订阅 jobId=', jobId);
|
||||
bioflow.connectJobEvents(jobId, sessionId, {
|
||||
onEvent: (type, data, seq) => {
|
||||
const frame = patchBioflowEvent(aMsg, { type, data });
|
||||
@@ -2585,6 +2588,7 @@ export const useChatStore = defineStore('chat', {
|
||||
patchBioflowForm(aMsg, data);
|
||||
this.scrollSeq++;
|
||||
} else if (type === 'stage_await_files' && data) {
|
||||
console.log('[bioflow-guidance] stage_await_files data=', JSON.stringify(data).slice(0, 200));
|
||||
patchBioflowGuidance(aMsg, data.guidance || data.message);
|
||||
patchBioflowFile(aMsg, data);
|
||||
this.scrollSeq++;
|
||||
|
||||
Reference in New Issue
Block a user