Просмотр исходного кода

fix(studio): align revise endpoint with pipeline modes

Ma 7 месяцев назад
Родитель
Сommit
a0cf181e32
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      packages/studio/src/api/server.ts

+ 5 - 3
packages/studio/src/api/server.ts

@@ -660,7 +660,9 @@ export function createStudioServer(initialConfig: ProjectConfig, root: string) {
     const id = c.req.param("id");
     const chapterNum = parseInt(c.req.param("chapter"), 10);
     const bookDir = state.bookDir(id);
-    const body = await c.req.json<{ mode?: string; brief?: string }>().catch(() => ({ mode: "local-fix" }));
+    const body = await c.req
+      .json<{ mode?: string; brief?: string }>()
+      .catch(() => ({ mode: "spot-fix", brief: undefined }));
 
     broadcast("revise:start", { bookId: id, chapter: chapterNum });
     try {
@@ -674,11 +676,11 @@ export function createStudioServer(initialConfig: ProjectConfig, root: string) {
       const pipeline = new PipelineRunner(await buildPipelineConfig({
         externalContext: body.brief,
       }));
-      const normalizedMode = body.mode === "spot-fix" ? "local-fix" : (body.mode ?? "local-fix");
+      const normalizedMode = body.mode ?? "spot-fix";
       const result = await pipeline.reviseDraft(
         id,
         chapterNum,
-        normalizedMode as "polish" | "rewrite" | "rework" | "local-fix" | "anti-detect",
+        normalizedMode as "polish" | "rewrite" | "rework" | "spot-fix" | "anti-detect",
       );
       broadcast("revise:complete", { bookId: id, chapter: chapterNum });
       return c.json(result);