Merge branch 'ji' into master
This commit is contained in:
commit
6fdca41a1d
3 files changed
+34
-5
No files matched your search
@@ -260,6 +260,14 @@ function buildOpeningText(detail: CopTaskDetail, taskId: string, action?: Action
|
|||||||
.join("\n");
|
.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3qfx/rwfx 这类“按任务id 直接问答”的任务工作区,在 ``TaskContext`` 丢失但
|
||||||
|
* ``login.copTaskDetail`` 仍存在时,可用它重新拼出开场词做前端自恢复。
|
||||||
|
*/
|
||||||
|
export function buildTaskOpeningText(detail: CopTaskDetail, taskId: string): string {
|
||||||
|
return buildOpeningText(detail, taskId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 据 goPath + 任务详情解析跳转目标。
|
* 据 goPath + 任务详情解析跳转目标。
|
||||||
* - 多智能体会商:返回带 ``roundtablePrefill``(businessCode 让会商页自动选用配置的业务链条;
|
* - 多智能体会商:返回带 ``roundtablePrefill``(businessCode 让会商页自动选用配置的业务链条;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import { env } from "@/env";
|
|||||||
import { readTaskContext, taskThreadMetadata } from "@/core/auth/task-purpose";
|
import { readTaskContext, taskThreadMetadata } from "@/core/auth/task-purpose";
|
||||||
import { TaskPurposePanel } from "@/strategy-components/components/task-components/TaskPurposePanel";
|
import { TaskPurposePanel } from "@/strategy-components/components/task-components/TaskPurposePanel";
|
||||||
import { desensitize } from "@/lib/desensitize";
|
import { desensitize } from "@/lib/desensitize";
|
||||||
|
import { buildTaskOpeningText, readCopTaskDetail } from "@/core/auth/task-deeplink";
|
||||||
|
|
||||||
/** 内置「模板数据转换器」agent 的稳定 id。仅此 agent 的对话页显示「页面模板 + 渲染预览」调试入口。 */
|
/** 内置「模板数据转换器」agent 的稳定 id。仅此 agent 的对话页显示「页面模板 + 渲染预览」调试入口。 */
|
||||||
const TEMPLATE_BUILDER_AGENT_ID = "template-json-builder";
|
const TEMPLATE_BUILDER_AGENT_ID = "template-json-builder";
|
||||||
@@ -100,10 +101,25 @@ export default function AgentChatPage({
|
|||||||
|
|
||||||
// 任务深链上下文(taskId + 开场信息):闸门(rwfx)与纯绑定(3qfx/xdfx)都要读取。
|
// 任务深链上下文(taskId + 开场信息):闸门(rwfx)与纯绑定(3qfx/xdfx)都要读取。
|
||||||
const taskCtxOn = !!(taskGate || taskBind);
|
const taskCtxOn = !!(taskGate || taskBind);
|
||||||
const taskContext = useMemo(
|
const taskContext = useMemo(() => {
|
||||||
() => (taskCtxOn ? readTaskContext() : null),
|
if (!taskCtxOn) return null;
|
||||||
[taskCtxOn],
|
const stored = readTaskContext();
|
||||||
);
|
if (stored && stored.agentId === agent_id) return stored;
|
||||||
|
// 3qfx:若任务上下文偶发丢失,但登录深链留下的任务详情仍在,则用它前端兜底重建
|
||||||
|
// taskId + openingText,避免 landing 既不自动开始、也没有“开始回答”按钮。
|
||||||
|
if (taskBind && !taskGate) {
|
||||||
|
const detail = readCopTaskDetail();
|
||||||
|
const fallbackTaskId = detail?.id == null ? "" : String(detail.id).trim();
|
||||||
|
if (detail && fallbackTaskId && agent_id) {
|
||||||
|
return {
|
||||||
|
taskId: fallbackTaskId,
|
||||||
|
agentId: agent_id,
|
||||||
|
openingText: buildTaskOpeningText(detail, fallbackTaskId),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stored;
|
||||||
|
}, [agent_id, taskBind, taskCtxOn, taskGate]);
|
||||||
const taskId =
|
const taskId =
|
||||||
taskCtxOn && taskContext && taskContext.agentId === agent_id
|
taskCtxOn && taskContext && taskContext.agentId === agent_id
|
||||||
? taskContext.taskId
|
? taskContext.taskId
|
||||||
|
|||||||
@@ -60,7 +60,12 @@ function useChatsBase(taskBase: string): {
|
|||||||
const { agent_id } = useParams<{ agent_id: string }>();
|
const { agent_id } = useParams<{ agent_id: string }>();
|
||||||
const agentId = agent_id ?? "";
|
const agentId = agent_id ?? "";
|
||||||
const ctx = readTaskContext();
|
const ctx = readTaskContext();
|
||||||
const taskId = ctx?.taskId ?? "";
|
const detail = readCopTaskDetail();
|
||||||
|
const fallbackTaskId =
|
||||||
|
detail?.id == null ? "" : String(detail.id).trim();
|
||||||
|
// 3qfx 偶发会出现 task context 丢失,但任务详情仍在 sessionStorage 的情况。
|
||||||
|
// 这里回退到任务详情里的 taskId,避免左侧对话列表直接失效成“空任务态”。
|
||||||
|
const taskId = ctx?.taskId ?? fallbackTaskId;
|
||||||
const actionId = ctx?.partitionByAction ? (ctx.actionId ?? "") : "";
|
const actionId = ctx?.partitionByAction ? (ctx.actionId ?? "") : "";
|
||||||
return { taskId, agentId, actionId, chatsBase: `${taskBase}/agent/${agentId}/chats` };
|
return { taskId, agentId, actionId, chatsBase: `${taskBase}/agent/${agentId}/chats` };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user