From e9bd2c31f241f97da42dba172aff65031b026672 Mon Sep 17 00:00:00 2001 From: DemonGatanjieu <1027066412@qq.com> Date: Mon, 3 Aug 2026 01:57:39 +0800 Subject: [PATCH] Refine recipe UI interactions --- .agents/logs/ai_changelog.md | 15 ++ .agents/logs/ai_lessons.md | 6 + .agents/plans/gpt_recipe_ui_refactor.md | 60 ++++++ .../workflow_recipe_detail_panel_design.md | 2 + ARCHITECTURE.md | 1 + web/modules/locales.js | 22 ++ web/modules/ui_recipe_detail.js | 197 ++++++++++++++++-- web/modules/ui_recipes.js | 21 +- web/styles.css | 144 ++++++++++++- 9 files changed, 445 insertions(+), 23 deletions(-) create mode 100644 .agents/plans/gpt_recipe_ui_refactor.md diff --git a/.agents/logs/ai_changelog.md b/.agents/logs/ai_changelog.md index 7c54a2e..9a10592 100644 --- a/.agents/logs/ai_changelog.md +++ b/.agents/logs/ai_changelog.md @@ -154,3 +154,18 @@ - `node --check` for every JavaScript file under `web/` - `python_embeded/python.exe -m py_compile api/__init__.py api/models.py api/recipes.py api/recipe_packages.py` - `git diff --check` + +## [Snapshot] 2026-08-03 — Refine recipe detail UI + +**Implemented** + +- Added visible success/failure feedback to detail and card parameter-copy actions. +- Added inline editing for recipe name, notes, and tags; metadata updates send the complete existing recipe payload through `/anomalous/update_recipe` and preserve normal history behavior. +- Moved workflow fingerprints and model SHA-256 values into collapsed Advanced information disclosures. +- Added restrained glass card styling, responsive grid spacing, modern font fallbacks, rounded action controls, and hover transitions. + +**Validation** + +- `node --check` for every JavaScript file under `web/` +- `python_embeded/python.exe -m py_compile api/__init__.py api/models.py api/recipes.py api/recipe_packages.py` +- `git diff --check` diff --git a/.agents/logs/ai_lessons.md b/.agents/logs/ai_lessons.md index af9e79c..61d124d 100644 --- a/.agents/logs/ai_lessons.md +++ b/.agents/logs/ai_lessons.md @@ -327,3 +327,9 @@ This document serves as an architectural retrospective and UX diagnostic log for (脱离画布的快速排队在正常 ComfyUI 画布之外又建立了一条执行路径。提示词转换、排队契约、校验和 UI 反馈都要单独维护,容易造成不同入口行为漂移,也难以解释失败原因。) **The Solution (方案)**: Remove the detached execution surface and make recipe actions load or transactionally append the saved workflow through shared handlers. List cards and detail panels now reuse the same confirmation, missing-node warning, error feedback, and successful Workspace closure behavior. (移除脱离画布的执行入口,让配方动作通过共享处理器加载或事务性追加已保存工作流。列表卡片和详情面板统一复用确认、缺失节点提示、错误反馈和成功关闭工作台的行为。) + +## 53. Inline Metadata Editing Must Preserve the Full Recipe Contract (内联元数据编辑也必须保留完整配方契约) +**The Problem (问题)**: The update endpoint validates a complete recipe, not a partial metadata patch. A convenient inline editor that sends only `name` or `notes` would either fail validation or tempt the backend to grow a second partial-update contract with weaker history semantics. +(更新接口校验的是完整配方,而不是局部元数据补丁。内联编辑如果只发送 `name` 或 `notes`,要么直接失败,要么会诱导后端新增一套历史语义更弱的局部更新契约。) +**The Solution (方案)**: Keep the inline editor lightweight at the UI layer, but clone and submit the already-loaded complete recipe through the existing update endpoint. Mutate the local view only after a successful response, then refresh the lightweight card list. +(界面可以轻量内联编辑,但仍复制已加载的完整配方并走现有更新接口。只有收到成功响应后才更新当前视图,并刷新轻量卡片列表。) diff --git a/.agents/plans/gpt_recipe_ui_refactor.md b/.agents/plans/gpt_recipe_ui_refactor.md new file mode 100644 index 0000000..7be71be --- /dev/null +++ b/.agents/plans/gpt_recipe_ui_refactor.md @@ -0,0 +1,60 @@ +# Recipe 交互与视觉全面重构方案 (GPT 执行计划) + +根据用户的最新反馈,当前的 Recipe 工作台存在以下痛点: +1. **复制按钮无反馈**:点击某些复制按钮(如“复制提示词”、“复制指纹”)虽然实际复制成功,但视觉上没有任何变化,导致用户以为没点上。 +2. **编辑体验反人类**:修改名称等基本信息需要弹出一个巨大的复杂对话框,操作繁琐。 +3. **UI 过于“极客”**:界面展示了太多哈希值、底层标识,且缺乏现代美感。 +4. **历史负担为零**:现有的本地测试数据可以无视,直接重构数据结构或展示逻辑即可,无需为了向下兼容丑陋的老数据而妥协设计。 + +请严格按照以下步骤对代码进行大修: + +--- + +## 步骤 1:修复复制反馈缺失 (Copy Feedback) + +**目标文件**:`web/modules/ui_recipe_detail.js` + +1. **统一的反馈封装**:编写一个全局的 `copyTextWithFeedback(buttonElement, text)` 辅助函数。 + - 内部调用 `navigator.clipboard.writeText(text)`。 + - 成功后,记录按钮原始的 `textContent`,将文本暂时改为 `✓ 已复制`(或带有 check 图标),并给按钮加上 `copied-success` 的 CSS 类(用于变绿等动画)。 + - 设置 `setTimeout` 在 1.2 秒后恢复原状。 +2. **替换无反馈的按钮调用**: + - 在 `renderOverview` 中,找到 `copyPrompt.onclick` 和 `copyFingerprint.onclick`。 + - 将它们改为调用 `copyTextWithFeedback(copyPrompt, promptBundle)`,确保用户点击大按钮时有明显的成功提示。 + +--- + +## 步骤 2:告别反人类的编辑,实现“内联编辑 (Inline Edit)” + +**目标文件**:`web/modules/ui_recipe_detail.js` (以及对应的 CSS 文件) + +目前的 `editRecipe` 会弹出一个包含参数、封面、名字的巨大弹窗,极其笨重。我们改为**所见即所得**的内联编辑: +1. **名称支持点击修改**: + - 在 `renderOverview` 渲染 `