feat(task-deeplink): xdfx 开场信息追加行动标题与行动内容
xdfx(行动分析)深链开场信息原先只附行动id(action_id),现额外 拼上行动标题(actionName)与行动内容(narration)。优先读登录时 缓存的行动详情(readActionDetail),无缓存再 fetchActionDetail,避免 重复请求。buildOpeningText 第三参数由 actionId 改为 ActionOpeningInfo。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b818836d7
commit
ea2ea9783e
1 file changed
+23
-5
@@ -233,16 +233,28 @@ export interface TaskDeeplinkTarget {
|
||||
state?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** xdfx(行动分析)开场信息里要追加的行动信息:行动标题 + 行动内容 + 行动id。 */
|
||||
interface ActionOpeningInfo {
|
||||
/** 行动id(action_id)。 */
|
||||
actionId?: string;
|
||||
/** 行动标题(行动名称 actionName)。 */
|
||||
actionName?: string;
|
||||
/** 行动内容(行动叙事 narration)。 */
|
||||
narration?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用 taskName / taskContent 拼出开场信息文本;末尾附上任务 id(task_id),供后端识别任务。
|
||||
* xdfx(行动分析)额外附上「行动id(action_id)」——传入 actionId 时追加该行。
|
||||
* xdfx(行动分析)额外附上「行动标题 / 行动内容 / 行动id(action_id)」——传入 action 时追加这几行。
|
||||
*/
|
||||
function buildOpeningText(detail: CopTaskDetail, taskId: string, actionId?: string): string {
|
||||
function buildOpeningText(detail: CopTaskDetail, taskId: string, action?: ActionOpeningInfo): string {
|
||||
return [
|
||||
detail.taskName ? `任务名称:${detail.taskName}` : "",
|
||||
detail.taskContent ? `任务内容:${detail.taskContent}` : "",
|
||||
taskId ? `任务id(task_id)为${taskId}` : "",
|
||||
actionId ? `行动id(action_id)为${actionId}` : "",
|
||||
action?.actionName ? `行动标题:${action.actionName}` : "",
|
||||
action?.narration ? `行动内容:${action.narration}` : "",
|
||||
action?.actionId ? `行动id(action_id)为${action.actionId}` : "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
@@ -316,13 +328,19 @@ export async function resolveTaskDeeplinkTarget(
|
||||
// 暂存任务上下文(taskId + agentId + 开场信息),跳到 chats 索引,由工作区按 taskId 决定
|
||||
// 开最新历史对话 / 新建。rwfx 在工作区里额外过「目的树闸门」;3qfx/xdfx 仅 1:N 列表,
|
||||
// 新建对话直接带开场信息自动发出(见 task-purpose / AgentChatPage 的 taskGate / taskBind)。
|
||||
// xdfx(行动分析):聊天记录按「行动id」划分(partitionByAction),且开场信息追加 action_id。
|
||||
// xdfx(行动分析):聊天记录按「行动id」划分(partitionByAction),且开场信息追加
|
||||
// 行动标题 / 行动内容 / action_id(行动详情登录解析任务id 时已缓存,优先读缓存避免重复请求)。
|
||||
const isXdfx = parsed.businessCode === XDFX_BUSINESS_CODE;
|
||||
const actionId = rawId || taskId;
|
||||
let actionInfo: ActionOpeningInfo | undefined;
|
||||
if (isXdfx) {
|
||||
const ad = rawId ? (readActionDetail() ?? (await fetchActionDetail(rawId))) : null;
|
||||
actionInfo = { actionId, actionName: ad?.actionName, narration: ad?.narration };
|
||||
}
|
||||
persistTaskContext({
|
||||
taskId,
|
||||
agentId,
|
||||
openingText: buildOpeningText(detail, taskId, isXdfx ? actionId : undefined),
|
||||
openingText: buildOpeningText(detail, taskId, actionInfo),
|
||||
actionId,
|
||||
partitionByAction: isXdfx,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user