Merge branch 'ji'
# Conflicts: # CLAUDE.md
This commit is contained in:
commit
ec56fa671b
6 files changed
+69
-18
No files matched your search
@@ -233,12 +233,16 @@ export interface TaskDeeplinkTarget {
|
||||
state?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** 用 taskName / taskContent 拼出开场信息文本;末尾附上任务 id(task_id),供后端识别任务。 */
|
||||
function buildOpeningText(detail: CopTaskDetail, taskId: string): string {
|
||||
/**
|
||||
* 用 taskName / taskContent 拼出开场信息文本;末尾附上任务 id(task_id),供后端识别任务。
|
||||
* xdfx(行动分析)额外附上「行动id(action_id)」——传入 actionId 时追加该行。
|
||||
*/
|
||||
function buildOpeningText(detail: CopTaskDetail, taskId: string, actionId?: string): string {
|
||||
return [
|
||||
detail.taskName ? `任务名称:${detail.taskName}` : "",
|
||||
detail.taskContent ? `任务内容:${detail.taskContent}` : "",
|
||||
taskId ? `任务id(task_id)为${taskId}` : "",
|
||||
actionId ? `行动id(action_id)为${actionId}` : "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
@@ -312,11 +316,15 @@ export async function resolveTaskDeeplinkTarget(
|
||||
// 暂存任务上下文(taskId + agentId + 开场信息),跳到 chats 索引,由工作区按 taskId 决定
|
||||
// 开最新历史对话 / 新建。rwfx 在工作区里额外过「目的树闸门」;3qfx/xdfx 仅 1:N 列表,
|
||||
// 新建对话直接带开场信息自动发出(见 task-purpose / AgentChatPage 的 taskGate / taskBind)。
|
||||
// xdfx(行动分析):聊天记录按「行动id」划分(partitionByAction),且开场信息追加 action_id。
|
||||
const isXdfx = parsed.businessCode === XDFX_BUSINESS_CODE;
|
||||
const actionId = rawId || taskId;
|
||||
persistTaskContext({
|
||||
taskId,
|
||||
agentId,
|
||||
openingText: buildOpeningText(detail, taskId),
|
||||
actionId: rawId || taskId,
|
||||
openingText: buildOpeningText(detail, taskId, isXdfx ? actionId : undefined),
|
||||
actionId,
|
||||
partitionByAction: isXdfx,
|
||||
});
|
||||
return { path: `${taskBase}/agent/${agentId}/chats` };
|
||||
}
|
||||
@@ -41,6 +41,12 @@ export interface TaskContext {
|
||||
openingText: string;
|
||||
/** 深链原始 id(xdfx 为「行动id」,需追加行动id 的按钮用;其它业务等于 taskId)。 */
|
||||
actionId?: string;
|
||||
/**
|
||||
* xdfx(行动分析)专属:聊天记录按「行动id」(actionId) 而非「任务id」划分。
|
||||
* 为 true 时,新建对话额外打 `metadata.actionId` 标签、对话列表按 actionId 过滤
|
||||
* (仍保留 taskId 标签以维持任务深链对话「全局共享、不分用户」的后端语义)。
|
||||
*/
|
||||
partitionByAction?: boolean;
|
||||
}
|
||||
|
||||
const TASK_CONTEXT_STORAGE_KEY = "task.rwfxContext";
|
||||
@@ -311,12 +317,29 @@ export function readTaskContext(): TaskContext | null {
|
||||
agentId: String(parsed.agentId),
|
||||
openingText: typeof parsed.openingText === "string" ? parsed.openingText : "",
|
||||
actionId: typeof parsed.actionId === "string" ? parsed.actionId : undefined,
|
||||
partitionByAction: parsed.partitionByAction === true,
|
||||
};
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务深链对话的 thread metadata 标签(既用于「新建对话」打标签,也用于对话列表过滤)。
|
||||
* - 普通业务(rwfx/3qfx):`{ taskId }` —— 按任务划分(1:N)。
|
||||
* - xdfx(partitionByAction):`{ taskId, actionId }` —— 额外按「行动id」划分聊天记录;
|
||||
* 仍带 taskId 以保留后端「任务深链对话全局共享」的语义(后端据 metadata.taskId 跳过分用户过滤)。
|
||||
* 无有效 taskId 时返回 undefined(调用方据此不打标签)。
|
||||
*/
|
||||
export function taskThreadMetadata(
|
||||
ctx: TaskContext | null | undefined,
|
||||
): Record<string, unknown> | undefined {
|
||||
if (!ctx?.taskId) return undefined;
|
||||
return ctx.partitionByAction && ctx.actionId
|
||||
? { taskId: ctx.taskId, actionId: ctx.actionId }
|
||||
: { taskId: ctx.taskId };
|
||||
}
|
||||
|
||||
export function clearTaskContext(): void {
|
||||
try {
|
||||
sessionStorage.removeItem(TASK_CONTEXT_STORAGE_KEY);
|
||||
|
||||
Reference in new issue
Block a user