FN-7312: send task context to planner chat
Send bounded task state into task-detail planner chat so status and progress questions can be answered in context. - Build reusable server-side planner chat context from task metadata, dependencies, steps, comments, activity, source, and review state. - Pass and validate the task id on planner chat sends to keep sessions scoped to the current task. - Update planner chat copy, docs, tests, and changeset coverage for task-aware status/progress questions. Files changed: .changeset/fn-7312-task-planner-chat-context.md | 7 + docs/dashboard-guide.md | 4 +- packages/dashboard/app/api/legacy.ts | 5 +- .../app/components/TaskPlannerChatTab.tsx | 5 +- .../__tests__/TaskPlannerChatTab.test.tsx | 22 ++ .../dashboard/src/__tests__/chat-manager.test.ts | 17 +- .../dashboard/src/__tests__/chat-routes.test.ts | 76 +++++ .../__tests__/task-planner-chat-context.test.ts | 165 +++++++++++ packages/dashboard/src/chat.ts | 92 +----- .../dashboard/src/routes/register-chat-routes.ts | 11 +- .../dashboard/src/task-planner-chat-context.ts | 326 +++++++++++++++++++++ 11 files changed, 634 insertions(+), 96 deletions(-) Fusion-Task-Id: FN-7312 Fusion-Task-Lineage: 90cf0fe3-3984-4a67-bb44-fce492c256eb Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
@@ -10241,7 +10241,7 @@ export function streamChatResponse(
|
||||
handlers: ChatStreamHandlers,
|
||||
attachments?: File[],
|
||||
projectId?: string,
|
||||
options?: { maxReconnectAttempts?: number; firstEventTimeoutMs?: number },
|
||||
options?: { maxReconnectAttempts?: number; firstEventTimeoutMs?: number; taskId?: string },
|
||||
): { close: () => void; isConnected: () => boolean } {
|
||||
const url = buildApiUrl(withProjectId(`/chat/sessions/${encodeURIComponent(sessionId)}/messages`, projectId));
|
||||
|
||||
@@ -10337,10 +10337,11 @@ export function streamChatResponse(
|
||||
? (() => {
|
||||
const formData = new FormData();
|
||||
formData.append("content", content);
|
||||
if (options?.taskId) formData.append("taskId", options.taskId);
|
||||
attachments.forEach((file) => formData.append("attachments", file));
|
||||
return formData;
|
||||
})()
|
||||
: JSON.stringify({ content });
|
||||
: JSON.stringify({ content, ...(options?.taskId ? { taskId: options.taskId } : {}) });
|
||||
|
||||
const res = await fetch(url, {
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user