Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-server into dhk-1
This commit is contained in:
commit
8c6d08d6bf
3 files changed
+47
-10
No files matched your search
@@ -50,10 +50,18 @@ import {
|
||||
type TemplateRenderResult,
|
||||
} from "@/core/scheduled-tasks";
|
||||
import { env } from "@/env";
|
||||
import { readTaskContext, taskThreadMetadata } from "@/core/auth/task-purpose";
|
||||
import {
|
||||
readTaskContext,
|
||||
taskThreadMetadata,
|
||||
type TaskContext,
|
||||
} from "@/core/auth/task-purpose";
|
||||
import { TaskPurposePanel } from "@/strategy-components/components/task-components/TaskPurposePanel";
|
||||
import { desensitize } from "@/lib/desensitize";
|
||||
import { buildTaskOpeningText, readCopTaskDetail } from "@/core/auth/task-deeplink";
|
||||
import {
|
||||
buildTaskOpeningText,
|
||||
readActionDetail,
|
||||
readCopTaskDetail,
|
||||
} from "@/core/auth/task-deeplink";
|
||||
|
||||
/** 内置「模板数据转换器」agent 的稳定 id。仅此 agent 的对话页显示「页面模板 + 渲染预览」调试入口。 */
|
||||
const TEMPLATE_BUILDER_AGENT_ID = "template-json-builder";
|
||||
@@ -104,7 +112,8 @@ export default function AgentChatPage({
|
||||
|
||||
// 任务深链上下文(taskId + 开场信息):闸门(rwfx)与纯绑定(3qfx/xdfx)都要读取。
|
||||
const taskCtxOn = !!(taskGate || taskBind);
|
||||
const taskContext = useMemo(() => {
|
||||
const isXdfxTaskBind = !!chatBasePath?.includes("/plan-task-action/");
|
||||
const taskContext = useMemo<TaskContext | null>(() => {
|
||||
if (!taskCtxOn) return null;
|
||||
const stored = readTaskContext();
|
||||
if (stored && stored.agentId === agent_id) return stored;
|
||||
@@ -114,15 +123,28 @@ export default function AgentChatPage({
|
||||
const detail = readCopTaskDetail();
|
||||
const fallbackTaskId = detail?.id == null ? "" : String(detail.id).trim();
|
||||
if (detail && fallbackTaskId && agent_id) {
|
||||
const actionDetail = isXdfxTaskBind ? readActionDetail() : null;
|
||||
const actionId = actionDetail?.id ? String(actionDetail.id).trim() : "";
|
||||
const actionTaskId = actionDetail?.taskId ? String(actionDetail.taskId).trim() : "";
|
||||
const hasMatchingAction =
|
||||
!!actionId && !!actionTaskId && actionTaskId === fallbackTaskId;
|
||||
const actionInfo = hasMatchingAction
|
||||
? {
|
||||
actionId,
|
||||
actionName: actionDetail?.actionName,
|
||||
narration: actionDetail?.narration,
|
||||
}
|
||||
: undefined;
|
||||
return {
|
||||
taskId: fallbackTaskId,
|
||||
agentId: agent_id,
|
||||
openingText: buildTaskOpeningText(detail, fallbackTaskId),
|
||||
openingText: buildTaskOpeningText(detail, fallbackTaskId, actionInfo),
|
||||
...(hasMatchingAction ? { actionId, partitionByAction: true } : {}),
|
||||
};
|
||||
}
|
||||
}
|
||||
return stored;
|
||||
}, [agent_id, taskBind, taskCtxOn, taskGate]);
|
||||
}, [agent_id, isXdfxTaskBind, taskBind, taskCtxOn, taskGate]);
|
||||
const taskId =
|
||||
taskCtxOn && taskContext && taskContext.agentId === agent_id
|
||||
? taskContext.taskId
|
||||
|
||||
Reference in new issue
Block a user