mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-27 21:50:36 +00:00
* feat: add workspace change review * chore: format workspace change files * fix: optimize workspace change summaries * style: refine workspace change badge scale * fix: restore workspace change user context import * fix(frontend): gate workspace change badge to assistant messages Only pass run_id to assistant MessageListItems so the workspace-change badge can never render under a user's prompt, which carries the same run_id. Assert single badge render in the E2E flow. * fix(workspace-changes): address review feedback on diff parsing and badge - Restrict unified-diff header detection to "+++ "/"--- " (trailing space) in both backend _count_diff_lines and frontend getWorkspaceChangeLineClass so content lines beginning with +++/--- are counted/styled correctly - Gate WorkspaceChangeBadge to ai messages so tool messages folded into an assistant group don't render a duplicate badge - Add regression tests for both diff-classification fixes - Apply prettier formatting to workspace-changes files flagged by CI --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
35 lines
934 B
TypeScript
35 lines
934 B
TypeScript
import { getBackendBaseURL } from "@/core/config";
|
|
|
|
import type { WorkspaceChangesResponse } from "./types";
|
|
|
|
export async function fetchWorkspaceChanges({
|
|
threadId,
|
|
runId,
|
|
includeFiles = true,
|
|
includeDiff = true,
|
|
}: {
|
|
threadId: string;
|
|
runId: string;
|
|
includeFiles?: boolean;
|
|
includeDiff?: boolean;
|
|
}): Promise<WorkspaceChangesResponse> {
|
|
const query = new URLSearchParams({
|
|
include_files: includeFiles ? "true" : "false",
|
|
include_diff: includeDiff ? "true" : "false",
|
|
});
|
|
const response = await fetch(
|
|
`${getBackendBaseURL()}/api/threads/${encodeURIComponent(
|
|
threadId,
|
|
)}/runs/${encodeURIComponent(runId)}/workspace-changes?${query}`,
|
|
);
|
|
|
|
if (!response.ok) {
|
|
const error = await response
|
|
.json()
|
|
.catch(() => ({ detail: "Failed to load workspace changes." }));
|
|
throw new Error(error.detail ?? "Failed to load workspace changes.");
|
|
}
|
|
|
|
return response.json();
|
|
}
|