From 40fefdffefe2ab0c4ed8f63b602ebfa18aef6335 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 7 Jun 2026 19:24:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor(dev):=20=E5=89=8D=E7=AB=AF=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8C=96=20Step=202=20=E2=80=94=20=E6=8A=BD=E5=87=BA?= =?UTF-8?q?=20newtask.js(=E6=96=B0=E5=BB=BA=E4=BB=BB=E5=8A=A1=E5=BC=B9?= =?UTF-8?q?=E6=A1=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务名 / 工作目录(新建 sentinel 或复用已有 + 二级 input 联动)/ 描述 / skill / 模型 select,提交 POST /v1/tasks(原 main 1146–1320)→ newtask.js(186 行)。 - 顶层自绑 hd-new 打开 / nt-go 提交 / 各 input 联动;唯一对外导出 loadFolderSuggestions(供 main enterApp 初始化顶部 filter-wd、files 复制/移动后刷目录)—— 它从 main 迁来后,files.js 对它的 import 从 ./main.js 改指 ./newtask.js。 - 反向 import main glue loadModels(加 export)/ loadTaskList / selectTask + logout(auth)。 main.js 删至 1220 行。node 全检过、import/export 一致性校验过、 私有符号清零。 Co-Authored-By: Claude Opus 4.8 (1M context) --- PROGRESS.md | 3 +- web/static/js/files.js | 3 +- web/static/js/main.js | 178 +------------------------------------ web/static/js/newtask.js | 185 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 178 deletions(-) create mode 100644 web/static/js/newtask.js diff --git a/PROGRESS.md b/PROGRESS.md index 856e7e3..d22e042 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -2,7 +2,7 @@ > 配合 `DESIGN.md`。本文件只记 phase 状态、决策偏差、文件量、下一步。每条 1-2 句:做了啥 + 关键判断;细节查 `git log` / `git diff` / `DESIGN §7.9`。 -最后更新:2026-06-07(前端模块化 Step 2:抽出 layout / auth / preview / files / media.js) +最后更新:2026-06-07(前端模块化 Step 2:抽出 … / media / newtask.js) --- @@ -23,6 +23,7 @@ ### 2026-06-06 +- **前端模块化 Step 2:抽出 `newtask.js`(新建任务弹框)**:任务名 / 工作目录(新建 sentinel 或复用已有 + 二级 input 联动)/ 描述 / skill / 模型 select,提交 `POST /v1/tasks`(原 main.js 1146–1320)→ `newtask.js`(186 行)。顶层自绑 hd-new 打开 / nt-go 提交 / 各 input 联动;唯一对外导出 `loadFolderSuggestions`(供 main enterApp 初始化顶部 filter-wd、files 复制/移动后刷目录)——它从 main 迁来后,`files.js` 对它的 import 从 `./main.js` 改指 `./newtask.js`。反向 import main glue `loadModels`(加 `export`)/`loadTaskList`/`selectTask` + `logout`(auth)。main.js 删至 1220 行。node 全检过、import/export 一致性校验过、私有符号清零。 - **前端模块化 Step 2:抽出 `media.js`(工具活动标签 + artifact 抽取/渲染)+ 收敛 downloadFile 反向依赖**:对话内 `toolActivityLabel`(工具调用→中文活动名)、`extractArtifactRels`(从结果文本/working_dir 提产物路径)、`extractMediaBanner`(seedream/seedance 横幅)、`renderArtifactBarHtml`(产物 chip 条 + 图/视频内联占位)、`upgradeMediaArtifacts`(占位异步 fetch blob 填 ``/`