feat: 深度研究支持独立新报告与原文改写,并完善沙箱、模型管理与全文改写
新报告不再覆盖当前文件卡片,写入时打开沙箱;步骤条仅在改写原文时位于卡片上方。同时补齐改写本地回退、模型管理与会商第三步相关改动。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
11f928bc95
commit
a5a9c952e8
63 files changed
+4113
-929
No files matched your search
@@ -11,6 +11,8 @@ import { createClientId } from "@/lib/client-id";
|
||||
export type DocumentRewritePresentation = {
|
||||
id: string;
|
||||
threadId: string;
|
||||
/** A report regeneration is a new document, not an edit of the current one. */
|
||||
operation: "rewrite" | "generate";
|
||||
source: {
|
||||
kind: "artifact" | "deep_research_report";
|
||||
id: string;
|
||||
@@ -37,6 +39,10 @@ export type DocumentRewritePresentation = {
|
||||
originalContent: string;
|
||||
rewrittenContent: string | null;
|
||||
versionId: string | null;
|
||||
/** Hash of the currently committed rewrite, used by the local undo fallback. */
|
||||
committedHash: string | null;
|
||||
/** A browser-only undo backup is available because the server snapshot failed. */
|
||||
localFallbackAvailable: boolean;
|
||||
/** Inverse snapshot created by a safe undo; enables a one-click reapply. */
|
||||
redoVersionId: string | null;
|
||||
revertedAt: string | null;
|
||||
@@ -49,6 +55,7 @@ type CreatePresentationInput = Omit<
|
||||
DocumentRewritePresentation,
|
||||
| "id"
|
||||
| "stage"
|
||||
| "operation"
|
||||
| "generateImages"
|
||||
| "maxGeneratedImages"
|
||||
| "generatedImageCount"
|
||||
@@ -62,14 +69,19 @@ type CreatePresentationInput = Omit<
|
||||
| "originalContent"
|
||||
| "rewrittenContent"
|
||||
| "versionId"
|
||||
| "committedHash"
|
||||
| "localFallbackAvailable"
|
||||
| "redoVersionId"
|
||||
| "revertedAt"
|
||||
| "error"
|
||||
| "createdAt"
|
||||
| "updatedAt"
|
||||
> & {
|
||||
operation?: DocumentRewritePresentation["operation"];
|
||||
originalContent?: string;
|
||||
rewrittenContent?: string | null;
|
||||
committedHash?: string | null;
|
||||
localFallbackAvailable?: boolean;
|
||||
requirementsPlan?: string;
|
||||
generateImages?: boolean;
|
||||
maxGeneratedImages?: number;
|
||||
@@ -107,6 +119,7 @@ export function DocumentRewritePresentationProvider({
|
||||
...input,
|
||||
id,
|
||||
stage: "snapshot",
|
||||
operation: input.operation ?? "rewrite",
|
||||
generateImages: input.generateImages === true,
|
||||
maxGeneratedImages: Math.min(Math.max(input.maxGeneratedImages ?? 2, 1), 4),
|
||||
generatedImageCount: 0,
|
||||
@@ -120,6 +133,8 @@ export function DocumentRewritePresentationProvider({
|
||||
originalContent: input.originalContent ?? "",
|
||||
rewrittenContent: input.rewrittenContent ?? null,
|
||||
versionId: null,
|
||||
committedHash: input.committedHash ?? null,
|
||||
localFallbackAvailable: input.localFallbackAvailable === true,
|
||||
redoVersionId: null,
|
||||
revertedAt: null,
|
||||
error: null,
|
||||
@@ -180,3 +195,12 @@ export function useDocumentRewritePresentation() {
|
||||
|
||||
/** Browser event consumed by the open sandbox after an in-feed undo succeeds. */
|
||||
export const DOCUMENT_REWRITE_UNDONE_EVENT = "deerflow:document-rewrite-undone";
|
||||
|
||||
/** Synchronous guard used before a browser-only undo writes back the original text. */
|
||||
export const DOCUMENT_REWRITE_LOCAL_UNDO_GUARD_EVENT = "deerflow:document-rewrite-local-undo-guard";
|
||||
|
||||
/** Sent after the user confirms a rewrite so the conversation can reveal its new step card. */
|
||||
export const DOCUMENT_REWRITE_STARTED_EVENT = "deerflow:document-rewrite-started";
|
||||
|
||||
/** A completed structural-regeneration card requests an in-place rewrite of that new report. */
|
||||
export const DEEP_RESEARCH_REPORT_REWRITE_REQUESTED_EVENT = "deerflow:deep-research-report-rewrite-requested";
|
||||
Reference in new issue
Block a user