feat: complete ImageStudio UI redesign rollout #3
共有 65 个文件被更改,包括 5561 次插入 和 583 次删除
409
CHANGELOG.md
409
CHANGELOG.md
|
|
@ -1,198 +1,371 @@
|
|||
## 1.0.66
|
||||
|
||||
- Complete P0-P2 style-profile hardening: decouple age and anatomy evidence, enforce review consistency caps, gate core traits by cross-context evidence, re-audit semantic rewrites, deduplicate scale capsules, use neutral validation scenes, add layered rendering review, improve score trust display, and block automatic adoption of regressed candidates.
|
||||
|
||||
## 1.0.65
|
||||
|
||||
- Improve style transfer with adaptive face and eye proportions, opaque pearlescent hair-highlight constraints, high-frequency representative-image guidance, and representative reference validation enabled by default with safe pure-text fallback.
|
||||
|
||||
## 1.0.64
|
||||
|
||||
- Preserve high-specificity artist signatures with an evidence-gated style kernel, scale-specific prompt adapters, and background-effect isolation for portrait, full-body, and novel-scene validation.
|
||||
|
||||
## 1.0.63
|
||||
|
||||
- Compact the final style prompt into an evidence-backed style kernel, preserve palette/highlights/shading traits after paraphrase, remove literal background effects without evidence, and neutralize age/body template locks.
|
||||
|
||||
## 1.0.62
|
||||
|
||||
- Soften facial-age and head-to-body style cues so user-requested age, gender presentation, body maturity and proportions remain authoritative; reduce childlike or adult template locking during style transfer.
|
||||
|
||||
## 1.0.61
|
||||
|
||||
- Add a selectable advanced-style consensus strategy: pure-text structured consensus by default, with opt-in vision-assisted consensus for cases that benefit from direct image review.
|
||||
|
||||
## 1.0.60
|
||||
|
||||
- Use pure-text structured cross-image consensus from per-image recognition reports, avoiding multi-image Vision relay timeouts while preserving the existing normalization and validation workflow.
|
||||
|
||||
## 1.0.59
|
||||
|
||||
- Reduce grouped consensus vision calls to one representative image plus structured reports to avoid relay multi-image stalls.
|
||||
|
||||
## 1.0.58
|
||||
|
||||
- Split large style consensus requests into grouped multi-image analysis plus a compact final merge to reduce provider timeouts.
|
||||
|
||||
## 1.0.57
|
||||
|
||||
- Make the persisted plugin-data selection authoritative for the dedicated cross-analysis route.
|
||||
|
||||
## 1.0.56
|
||||
|
||||
- Ensure the dedicated consensus route overrides stale task snapshots and survives blank AstrBot runtime defaults.
|
||||
|
||||
## 1.0.55
|
||||
|
||||
- Fix AstrBot runtime-config bridging for the independent `advanced_style_consensus` route so the selected model is actually used.
|
||||
|
||||
## 1.0.54
|
||||
|
||||
- Add an independent `advanced_style_consensus` vision route for multi-image style cross-analysis; blank keeps the recognition-route fallback.
|
||||
- Isolate large cross-image vision requests from the single-image recognition route.
|
||||
|
||||
## 1.0.53
|
||||
|
||||
- Limit concurrent advanced-material vision requests per route to avoid GPT-5.6 relay timeouts when eight images fan out at once.
|
||||
- Add `advanced_materials.recognition_concurrency`, defaulting to `2`.
|
||||
|
||||
# Changelog
|
||||
|
||||
本项目从 1.0.8 起使用该文件记录可验收的小版本。开发中的版本仅代表代码里程碑;完成全部二次审计队列后再统一部署。
|
||||
鏈」鐩粠 1.0.8 璧蜂娇鐢ㄨ鏂囦欢璁板綍鍙獙鏀剁殑灏忕増鏈€傚紑鍙戜腑鐨勭増鏈粎浠h〃浠g爜閲岀▼纰戯紱瀹屾垚鍏ㄩ儴浜屾瀹¤闃熷垪鍚庡啀缁熶竴閮ㄧ讲銆?
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.52] - 2026-07-20
|
||||
|
||||
- Remove source prompt, artist-name and tag anchoring from multi-image style consensus input.
|
||||
- Keep only cross-source-supported signature traits, reject low-support multi-dimension summaries, and reduce final style prompt duplication.
|
||||
|
||||
|
||||
## [1.0.51] - 2026-07-20
|
||||
|
||||
- Improve artist-style extraction with dimension-balanced signature traits across face structure, eyes, hair, linework, shading, palette, highlights, texture and anatomy.
|
||||
- Weight signatures by cross-source support and specificity, reuse structured source attributes, and mark signatures explicitly in the final generation prompt to reduce generic-anime style collapse.
|
||||
|
||||
|
||||
## [1.0.50] - 2026-07-20
|
||||
|
||||
- 增加画师风格签名特征聚合,优先保留跨源可验证的高辨识度线稿、眼睛、发丝高光、配色和阴影结构,减少多图共识被压平为通用动漫风格。
|
||||
- 过滤通用标签并保留签名特征进入最终 portrait/fullbody/novel_scene 生成提示词。
|
||||
|
||||
## [1.0.49] - 2026-07-20
|
||||
|
||||
- 修复已封存的 accepted 流仍显示在最近导入和验证工作台的问题。
|
||||
- 验证工作台默认折叠,支持点击展开和收起。
|
||||
|
||||
## [1.0.48] - 2026-07-20
|
||||
|
||||
- 封存验证流后,工作台自动隐藏已封存记录并切换到下一条未封存流,避免封存项目继续显示在最近导入区域。
|
||||
|
||||
## [1.0.47] - 2026-07-20
|
||||
|
||||
- 加强 portrait 验证的脸宽高比、颧部、下颌和下巴轮廓约束,减少头像生成时脸型偏移,同时不改变 fullbody/novel_scene 规则。
|
||||
|
||||
## [1.0.46] - 2026-07-20
|
||||
|
||||
- 参考图改为默认关闭,先进阶画风验证默认使用纯文本生成;仍可由用户显式开启参考图。
|
||||
|
||||
## [1.0.45] - 2026-07-20
|
||||
|
||||
- 参考图生成遇到中转站 400/422/5xx 兼容性错误时,自动回退为纯文本生成;429、鉴权失败和网络超时不盲目重试。
|
||||
- 保留参考图首选路径,兼容不支持 image 字段的 OpenAI-compatible 网关。
|
||||
|
||||
## [1.0.44] - 2026-07-20
|
||||
|
||||
- 加固 advanced-style 验证提示词,移除 juvenile、toddler 及明确二至四头身措辞,保留 neotenic 画风结构与全身比例约束,降低中转站风控误判概率。
|
||||
- 保存图像供应商失败的 HTTP 状态码、路由和安全响应摘要,便于区分 502、429、内容审核和超时。
|
||||
|
||||
## [1.0.43] - 2026-07-20
|
||||
|
||||
- 修复 advanced-style 重试后旧失败记录未标记为已替代的问题,补齐 superseded 时间戳写回。
|
||||
- 批量重试按 source/case lineage 去重,只重试每条逻辑任务的最新失败记录,并归并历史失败记录。
|
||||
|
||||
## [1.0.42] - 2026-07-20
|
||||
|
||||
- 直接重试失败的 advanced-material 子任务后,旧失败记录标记为“已被重试替代”,不再继续占用“需处理”列表。
|
||||
- 新增“jobs/failed/retry”批量接口与队列页“一键重试全部失败任务”,逐条失败也会继续处理并返回错误明细。
|
||||
|
||||
|
||||
## [1.0.41] - 2026-07-20
|
||||
|
||||
- Normalize advanced-material queue retry responses to return the replacement task shape expected by the queue page.
|
||||
|
||||
|
||||
## [1.0.40] - 2026-07-20
|
||||
|
||||
- Queue-page retry now dispatches advanced style source and validation tasks to their direct retry handlers instead of retrying the whole import.
|
||||
|
||||
|
||||
## [1.0.39] - 2026-07-20
|
||||
|
||||
- Fix style validation when the configured image gateway rejects the optional reference-image field with a generic 4xx HTTP error.
|
||||
- Retry the same validation request without `input_images`, preserving the new reference-image feature for compatible providers while keeping current NAS routes usable.
|
||||
|
||||
## [1.0.38] - 2026-07-20
|
||||
|
||||
- First-round style validation can attach one optional source image as a style-only reference (shared by portrait/fullbody/novel_scene).
|
||||
- Default uses representative/primary source; UI can pick any recognized sample or disable reference for pure-text transfer.
|
||||
- Prompt + negatives forbid identity/costume/pose/scene copy from the reference; providers that reject input images fall back to pure text with metadata flags.
|
||||
- Soft anatomy band from 1.0.37 and age-band ownership by content prompt remain unchanged.
|
||||
|
||||
## [1.0.37] - 2026-07-20
|
||||
|
||||
- Full-body style transfer adds a soft anatomy band (about 5-7 heads tall, prefer observed source ratio) to prevent chibi/super-deformed collapse after removing mature-adult locks.
|
||||
- Keep facial neoteny transferable; do not restore mature adult-woman identity locks. Negative prompt blocks 2-4 heads tall bodies on fullbody validation.
|
||||
|
||||
## [1.0.36] - 2026-07-20
|
||||
|
||||
- 鐢婚杩佺Щ鍙栨秷鈥滄垚鐔熸垚骞?/ 6.5鈥?.5 澶磋韩鈥濈‖閿侊細榛樿楠岃瘉涓讳綋涓嶅啀寮哄埗 mature adult body锛涘叏韬繚鐣欐簮鍥?head-to-body 涓庤偄浣撴娊璞°€?
|
||||
- facial_age_stylization銆佹簮鍥句綋鍨嬫瘮渚嬩綔涓哄彲杩佺Щ缁撴瀯椋庢牸淇濈暀锛涘疄闄?鏃跺簭骞撮緞浠呬綔鍙傝€冿紝涓嶅啓鍏ョ敓鍥?prompt銆?
|
||||
- 楠岃瘉 content prompt 鐨勫勾榫勫甫锛堝皯濂?鎴愬コ绛夛級鐢辩敤鎴锋寚浠ゆ垨鍐呭鎻愮ず鎺у埗锛涙湭鎸囧畾鏃朵繚鎸佷腑鎬у苟璁╂簮鍥鹃鏍煎崰涓汇€?
|
||||
|
||||
## [1.0.35] - 2026-07-20
|
||||
|
||||
- 鍔犲浐闃熷垪 QueueWorker 澶辫触璺緞锛氫笟鍔″け璐ユ垨浜屾鍐欏簱寮傚父涓嶅啀鏉€姝?worker 绾跨▼锛岄伩鍏?advanced-material 浠诲姟姘镐箙鍗″湪 queued銆?
|
||||
- worker 寰幆瀵?run_once 澧炲姞澶栧眰鍏滃簳锛泂tart 鍙湪绾跨▼鎰忓閫€鍑哄悗閲嶆柊鎷夎捣锛汚piError 閿欒娑堟伅浼樺厛灞曠ず message 涓?error_code銆?
|
||||
- 瑙嗚璇嗗埆 prohibited_content 绛変笟鍔″け璐ヤ粛璁颁负 failed锛屼絾闃熷垪涓庡悗缁换鍔″彲缁х画 claim 涓庢墽琛屻€?
|
||||
|
||||
## [1.0.34] - 2026-07-19
|
||||
|
||||
- 杩涢樁鐢婚 portrait銆乫ullbody銆乶ovel_scene 涓夎矾杩佺Щ楠岃瘉浣跨敤鐙珛 900 绉掔敓鍥捐秴鏃讹紝骞跺皢鍚屼竴鏁板€兼寔涔呭寲鍒伴槦鍒楄姹傘€佷换鍔″厓鏁版嵁鍜屽疄闄?Provider 璇锋眰锛涙櫘閫氬揩閫熺敓鍥剧户缁娇鐢ㄩ€傞厤鍣ㄨ嚜韬殑榛樿瓒呮椂銆?
|
||||
- 鐢熷浘 Provider 鏀寔鍗曟璇锋眰瑕嗙洊瓒呮椂锛岃寖鍥撮檺鍒朵负 10锝?600 绉掞紱閬垮厤涓轰簡鎱㈤€熼獙璇佹ā鍨嬭€岃杩彁楂樻墍鏈夌敓鍥句换鍔$殑鍏ㄥ眬绛夊緟鏃堕棿銆?
|
||||
- AstrBot 鎻掍欢妗ュ拰鍐呭祵椤甸潰鐨勯暱浠诲姟绛夊緟缁熶竴涓?900 绉掞紝浠诲姟鍗$洿鎺ユ樉绀哄悗绔褰曠殑鑰楁椂涓婇檺锛屼笉鍐嶅嚭鐜板墠绔厛鎶ヨ秴鏃躲€佸悗绔粛鍦ㄨ繍琛岀殑鍐茬獊鎻愮ず銆?
|
||||
- 淇 SQLite 鏃犳椂鍖?UTC 鏃堕棿琚祻瑙堝櫒褰撴垚鏈湴鏃堕棿瑙f瀽鐨勯棶棰橈紱澶辫触銆佸畬鎴愬拰鍙栨秷浠诲姟鐨勮€楁椂鍥哄畾浣跨敤 `updated_at - created_at`锛屼笉鍐嶆樉绀洪敊璇殑 8 灏忔椂鎴栭殢椤甸潰鍋滅暀鎸佺画澧為暱銆?
|
||||
|
||||
## [1.0.33] - 2026-07-19
|
||||
|
||||
- 灏嗚劯閮ㄥ勾榫勯鏍笺€佸疄闄呭勾榫勪笌韬綋鎴愮啛搴︽媶鍒嗗鐞嗭紱鐢婚姝e悜鎻愮ず璇嶄笉鍐嶇户鎵挎湭鎴愬勾銆侀潚灏戝勾鎴栧辜鎬佽韩浣撴帾杈烇紝涓夌粍楠岃瘉涓讳綋缁熶竴涓烘槑纭垚骞翠汉锛屽叏韬獙璇佸浐瀹氭垚鐔熻偄浣撻暱搴︿笌绾?6.5锝?.5 澶磋韩姣斾緥銆?
|
||||
- 鐢婚鏍稿績椤广€佸繀椤讳繚鐣欓」鍙婅儗鏅€佸叿浣撳厜鏁堛€佸叿浣撹壊鐩樼瓑鏄撴薄鏌撳唴瀹瑰鍔犺瘉鎹棬鎺э紱浠呭綋澶氬浘鏀寔鐜囦笉浣庝簬 60%銆佺疆淇″害涓嶄綆浜?70% 鏃惰繘鍏ユ渶缁堟彁绀鸿瘝銆?
|
||||
- 鑷姩杩樺師搴﹁瘎鍒嗗鍔犱竴鑷存€ф牎鍑嗭細鏈€缁堝垎涓嶉珮浜庢ā鍨嬭嚜璇勫垎锛屽亸宸€佷慨姝hˉ涓併€佽涔夐闄╁拰鏂囧瓧涓ラ噸搴︿細鎵e垎锛涒€滅淮搴﹀叏婊″垎浣嗗悓鏃惰姹備慨姝b€濅細鏍囪涓哄鏍哥粨鏋滀笉涓€鑷淬€?
|
||||
- 瀵规ā鍨嬬粰鍑虹殑瀹夊叏鏀瑰啓鍐嶅仛涓€娆¤涔夊舰鐘跺璁★紱鍙戜笣楂樺厜涓殑鍏夌幆銆佹í甯︺€佹潯鍧楃瓑鐗╀綋鍖栨帾杈炴敼鍐欎负璐村悎鍙戜笣鏇查潰鐨勫崐閫忔槑鏂画缂庨潰鍏夋辰锛屽苟鍔犲叆鐧借壊瀹炵嚎銆佽繛缁厜甯︺€佸嚑浣曟姌绾垮潡绛夎礋鍚戠害鏉熴€?
|
||||
- 鍏叡 detailed 鐢婚鑳跺泭涓?portrait/fullbody/novel_scene 灏哄害鑳跺泭鍦ㄦ湇鍔$鍘婚噸锛屽昂搴﹁兌鍥婂彧淇濈暀璇ユ瀯鍥惧昂搴︾嫭鏈夌殑绾︽潫锛屽噺灏戦暱鎻愮ず璇嶇殑閲嶅娉ㄦ剰鍔涘崰鐢ㄣ€?
|
||||
- 榛樿涓庢ā鍨嬭繑鍥炵殑楠岃瘉鍐呭缁熶竴缁忚繃涓€у寲锛氬ご鍍忎娇鐢ㄥ搼鍏夋鎷嶏紝鍏ㄨ韩浣跨敤涓€ф棩鍏夛紝璺ㄥ満鏅娇鐢ㄦ櫘閫氶槾澶╋紝绉婚櫎榛庢槑銆佹棩钀姐€侀湏铏广€佹暎鏅€侀暅澶村厜鏅曘€佷綋绉厜涓庢垙鍓ф€ч€嗗厜鍋忕疆銆?
|
||||
|
||||
## [1.0.32] - 2026-07-18
|
||||
|
||||
- 画风验证审核升级为固定维度协议;服务端按头像、全身、跨场景分别加权脸部、眼睛、线稿、色彩、阴影、比例与背景,不再直接采用视觉模型的自由总分,并记录维度覆盖率与缺失项。
|
||||
- 复验共识自动聚合上一轮三张验证图,将至少两个场景重复出现的问题归类为公共画风缺陷,将单场景问题保留为尺度胶囊修正,避免头像问题污染全身或场景提示词。
|
||||
- 共识协议新增全局色彩与局部色差分离、结构化差异、提示词补丁、语义风险审计和尺度胶囊;可能被字面化为物体、光效或构图的比喻必须改写为表面、几何与位置关系。
|
||||
- detailed 画风胶囊改由服务端编译:按核心、结构、渲染优先级合并 `must_preserve`,近义去重并限制为 14 条公共核心特征,再叠加最多 5 条场景尺度特征,减少长提示词的注意力稀释。
|
||||
- 每轮三图完成后自动与上一轮计算总分和分场景差值,标记采用候选、保留上一版或需要人工判断;视觉审核失败仍不影响生成图片保留。
|
||||
- 鐢婚楠岃瘉瀹℃牳鍗囩骇涓哄浐瀹氱淮搴﹀崗璁紱鏈嶅姟绔寜澶村儚銆佸叏韬€佽法鍦烘櫙鍒嗗埆鍔犳潈鑴搁儴銆佺溂鐫涖€佺嚎绋裤€佽壊褰┿€侀槾褰便€佹瘮渚嬩笌鑳屾櫙锛屼笉鍐嶇洿鎺ラ噰鐢ㄨ瑙夋ā鍨嬬殑鑷敱鎬诲垎锛屽苟璁板綍缁村害瑕嗙洊鐜囦笌缂哄け椤广€?
|
||||
- 澶嶉獙鍏辫瘑鑷姩鑱氬悎涓婁竴杞笁寮犻獙璇佸浘锛屽皢鑷冲皯涓や釜鍦烘櫙閲嶅鍑虹幇鐨勯棶棰樺綊绫讳负鍏叡鐢婚缂洪櫡锛屽皢鍗曞満鏅棶棰樹繚鐣欎负灏哄害鑳跺泭淇锛岄伩鍏嶅ご鍍忛棶棰樻薄鏌撳叏韬垨鍦烘櫙鎻愮ず璇嶃€?
|
||||
- 鍏辫瘑鍗忚鏂板鍏ㄥ眬鑹插僵涓庡眬閮ㄨ壊宸垎绂汇€佺粨鏋勫寲宸紓銆佹彁绀鸿瘝琛ヤ竵銆佽涔夐闄╁璁″拰灏哄害鑳跺泭锛涘彲鑳借瀛楅潰鍖栦负鐗╀綋銆佸厜鏁堟垨鏋勫浘鐨勬瘮鍠诲繀椤绘敼鍐欎负琛ㄩ潰銆佸嚑浣曚笌浣嶇疆鍏崇郴銆?
|
||||
- detailed 鐢婚鑳跺泭鏀圭敱鏈嶅姟绔紪璇戯細鎸夋牳蹇冦€佺粨鏋勩€佹覆鏌撲紭鍏堢骇鍚堝苟 `must_preserve`锛岃繎涔夊幓閲嶅苟闄愬埗涓?14 鏉″叕鍏辨牳蹇冪壒寰侊紝鍐嶅彔鍔犳渶澶?5 鏉″満鏅昂搴︾壒寰侊紝鍑忓皯闀挎彁绀鸿瘝鐨勬敞鎰忓姏绋€閲娿€?
|
||||
- 姣忚疆涓夊浘瀹屾垚鍚庤嚜鍔ㄤ笌涓婁竴杞绠楁€诲垎鍜屽垎鍦烘櫙宸€硷紝鏍囪閲囩敤鍊欓€夈€佷繚鐣欎笂涓€鐗堟垨闇€瑕佷汉宸ュ垽鏂紱瑙嗚瀹℃牳澶辫触浠嶄笉褰卞搷鐢熸垚鍥剧墖淇濈暀銆?
|
||||
|
||||
## [1.0.31] - 2026-07-18
|
||||
|
||||
- 画风逐图识别与交叉共识新增脸型、眼睛/虹膜、鼻口简化、头身比、发束组织、线条拓扑、阴影色相、高光形状和色彩关系等结构画风维度,不再只输出通用动漫渲染标签。
|
||||
- 归一化层保留视觉模型返回的 `normalized_asset_profile.attributes`,并为画风自动生成 `must_preserve`;修复结构化属性退化成单一 `legacy_description` 的问题。
|
||||
- 内容污染清单仅用于审计,不再原样注入生图负向提示词;改为只排除具体源角色身份、具体服装设计、姿势与场景,避免误伤 Moe 比例、动物耳等风格耦合特征。
|
||||
- 修复 detailed 胶囊含逗号语义短语被拆碎、短共识与详细胶囊重复拼接、正负提示词多次重复的问题,并对缺少结构维度的模型自报置信度进行服务端降权。
|
||||
- 每张验证图生成后自动使用代表源图进行视觉还原度审核,持久化维度评分、主要匹配/偏差及下一轮修正提示;审核失败不会丢弃已经生成的图片。
|
||||
- 进阶画风验证卡片显示自动还原度和主要偏差;视觉模型格式错误新增脱敏后的具体响应问题和解析原因。
|
||||
- 鐢婚閫愬浘璇嗗埆涓庝氦鍙夊叡璇嗘柊澧炶劯鍨嬨€佺溂鐫?铏硅啘銆侀蓟鍙g畝鍖栥€佸ご韬瘮銆佸彂鏉熺粍缁囥€佺嚎鏉℃嫇鎵戙€侀槾褰辫壊鐩搞€侀珮鍏夊舰鐘跺拰鑹插僵鍏崇郴绛夌粨鏋勭敾椋庣淮搴︼紝涓嶅啀鍙緭鍑洪€氱敤鍔ㄦ极娓叉煋鏍囩銆?
|
||||
- 褰掍竴鍖栧眰淇濈暀瑙嗚妯″瀷杩斿洖鐨?`normalized_asset_profile.attributes`锛屽苟涓虹敾椋庤嚜鍔ㄧ敓鎴?`must_preserve`锛涗慨澶嶇粨鏋勫寲灞炴€ч€€鍖栨垚鍗曚竴 `legacy_description` 鐨勯棶棰樸€?
|
||||
- 鍐呭姹℃煋娓呭崟浠呯敤浜庡璁★紝涓嶅啀鍘熸牱娉ㄥ叆鐢熷浘璐熷悜鎻愮ず璇嶏紱鏀逛负鍙帓闄ゅ叿浣撴簮瑙掕壊韬唤銆佸叿浣撴湇瑁呰璁°€佸Э鍔夸笌鍦烘櫙锛岄伩鍏嶈浼?Moe 姣斾緥銆佸姩鐗╄€崇瓑椋庢牸鑰﹀悎鐗瑰緛銆?
|
||||
- 淇 detailed 鑳跺泭鍚€楀彿璇箟鐭琚媶纰庛€佺煭鍏辫瘑涓庤缁嗚兌鍥婇噸澶嶆嫾鎺ャ€佹璐熸彁绀鸿瘝澶氭閲嶅鐨勯棶棰橈紝骞跺缂哄皯缁撴瀯缁村害鐨勬ā鍨嬭嚜鎶ョ疆淇″害杩涜鏈嶅姟绔檷鏉冦€?
|
||||
- 姣忓紶楠岃瘉鍥剧敓鎴愬悗鑷姩浣跨敤浠h〃婧愬浘杩涜瑙嗚杩樺師搴﹀鏍革紝鎸佷箙鍖栫淮搴﹁瘎鍒嗐€佷富瑕佸尮閰?鍋忓樊鍙婁笅涓€杞慨姝f彁绀猴紱瀹℃牳澶辫触涓嶄細涓㈠純宸茬粡鐢熸垚鐨勫浘鐗囥€?
|
||||
- 杩涢樁鐢婚楠岃瘉鍗$墖鏄剧ず鑷姩杩樺師搴﹀拰涓昏鍋忓樊锛涜瑙夋ā鍨嬫牸寮忛敊璇柊澧炶劚鏁忓悗鐨勫叿浣撳搷搴旈棶棰樺拰瑙f瀽鍘熷洜銆?
|
||||
|
||||
## [1.0.30] - 2026-07-18
|
||||
|
||||
- 进阶画风复验会同时提交代表源图、上一轮三张失败验证图、全部源图识别报告、上一版提示词与用户修正,视觉模型可直接进行前后对照。
|
||||
- 将“太强、降低、太弱、加强、移除、保持”等反馈解析为 increase/decrease/remove/preserve 结构化方向,并持久化对照清单与实际调整计划。
|
||||
- 增加服务端语义防反转;例如“颜色对比太过强烈”不会再被转换为 intense/extreme/high contrast,而会落实为适中克制的对比并排除过强色差。
|
||||
- 三张验证生图统一使用 detailed 画风胶囊及其负向约束,不再只使用短共识提示词;仍保持纯文本迁移验证,不向生图模型传递源图。
|
||||
- 杩涢樁鐢婚澶嶉獙浼氬悓鏃舵彁浜や唬琛ㄦ簮鍥俱€佷笂涓€杞笁寮犲け璐ラ獙璇佸浘銆佸叏閮ㄦ簮鍥捐瘑鍒姤鍛娿€佷笂涓€鐗堟彁绀鸿瘝涓庣敤鎴蜂慨姝o紝瑙嗚妯″瀷鍙洿鎺ヨ繘琛屽墠鍚庡鐓с€?
|
||||
- 灏嗏€滃お寮恒€侀檷浣庛€佸お寮便€佸姞寮恒€佺Щ闄ゃ€佷繚鎸佲€濈瓑鍙嶉瑙f瀽涓?increase/decrease/remove/preserve 缁撴瀯鍖栨柟鍚戯紝骞舵寔涔呭寲瀵圭収娓呭崟涓庡疄闄呰皟鏁磋鍒掋€?
|
||||
- 澧炲姞鏈嶅姟绔涔夐槻鍙嶈浆锛涗緥濡傗€滈鑹插姣斿お杩囧己鐑堚€濅笉浼氬啀琚浆鎹负 intense/extreme/high contrast锛岃€屼細钀藉疄涓洪€備腑鍏嬪埗鐨勫姣斿苟鎺掗櫎杩囧己鑹插樊銆?
|
||||
- 涓夊紶楠岃瘉鐢熷浘缁熶竴浣跨敤 detailed 鐢婚鑳跺泭鍙婂叾璐熷悜绾︽潫锛屼笉鍐嶅彧浣跨敤鐭叡璇嗘彁绀鸿瘝锛涗粛淇濇寔绾枃鏈縼绉婚獙璇侊紝涓嶅悜鐢熷浘妯″瀷浼犻€掓簮鍥俱€?
|
||||
|
||||
- 已完成全仓角色工作流二次审计;确认在现有 `character_gradual` 主线上增量修复,不创建平行工作流。
|
||||
- 修复队列已按 1.0.9–1.0.20 小版本写入 `docs/workflow-secondary-audit-development-queue.md`。
|
||||
- 宸插畬鎴愬叏浠撹鑹插伐浣滄祦浜屾瀹¤锛涚‘璁ゅ湪鐜版湁 `character_gradual` 涓荤嚎涓婂閲忎慨澶嶏紝涓嶅垱寤哄钩琛屽伐浣滄祦銆?
|
||||
- 淇闃熷垪宸叉寜 1.0.9鈥?.0.20 灏忕増鏈啓鍏?`docs/workflow-secondary-audit-development-queue.md`銆?
|
||||
|
||||
## [1.0.29] - 2026-07-17
|
||||
|
||||
- 进阶素材的画风样本、三张当前验证图、单图源图/验证图以及历史轮次缩略图全部接入统一大图预览卡片。
|
||||
- 点击或使用键盘 Enter/空格可打开原图优先的大图预览,支持滚轮缩放、按钮缩放、双击缩放、拖动画布、重置和 Esc 关闭。
|
||||
- 大图遮罩继续使用安全单击关闭逻辑,文本拖选、图片拖动或指针移出卡片不会误触关闭。
|
||||
- 缩略图增加放大光标、键盘焦点和明确的“点击查看大图”提示。
|
||||
- 杩涢樁绱犳潗鐨勭敾椋庢牱鏈€佷笁寮犲綋鍓嶉獙璇佸浘銆佸崟鍥炬簮鍥?楠岃瘉鍥句互鍙婂巻鍙茶疆娆$缉鐣ュ浘鍏ㄩ儴鎺ュ叆缁熶竴澶у浘棰勮鍗$墖銆?
|
||||
- 鐐瑰嚮鎴栦娇鐢ㄩ敭鐩?Enter/绌烘牸鍙墦寮€鍘熷浘浼樺厛鐨勫ぇ鍥鹃瑙堬紝鏀寔婊氳疆缂╂斁銆佹寜閽缉鏀俱€佸弻鍑荤缉鏀俱€佹嫋鍔ㄧ敾甯冦€侀噸缃拰 Esc 鍏抽棴銆?
|
||||
- 澶у浘閬僵缁х画浣跨敤瀹夊叏鍗曞嚮鍏抽棴閫昏緫锛屾枃鏈嫋閫夈€佸浘鐗囨嫋鍔ㄦ垨鎸囬拡绉诲嚭鍗$墖涓嶄細璇Е鍏抽棴銆?
|
||||
- 缂╃暐鍥惧鍔犳斁澶у厜鏍囥€侀敭鐩樼劍鐐瑰拰鏄庣‘鐨勨€滅偣鍑绘煡鐪嬪ぇ鍥锯€濇彁绀恒€?
|
||||
|
||||
## [1.0.28] - 2026-07-17
|
||||
|
||||
- 修复进阶画风导入后端使用 `advanced_style_set`、前端只识别 `style_set`,导致三图验证被误判为单图流程且主界面只显示一张验证图的问题。
|
||||
- 多图画风当前轮次恢复为头像、全身、跨场景三张验证卡片;三张图分别显示状态、提示词、文字调整和随机种子。
|
||||
- 验证轮次列表与详情接口为每一轮附带完整 `validation_cases`,历史轮次也可同时查看三张缩略图,不再只展示聚合轮次的第一张投影图。
|
||||
- 兼容旧 `style_set`、正式 `advanced_style_set` 以及服务端 `metadata.style_set` 标记,避免升级前后的记录再次走错前端分支。
|
||||
- 淇杩涢樁鐢婚瀵煎叆鍚庣浣跨敤 `advanced_style_set`銆佸墠绔彧璇嗗埆 `style_set`锛屽鑷翠笁鍥鹃獙璇佽璇垽涓哄崟鍥炬祦绋嬩笖涓荤晫闈㈠彧鏄剧ず涓€寮犻獙璇佸浘鐨勯棶棰樸€?
|
||||
- 澶氬浘鐢婚褰撳墠杞鎭㈠涓哄ご鍍忋€佸叏韬€佽法鍦烘櫙涓夊紶楠岃瘉鍗$墖锛涗笁寮犲浘鍒嗗埆鏄剧ず鐘舵€併€佹彁绀鸿瘝銆佹枃瀛楄皟鏁村拰闅忔満绉嶅瓙銆?
|
||||
- 楠岃瘉杞鍒楄〃涓庤鎯呮帴鍙d负姣忎竴杞檮甯﹀畬鏁?`validation_cases`锛屽巻鍙茶疆娆′篃鍙悓鏃舵煡鐪嬩笁寮犵缉鐣ュ浘锛屼笉鍐嶅彧灞曠ず鑱氬悎杞鐨勭涓€寮犳姇褰卞浘銆?
|
||||
- 鍏煎鏃?`style_set`銆佹寮?`advanced_style_set` 浠ュ強鏈嶅姟绔?`metadata.style_set` 鏍囪锛岄伩鍏嶅崌绾у墠鍚庣殑璁板綍鍐嶆璧伴敊鍓嶇鍒嗘敮銆?
|
||||
|
||||
## [1.0.27] - 2026-07-17
|
||||
|
||||
- 进阶画风复验拆分为“画风修正”和“下一轮验证内容”两条独立输入:前者只重建画风共识与胶囊,后者直接写入三个验证生图提示词。
|
||||
- 修复第二轮强制复用第一轮老年男性、机器人和宇航员场景的问题;用户指定角色、服装、构图或场景后会重建验证案例,且最终 `expanded_prompt` 必定包含用户原文。
|
||||
- 只修改画风时继续沿用相同验证场景与种子,便于 A/B 比较;修改验证内容时使用新种子,避免旧构图被随机种子持续锁定。
|
||||
- 默认验证改为同一新角色的近域头像、全身和跨场景三级对照,减少角色年龄、物种与写实先验对画风判断的干扰。
|
||||
- 验证卡片显示已应用的文字调整和实际种子;历史轮次持久化画风修正、验证内容及其作用范围。
|
||||
- 旧客户端继续支持单一 `adjustment_text`,服务端会同时应用到画风与验证内容链路,避免反馈静默丢失。
|
||||
- 杩涢樁鐢婚澶嶉獙鎷嗗垎涓衡€滅敾椋庝慨姝b€濆拰鈥滀笅涓€杞獙璇佸唴瀹光€濅袱鏉$嫭绔嬭緭鍏ワ細鍓嶈€呭彧閲嶅缓鐢婚鍏辫瘑涓庤兌鍥婏紝鍚庤€呯洿鎺ュ啓鍏ヤ笁涓獙璇佺敓鍥炬彁绀鸿瘝銆?
|
||||
- 淇绗簩杞己鍒跺鐢ㄧ涓€杞€佸勾鐢锋€с€佹満鍣ㄤ汉鍜屽畤鑸憳鍦烘櫙鐨勯棶棰橈紱鐢ㄦ埛鎸囧畾瑙掕壊銆佹湇瑁呫€佹瀯鍥炬垨鍦烘櫙鍚庝細閲嶅缓楠岃瘉妗堜緥锛屼笖鏈€缁?`expanded_prompt` 蹇呭畾鍖呭惈鐢ㄦ埛鍘熸枃銆?
|
||||
- 鍙慨鏀圭敾椋庢椂缁х画娌跨敤鐩稿悓楠岃瘉鍦烘櫙涓庣瀛愶紝渚夸簬 A/B 姣旇緝锛涗慨鏀归獙璇佸唴瀹规椂浣跨敤鏂扮瀛愶紝閬垮厤鏃ф瀯鍥捐闅忔満绉嶅瓙鎸佺画閿佸畾銆?
|
||||
- 榛樿楠岃瘉鏀逛负鍚屼竴鏂拌鑹茬殑杩戝煙澶村儚銆佸叏韬拰璺ㄥ満鏅笁绾у鐓э紝鍑忓皯瑙掕壊骞撮緞銆佺墿绉嶄笌鍐欏疄鍏堥獙瀵圭敾椋庡垽鏂殑骞叉壈銆?
|
||||
- 楠岃瘉鍗$墖鏄剧ず宸插簲鐢ㄧ殑鏂囧瓧璋冩暣鍜屽疄闄呯瀛愶紱鍘嗗彶杞鎸佷箙鍖栫敾椋庝慨姝c€侀獙璇佸唴瀹瑰強鍏朵綔鐢ㄨ寖鍥淬€?
|
||||
- 鏃у鎴风缁х画鏀寔鍗曚竴 `adjustment_text`锛屾湇鍔$浼氬悓鏃跺簲鐢ㄥ埌鐢婚涓庨獙璇佸唴瀹归摼璺紝閬垮厤鍙嶉闈欓粯涓㈠け銆?
|
||||
|
||||
## [1.0.26] - 2026-07-17
|
||||
|
||||
- 修复任务较多时队列卡片被滚动区域压缩的问题;任务卡改为纵向自然高度排列,状态、标题、进度条与耗时不再相互覆盖。
|
||||
- 进阶素材验证轮询改为只更新当前活动导入或导入摘要,不再每 4.5 秒全量刷新导入库与素材库。
|
||||
- 增加轮询互斥,防止慢请求发生重叠;轮询失败保持当前页面,不再触发错误态或视觉重置。
|
||||
- 图片展示优先使用稳定的 `storage://` URI 缓存,忽略同一媒体每轮变化的临时签名 URL,避免验证生成期间图片反复重载和页面闪烁。
|
||||
- 淇浠诲姟杈冨鏃堕槦鍒楀崱鐗囪婊氬姩鍖哄煙鍘嬬缉鐨勯棶棰橈紱浠诲姟鍗℃敼涓虹旱鍚戣嚜鐒堕珮搴︽帓鍒楋紝鐘舵€併€佹爣棰樸€佽繘搴︽潯涓庤€楁椂涓嶅啀鐩镐簰瑕嗙洊銆?
|
||||
- 杩涢樁绱犳潗楠岃瘉杞鏀逛负鍙洿鏂板綋鍓嶆椿鍔ㄥ鍏ユ垨瀵煎叆鎽樿锛屼笉鍐嶆瘡 4.5 绉掑叏閲忓埛鏂板鍏ュ簱涓庣礌鏉愬簱銆?
|
||||
- 澧炲姞杞浜掓枼锛岄槻姝㈡參璇锋眰鍙戠敓閲嶅彔锛涜疆璇㈠け璐ヤ繚鎸佸綋鍓嶉〉闈紝涓嶅啀瑙﹀彂閿欒鎬佹垨瑙嗚閲嶇疆銆?
|
||||
- 鍥剧墖灞曠ず浼樺厛浣跨敤绋冲畾鐨?`storage://` URI 缂撳瓨锛屽拷鐣ュ悓涓€濯掍綋姣忚疆鍙樺寲鐨勪复鏃剁鍚?URL锛岄伩鍏嶉獙璇佺敓鎴愭湡闂村浘鐗囧弽澶嶉噸杞藉拰椤甸潰闂儊銆?
|
||||
|
||||
## [1.0.25] - 2026-07-17
|
||||
|
||||
- 修复进阶素材队列记录被手动删除后,导入或样本仍保持 queued/running 并永久卡住的问题;详情读取、列表刷新和重试前会将缺失任务对账为可重试失败。
|
||||
- 新增未封存进阶导入删除接口与前端双击确认按钮;删除会先取消残留任务,再级联清理样本、交叉共识、验证轮次和进阶素材独立文件。
|
||||
- 已封存为高优先级素材的导入禁止删除,仍需通过素材归档流程处理,避免破坏素材库、衣橱和工作流引用。
|
||||
- 缺失队列任务会显示明确提示,可选择单独重试、排除样本或删除整个导入,不再只显示模糊的“待处理样本”。
|
||||
- 淇杩涢樁绱犳潗闃熷垪璁板綍琚墜鍔ㄥ垹闄ゅ悗锛屽鍏ユ垨鏍锋湰浠嶄繚鎸?queued/running 骞舵案涔呭崱浣忕殑闂锛涜鎯呰鍙栥€佸垪琛ㄥ埛鏂板拰閲嶈瘯鍓嶄細灏嗙己澶变换鍔″璐︿负鍙噸璇曞け璐ャ€?
|
||||
- 鏂板鏈皝瀛樿繘闃跺鍏ュ垹闄ゆ帴鍙d笌鍓嶇鍙屽嚮纭鎸夐挳锛涘垹闄や細鍏堝彇娑堟畫鐣欎换鍔★紝鍐嶇骇鑱旀竻鐞嗘牱鏈€佷氦鍙夊叡璇嗐€侀獙璇佽疆娆″拰杩涢樁绱犳潗鐙珛鏂囦欢銆?
|
||||
- 宸插皝瀛樹负楂樹紭鍏堢骇绱犳潗鐨勫鍏ョ姝㈠垹闄わ紝浠嶉渶閫氳繃绱犳潗褰掓。娴佺▼澶勭悊锛岄伩鍏嶇牬鍧忕礌鏉愬簱銆佽。姗卞拰宸ヤ綔娴佸紩鐢ㄣ€?
|
||||
- 缂哄け闃熷垪浠诲姟浼氭樉绀烘槑纭彁绀猴紝鍙€夋嫨鍗曠嫭閲嶈瘯銆佹帓闄ゆ牱鏈垨鍒犻櫎鏁翠釜瀵煎叆锛屼笉鍐嶅彧鏄剧ず妯$硦鐨勨€滃緟澶勭悊鏍锋湰鈥濄€?
|
||||
|
||||
## [1.0.24] - 2026-07-17
|
||||
|
||||
- 模型分工统一为双源路由:每个文本/视觉节点分别选择 ImageStudio 插件适配器与 AstrBot 模型提供商,执行顺序固定为插件优先、AstrBot 备用。
|
||||
- 素材识别、进阶素材识别、多图画风共识、结构化文本调用和生成后视觉审核加入故障转移;前置提供商失败时自动尝试备用,并保留失败摘要。
|
||||
- 生图节点明确只选择 ImageStudio 生图适配器;AstrBot 4.25 没有公开生图桥接接口,因此界面禁用不可执行的宿主生图选择,避免保存后运行失败。
|
||||
- 进阶画风失败样本重试时重新读取当前双源配置,并同步刷新父导入路由,修复旧 `material_vlm` 被任务永久冻结的问题。
|
||||
- 提示词转译、生成前内容审核与生成后图片审核同步使用双选择栏;旧单路由配置保持兼容,双路由继续存为单个 AstrBot 配置字符串。
|
||||
- 修正运行时版本常量与发布元数据不同步的问题,状态页和插件元数据统一显示 1.0.24。
|
||||
- 妯″瀷鍒嗗伐缁熶竴涓哄弻婧愯矾鐢憋細姣忎釜鏂囨湰/瑙嗚鑺傜偣鍒嗗埆閫夋嫨 ImageStudio 鎻掍欢閫傞厤鍣ㄤ笌 AstrBot 妯″瀷鎻愪緵鍟嗭紝鎵ц椤哄簭鍥哄畾涓烘彃浠朵紭鍏堛€丄strBot 澶囩敤銆?
|
||||
- 绱犳潗璇嗗埆銆佽繘闃剁礌鏉愯瘑鍒€佸鍥剧敾椋庡叡璇嗐€佺粨鏋勫寲鏂囨湰璋冪敤鍜岀敓鎴愬悗瑙嗚瀹℃牳鍔犲叆鏁呴殰杞Щ锛涘墠缃彁渚涘晢澶辫触鏃惰嚜鍔ㄥ皾璇曞鐢紝骞朵繚鐣欏け璐ユ憳瑕併€?
|
||||
- 鐢熷浘鑺傜偣鏄庣‘鍙€夋嫨 ImageStudio 鐢熷浘閫傞厤鍣紱AstrBot 4.25 娌℃湁鍏紑鐢熷浘妗ユ帴鎺ュ彛锛屽洜姝ょ晫闈㈢鐢ㄤ笉鍙墽琛岀殑瀹夸富鐢熷浘閫夋嫨锛岄伩鍏嶄繚瀛樺悗杩愯澶辫触銆?
|
||||
- 杩涢樁鐢婚澶辫触鏍锋湰閲嶈瘯鏃堕噸鏂拌鍙栧綋鍓嶅弻婧愰厤缃紝骞跺悓姝ュ埛鏂扮埗瀵煎叆璺敱锛屼慨澶嶆棫 `material_vlm` 琚换鍔℃案涔呭喕缁撶殑闂銆?
|
||||
- 鎻愮ず璇嶈浆璇戙€佺敓鎴愬墠鍐呭瀹℃牳涓庣敓鎴愬悗鍥剧墖瀹℃牳鍚屾浣跨敤鍙岄€夋嫨鏍忥紱鏃у崟璺敱閰嶇疆淇濇寔鍏煎锛屽弻璺敱缁х画瀛樹负鍗曚釜 AstrBot 閰嶇疆瀛楃涓层€?
|
||||
- 淇杩愯鏃剁増鏈父閲忎笌鍙戝竷鍏冩暟鎹笉鍚屾鐨勯棶棰橈紝鐘舵€侀〉鍜屾彃浠跺厓鏁版嵁缁熶竴鏄剧ず 1.0.24銆?
|
||||
|
||||
## [1.0.23] - 2026-07-17
|
||||
|
||||
- 将内置素材分类的英文名称统一显示为中文,并覆盖进阶素材导入、素材操作和识别提示词设置下拉框。
|
||||
- 保留后端分类 ID 与原始名称,兼容现有素材、衣橱和工作流数据。
|
||||
- 灏嗗唴缃礌鏉愬垎绫荤殑鑻辨枃鍚嶇О缁熶竴鏄剧ず涓轰腑鏂囷紝骞惰鐩栬繘闃剁礌鏉愬鍏ャ€佺礌鏉愭搷浣滃拰璇嗗埆鎻愮ず璇嶈缃笅鎷夋銆?
|
||||
- 淇濈暀鍚庣鍒嗙被 ID 涓庡師濮嬪悕绉帮紝鍏煎鐜版湁绱犳潗銆佽。姗卞拰宸ヤ綔娴佹暟鎹€?
|
||||
|
||||
## [1.0.22] - 2026-07-17
|
||||
|
||||
- 进阶素材的“风格”分类新增 2~8 张样本组导入(推荐 3~6 张);每张图拥有独立任务、计时、错误与重试,并由 8 Worker 同时处理,不再串行共享超时。
|
||||
- 新增逐图识别屏障和多图交叉归纳:模型同时读取全部有效原图与逐图报告,区分核心共同画风、可变项、源内容污染、疑似离群样本和 1~3 张代表样本,并生成 compact / standard / detailed 三档画风胶囊。
|
||||
- 新增三路纯提示词迁移验证,使用完全不同的角色、场景和构图且不传源图;三项任务独立并发,单项失败可单独重试,调整后创建新共识版本并复用相同验证场景。
|
||||
- 新增 `advanced_style_sources`、`advanced_style_consensus_runs`、`advanced_style_validation_cases` 三表;父导入与 2~8 张源记录原子写入,验证图片继续隔离在 `storage://advanced_materials/style-validations`。
|
||||
- 前端仅在“风格”分类启用多图上传,支持粘贴、拖入、追加、移除、排序/主参考、失败重试、样本排除与恢复,并展示交叉归纳、代表/离群样本和三场景状态。
|
||||
- 封存后仍只产生一个高优先级 `advmat_`;快速角色使用统一文字胶囊,详细工作流冻结主参考与最多两张可信代表图,普通素材伪造 metadata 无法注入额外引用。
|
||||
- 备份脱敏、恢复、孤儿媒体、逐场景成本、素材统计、Worker 重启恢复、路由契约和深色主题同步覆盖新链路;付费验证任务重启后不会自动重复提交。
|
||||
- 杩涢樁绱犳潗鐨勨€滈鏍尖€濆垎绫绘柊澧?2锝? 寮犳牱鏈粍瀵煎叆锛堟帹鑽?3锝? 寮狅級锛涙瘡寮犲浘鎷ユ湁鐙珛浠诲姟銆佽鏃躲€侀敊璇笌閲嶈瘯锛屽苟鐢?8 Worker 鍚屾椂澶勭悊锛屼笉鍐嶄覆琛屽叡浜秴鏃躲€?
|
||||
- 鏂板閫愬浘璇嗗埆灞忛殰鍜屽鍥句氦鍙夊綊绾筹細妯″瀷鍚屾椂璇诲彇鍏ㄩ儴鏈夋晥鍘熷浘涓庨€愬浘鎶ュ憡锛屽尯鍒嗘牳蹇冨叡鍚岀敾椋庛€佸彲鍙橀」銆佹簮鍐呭姹℃煋銆佺枒浼肩缇ゆ牱鏈拰 1锝? 寮犱唬琛ㄦ牱鏈紝骞剁敓鎴?compact / standard / detailed 涓夋。鐢婚鑳跺泭銆?
|
||||
- 鏂板涓夎矾绾彁绀鸿瘝杩佺Щ楠岃瘉锛屼娇鐢ㄥ畬鍏ㄤ笉鍚岀殑瑙掕壊銆佸満鏅拰鏋勫浘涓斾笉浼犳簮鍥撅紱涓夐」浠诲姟鐙珛骞跺彂锛屽崟椤瑰け璐ュ彲鍗曠嫭閲嶈瘯锛岃皟鏁村悗鍒涘缓鏂板叡璇嗙増鏈苟澶嶇敤鐩稿悓楠岃瘉鍦烘櫙銆?
|
||||
- 鏂板 `advanced_style_sources`銆乣advanced_style_consensus_runs`銆乣advanced_style_validation_cases` 涓夎〃锛涚埗瀵煎叆涓?2锝? 寮犳簮璁板綍鍘熷瓙鍐欏叆锛岄獙璇佸浘鐗囩户缁殧绂诲湪 `storage://advanced_materials/style-validations`銆?
|
||||
- 鍓嶇浠呭湪鈥滈鏍尖€濆垎绫诲惎鐢ㄥ鍥句笂浼狅紝鏀寔绮樿创銆佹嫋鍏ャ€佽拷鍔犮€佺Щ闄ゃ€佹帓搴?涓诲弬鑰冦€佸け璐ラ噸璇曘€佹牱鏈帓闄や笌鎭㈠锛屽苟灞曠ず浜ゅ弶褰掔撼銆佷唬琛?绂荤兢鏍锋湰鍜屼笁鍦烘櫙鐘舵€併€?
|
||||
- 灏佸瓨鍚庝粛鍙骇鐢熶竴涓珮浼樺厛绾?`advmat_`锛涘揩閫熻鑹蹭娇鐢ㄧ粺涓€鏂囧瓧鑳跺泭锛岃缁嗗伐浣滄祦鍐荤粨涓诲弬鑰冧笌鏈€澶氫袱寮犲彲淇′唬琛ㄥ浘锛屾櫘閫氱礌鏉愪吉閫?metadata 鏃犳硶娉ㄥ叆棰濆寮曠敤銆?
|
||||
- 澶囦唤鑴辨晱銆佹仮澶嶃€佸鍎垮獟浣撱€侀€愬満鏅垚鏈€佺礌鏉愮粺璁°€乄orker 閲嶅惎鎭㈠銆佽矾鐢卞绾﹀拰娣辫壊涓婚鍚屾瑕嗙洊鏂伴摼璺紱浠樿垂楠岃瘉浠诲姟閲嶅惎鍚庝笉浼氳嚜鍔ㄩ噸澶嶆彁浜ゃ€?
|
||||
|
||||
## [1.0.21] - 2026-07-16
|
||||
|
||||
- 新增独立“进阶素材”入库线:源图经 Vision 识别后,只用提取出的文字提示词生成验证图;用户可并排判断还原度,不满意时追加描述进入下一轮,满意后才封存。
|
||||
- 新增 `advanced_material_imports`、`advanced_material_validation_attempts`、`advanced_materials` 三表与 `storage://advanced_materials` 独立文件根;验证图不进入普通图库、单图池或工作流候选池。
|
||||
- 进阶素材以服务端可信标记进入统一素材目录,快速角色和详细工作流优先使用;普通素材伪造 metadata 不会获得进阶优先级。
|
||||
- 验证生图接入恐暴/极端暴力前置禁止、成人内容白名单与 NSFW 路由、普通模型明确 NSFW 拒绝后的一次性回退,以及可保存的独立预算守卫。
|
||||
- 修复运行中取消后的迟到结果复活、快速重启任务永久卡住、失败/取消但已计费轮次漏算、脱敏备份写入 NOT NULL 失败和空 MIME 图片误报 PNG。
|
||||
- 新增进阶导入、三库切换、任务轮询、原图/验证图并排审核、调整重试、显式封存、深色主题和高优先级标记;模型分工新增进阶识别与验证生图两张卡。
|
||||
- 专项覆盖迁移幂等、仓储事务、普通/进阶隔离、无图生图输入、取消 CAS、安全路由、预算、重启恢复、备份、成本与前端上传契约。
|
||||
- 鏂板鐙珛鈥滆繘闃剁礌鏉愨€濆叆搴撶嚎锛氭簮鍥剧粡 Vision 璇嗗埆鍚庯紝鍙敤鎻愬彇鍑虹殑鏂囧瓧鎻愮ず璇嶇敓鎴愰獙璇佸浘锛涚敤鎴峰彲骞舵帓鍒ゆ柇杩樺師搴︼紝涓嶆弧鎰忔椂杩藉姞鎻忚堪杩涘叆涓嬩竴杞紝婊℃剰鍚庢墠灏佸瓨銆?
|
||||
- 鏂板 `advanced_material_imports`銆乣advanced_material_validation_attempts`銆乣advanced_materials` 涓夎〃涓?`storage://advanced_materials` 鐙珛鏂囦欢鏍癸紱楠岃瘉鍥句笉杩涘叆鏅€氬浘搴撱€佸崟鍥炬睜鎴栧伐浣滄祦鍊欓€夋睜銆?
|
||||
- 杩涢樁绱犳潗浠ユ湇鍔$鍙俊鏍囪杩涘叆缁熶竴绱犳潗鐩綍锛屽揩閫熻鑹插拰璇︾粏宸ヤ綔娴佷紭鍏堜娇鐢紱鏅€氱礌鏉愪吉閫?metadata 涓嶄細鑾峰緱杩涢樁浼樺厛绾с€?
|
||||
- 楠岃瘉鐢熷浘鎺ュ叆鎭愭毚/鏋佺鏆村姏鍓嶇疆绂佹銆佹垚浜哄唴瀹圭櫧鍚嶅崟涓?NSFW 璺敱銆佹櫘閫氭ā鍨嬫槑纭?NSFW 鎷掔粷鍚庣殑涓€娆℃€у洖閫€锛屼互鍙婂彲淇濆瓨鐨勭嫭绔嬮绠楀畧鍗€?
|
||||
- 淇杩愯涓彇娑堝悗鐨勮繜鍒扮粨鏋滃娲汇€佸揩閫熼噸鍚换鍔℃案涔呭崱浣忋€佸け璐?鍙栨秷浣嗗凡璁¤垂杞婕忕畻銆佽劚鏁忓浠藉啓鍏?NOT NULL 澶辫触鍜岀┖ MIME 鍥剧墖璇姤 PNG銆?
|
||||
- 鏂板杩涢樁瀵煎叆銆佷笁搴撳垏鎹€佷换鍔¤疆璇€佸師鍥?楠岃瘉鍥惧苟鎺掑鏍搞€佽皟鏁撮噸璇曘€佹樉寮忓皝瀛樸€佹繁鑹蹭富棰樺拰楂樹紭鍏堢骇鏍囪锛涙ā鍨嬪垎宸ユ柊澧炶繘闃惰瘑鍒笌楠岃瘉鐢熷浘涓ゅ紶鍗°€?
|
||||
- 涓撻」瑕嗙洊杩佺Щ骞傜瓑銆佷粨鍌ㄤ簨鍔°€佹櫘閫?杩涢樁闅旂銆佹棤鍥剧敓鍥捐緭鍏ャ€佸彇娑?CAS銆佸畨鍏ㄨ矾鐢便€侀绠椼€侀噸鍚仮澶嶃€佸浠姐€佹垚鏈笌鍓嶇涓婁紶濂戠害銆?
|
||||
|
||||
## [1.0.20] - 2026-07-15
|
||||
|
||||
- 发布总验收补齐两处跨版本接线:工作台唯一挂载生成式交叉审查对话框并真实调用 decide/regenerate/approve;档案卡入库移除客户端三段式写入,统一调用后端 `finalize-card` 幂等事务。
|
||||
- AstrBot 托管配置桥补齐视觉质检、兼容审核与生成式交叉审查的主/副/列表字段;保存、清空和重载均保留真实值,不再被旧运行时覆盖恢复。
|
||||
- 新增全新安装、1.0.8 原位升级、重复迁移、缺表/半迁移恢复、stale Worker、终态通知补发、宿主已加载顶层 `core` 包和插件初始化顺序回归。
|
||||
- 前端新增路由继承、锁状态、交叉审查接线与原子档案卡接线契约测试;生产构建继续输出 AstrBot 插件页与独立 Web 兼容产物。
|
||||
- 清除生产包中断连时可达的假生图、假角色、示例素材和预览模型;断连与空后端统一显示明确空状态,缺少图片的真实记录仅显示“未生成/无缩略图”。
|
||||
- README 与 INSTALL 更新 11 节点工作流、聊天命令、模型分工、无模型行为、Docker/NAS 覆盖和显式运行时 ZIP 白名单;发布包禁止包含 `.env*`、真实数据、测试、前端工程和缓存。
|
||||
- NAS 实机从 1.0.8 原位升级并重启 `astrbot-ops-pro`:AstrBot 成功加载 ImageStudio 1.0.20,SQLite 15 条迁移与关键轮次/档案卡/素材表通过检查,插件页面自动连接且未触发真实付费生图。
|
||||
- 鍙戝竷鎬婚獙鏀惰ˉ榻愪袱澶勮法鐗堟湰鎺ョ嚎锛氬伐浣滃彴鍞竴鎸傝浇鐢熸垚寮忎氦鍙夊鏌ュ璇濇骞剁湡瀹炶皟鐢?decide/regenerate/approve锛涙。妗堝崱鍏ュ簱绉婚櫎瀹㈡埛绔笁娈靛紡鍐欏叆锛岀粺涓€璋冪敤鍚庣 `finalize-card` 骞傜瓑浜嬪姟銆?
|
||||
- AstrBot 鎵樼閰嶇疆妗ヨˉ榻愯瑙夎川妫€銆佸吋瀹瑰鏍镐笌鐢熸垚寮忎氦鍙夊鏌ョ殑涓?鍓?鍒楄〃瀛楁锛涗繚瀛樸€佹竻绌哄拰閲嶈浇鍧囦繚鐣欑湡瀹炲€硷紝涓嶅啀琚棫杩愯鏃惰鐩栨仮澶嶃€?
|
||||
- 鏂板鍏ㄦ柊瀹夎銆?.0.8 鍘熶綅鍗囩骇銆侀噸澶嶈縼绉汇€佺己琛?鍗婅縼绉绘仮澶嶃€乻tale Worker銆佺粓鎬侀€氱煡琛ュ彂銆佸涓诲凡鍔犺浇椤跺眰 `core` 鍖呭拰鎻掍欢鍒濆鍖栭『搴忓洖褰掋€?
|
||||
- 鍓嶇鏂板璺敱缁ф壙銆侀攣鐘舵€併€佷氦鍙夊鏌ユ帴绾夸笌鍘熷瓙妗f鍗℃帴绾垮绾︽祴璇曪紱鐢熶骇鏋勫缓缁х画杈撳嚭 AstrBot 鎻掍欢椤典笌鐙珛 Web 鍏煎浜х墿銆?
|
||||
- 娓呴櫎鐢熶骇鍖呬腑鏂繛鏃跺彲杈剧殑鍋囩敓鍥俱€佸亣瑙掕壊銆佺ず渚嬬礌鏉愬拰棰勮妯″瀷锛涙柇杩炰笌绌哄悗绔粺涓€鏄剧ず鏄庣‘绌虹姸鎬侊紝缂哄皯鍥剧墖鐨勭湡瀹炶褰曚粎鏄剧ず鈥滄湭鐢熸垚/鏃犵缉鐣ュ浘鈥濄€?
|
||||
- README 涓?INSTALL 鏇存柊 11 鑺傜偣宸ヤ綔娴併€佽亰澶╁懡浠ゃ€佹ā鍨嬪垎宸ャ€佹棤妯″瀷琛屼负銆丏ocker/NAS 瑕嗙洊鍜屾樉寮忚繍琛屾椂 ZIP 鐧藉悕鍗曪紱鍙戝竷鍖呯姝㈠寘鍚?`.env*`銆佺湡瀹炴暟鎹€佹祴璇曘€佸墠绔伐绋嬪拰缂撳瓨銆?
|
||||
- NAS 瀹炴満浠?1.0.8 鍘熶綅鍗囩骇骞堕噸鍚?`astrbot-ops-pro`锛欰strBot 鎴愬姛鍔犺浇 ImageStudio 1.0.20锛孲QLite 15 鏉¤縼绉讳笌鍏抽敭杞/妗f鍗?绱犳潗琛ㄩ€氳繃妫€鏌ワ紝鎻掍欢椤甸潰鑷姩杩炴帴涓旀湭瑙﹀彂鐪熷疄浠樿垂鐢熷浘銆?
|
||||
|
||||
## [1.0.9] - 2026-07-15
|
||||
|
||||
- 在现有节点、任务、图片和历史链路之上增加稳定的生成轮次、候选与候选池聚合层。
|
||||
- 旧工作流图片通过只读 legacy round 展示,不搬文件、不改原有 `image_id`。
|
||||
- 新增 `TX-01`、`TX-01-03` 等持久化显示码,并记录模型来源、失败摘要与轮次快照。
|
||||
- `SingleFlowEngine` 支持按 workflow/branch/node/round/candidate 隔离输出目录;无 round 上下文时保持旧路径兼容。
|
||||
- 补齐数据库表元数据与 AstrBot/前端共享 round 接口;创建轮次仅规划候选,不会触发真实生图。
|
||||
- 鍦ㄧ幇鏈夎妭鐐广€佷换鍔°€佸浘鐗囧拰鍘嗗彶閾捐矾涔嬩笂澧炲姞绋冲畾鐨勭敓鎴愯疆娆°€佸€欓€変笌鍊欓€夋睜鑱氬悎灞傘€?
|
||||
- 鏃у伐浣滄祦鍥剧墖閫氳繃鍙 legacy round 灞曠ず锛屼笉鎼枃浠躲€佷笉鏀瑰師鏈?`image_id`銆?
|
||||
- 鏂板 `TX-01`銆乣TX-01-03` 绛夋寔涔呭寲鏄剧ず鐮侊紝骞惰褰曟ā鍨嬫潵婧愩€佸け璐ユ憳瑕佷笌杞蹇収銆?
|
||||
- `SingleFlowEngine` 鏀寔鎸?workflow/branch/node/round/candidate 闅旂杈撳嚭鐩綍锛涙棤 round 涓婁笅鏂囨椂淇濇寔鏃ц矾寰勫吋瀹广€?
|
||||
- 琛ラ綈鏁版嵁搴撹〃鍏冩暟鎹笌 AstrBot/鍓嶇鍏变韩 round 鎺ュ彛锛涘垱寤鸿疆娆′粎瑙勫垝鍊欓€夛紝涓嶄細瑙﹀彂鐪熷疄鐢熷浘銆?
|
||||
|
||||
## [1.0.10] - 2026-07-15
|
||||
|
||||
- 详细工作流每轮只执行一次提示词扩写、治理、路由、素材快照与成本检查,再拆分为 4–5 条独立 `count=1` 候选任务。
|
||||
- 启用 5 Worker 持久并发池;单候选失败或超时不影响同轮其他候选,轮次聚合支持完成、部分成功、全部失败和取消。
|
||||
- AstrBot 初始化自动启动 Worker、终止时停止;启动可恢复 stale `running/retrying` 任务,旧同步 `generate_node()` 保持兼容。
|
||||
- 异步任务拒绝持久化 data URL;模型路由只保存无敏感字段的快照,执行时重新解析并校验 provider/model 未漂移。
|
||||
- 璇︾粏宸ヤ綔娴佹瘡杞彧鎵ц涓€娆℃彁绀鸿瘝鎵╁啓銆佹不鐞嗐€佽矾鐢便€佺礌鏉愬揩鐓т笌鎴愭湰妫€鏌ワ紝鍐嶆媶鍒嗕负 4鈥? 鏉$嫭绔?`count=1` 鍊欓€変换鍔°€?
|
||||
- 鍚敤 5 Worker 鎸佷箙骞跺彂姹狅紱鍗曞€欓€夊け璐ユ垨瓒呮椂涓嶅奖鍝嶅悓杞叾浠栧€欓€夛紝杞鑱氬悎鏀寔瀹屾垚銆侀儴鍒嗘垚鍔熴€佸叏閮ㄥけ璐ュ拰鍙栨秷銆?
|
||||
- AstrBot 鍒濆鍖栬嚜鍔ㄥ惎鍔?Worker銆佺粓姝㈡椂鍋滄锛涘惎鍔ㄥ彲鎭㈠ stale `running/retrying` 浠诲姟锛屾棫鍚屾 `generate_node()` 淇濇寔鍏煎銆?
|
||||
- 寮傛浠诲姟鎷掔粷鎸佷箙鍖?data URL锛涙ā鍨嬭矾鐢卞彧淇濆瓨鏃犳晱鎰熷瓧娈电殑蹇収锛屾墽琛屾椂閲嶆柊瑙f瀽骞舵牎楠?provider/model 鏈紓绉汇€?
|
||||
|
||||
## [1.0.11] - 2026-07-15
|
||||
|
||||
- 详细角色候选的聚焦、平铺比较、喜欢/拒绝反馈与最终定稿改为四套独立状态;每轮最多保留 3 个喜欢候选,最终确认严格只能选择 1 个成功候选。
|
||||
- 新增 round feedback/confirm 接口;反馈持久化到候选池与轮次快照,刷新后可恢复,且不会误调用图片采用接口。
|
||||
- 最终确认在单事务内完成候选定稿、图片独占选择、节点状态、历史记录、分支阶段输入和后继节点推进;失败完整回滚,服务端拒绝客户端指定下一节点。
|
||||
- 工作台接入 4/5 张候选数量、当前轮/历史轮、节制轮询、部分成功/全失败、模型来源、单候选失败和入队提示;旧图片继续使用只读兼容轮次。
|
||||
- 璇︾粏瑙掕壊鍊欓€夌殑鑱氱劍銆佸钩閾烘瘮杈冦€佸枩娆?鎷掔粷鍙嶉涓庢渶缁堝畾绋挎敼涓哄洓濂楃嫭绔嬬姸鎬侊紱姣忚疆鏈€澶氫繚鐣?3 涓枩娆㈠€欓€夛紝鏈€缁堢‘璁や弗鏍煎彧鑳介€夋嫨 1 涓垚鍔熷€欓€夈€?
|
||||
- 鏂板 round feedback/confirm 鎺ュ彛锛涘弽棣堟寔涔呭寲鍒板€欓€夋睜涓庤疆娆″揩鐓э紝鍒锋柊鍚庡彲鎭㈠锛屼笖涓嶄細璇皟鐢ㄥ浘鐗囬噰鐢ㄦ帴鍙c€?
|
||||
- 鏈€缁堢‘璁ゅ湪鍗曚簨鍔″唴瀹屾垚鍊欓€夊畾绋裤€佸浘鐗囩嫭鍗犻€夋嫨銆佽妭鐐圭姸鎬併€佸巻鍙茶褰曘€佸垎鏀樁娈佃緭鍏ュ拰鍚庣户鑺傜偣鎺ㄨ繘锛涘け璐ュ畬鏁村洖婊氾紝鏈嶅姟绔嫆缁濆鎴风鎸囧畾涓嬩竴鑺傜偣銆?
|
||||
- 宸ヤ綔鍙版帴鍏?4/5 寮犲€欓€夋暟閲忋€佸綋鍓嶈疆/鍘嗗彶杞€佽妭鍒惰疆璇€侀儴鍒嗘垚鍔?鍏ㄥけ璐ャ€佹ā鍨嬫潵婧愩€佸崟鍊欓€夊け璐ュ拰鍏ラ槦鎻愮ず锛涙棫鍥剧墖缁х画浣跨敤鍙鍏煎杞銆?
|
||||
|
||||
## [1.0.12] - 2026-07-15
|
||||
|
||||
- 工作流对话框支持“1、2 喜欢,3 严格拒绝”等自然语言反馈;LLM 只接收持久展示码和受限候选提示词快照,服务端重新白名单映射,模型失败时安全回退到本地确定性解析。
|
||||
- 反馈持久化用户原文、摘要、喜欢/拒绝/严格拒绝、草稿定稿、素材意图与正负提示词补丁;下一轮记录父轮次并严格要求 1–3 个生成成功且喜欢的候选。
|
||||
- 下一轮读取父轮次、候选池和反馈的单一一致性快照,并在创建事务中校验反馈版本;并发反馈变化时拒绝写入,不产生混合或残留子轮次。
|
||||
- round 的创建、读取、反馈、下一轮和确认统一接入 profile → workflow → node 所有权链;越权使用资源不存在语义,同时保留 system 与全局管理员兼容。
|
||||
- 前端反馈发送不再依赖生图模型;点击“开始下一轮”会先保存未提交文本,保存失败不清空、不建轮次,并同步展示候选门槛与可操作原因。
|
||||
- 宸ヤ綔娴佸璇濇鏀寔鈥?銆? 鍠滄锛? 涓ユ牸鎷掔粷鈥濈瓑鑷劧璇█鍙嶉锛汱LM 鍙帴鏀舵寔涔呭睍绀虹爜鍜屽彈闄愬€欓€夋彁绀鸿瘝蹇収锛屾湇鍔$閲嶆柊鐧藉悕鍗曟槧灏勶紝妯″瀷澶辫触鏃跺畨鍏ㄥ洖閫€鍒版湰鍦扮‘瀹氭€цВ鏋愩€?
|
||||
- 鍙嶉鎸佷箙鍖栫敤鎴峰師鏂囥€佹憳瑕併€佸枩娆?鎷掔粷/涓ユ牸鎷掔粷銆佽崏绋垮畾绋裤€佺礌鏉愭剰鍥句笌姝h礋鎻愮ず璇嶈ˉ涓侊紱涓嬩竴杞褰曠埗杞骞朵弗鏍艰姹?1鈥? 涓敓鎴愭垚鍔熶笖鍠滄鐨勫€欓€夈€?
|
||||
- 涓嬩竴杞鍙栫埗杞銆佸€欓€夋睜鍜屽弽棣堢殑鍗曚竴涓€鑷存€у揩鐓э紝骞跺湪鍒涘缓浜嬪姟涓牎楠屽弽棣堢増鏈紱骞跺彂鍙嶉鍙樺寲鏃舵嫆缁濆啓鍏ワ紝涓嶄骇鐢熸贩鍚堟垨娈嬬暀瀛愯疆娆°€?
|
||||
- round 鐨勫垱寤恒€佽鍙栥€佸弽棣堛€佷笅涓€杞拰纭缁熶竴鎺ュ叆 profile 鈫?workflow 鈫?node 鎵€鏈夋潈閾撅紱瓒婃潈浣跨敤璧勬簮涓嶅瓨鍦ㄨ涔夛紝鍚屾椂淇濈暀 system 涓庡叏灞€绠$悊鍛樺吋瀹广€?
|
||||
- 鍓嶇鍙嶉鍙戦€佷笉鍐嶄緷璧栫敓鍥炬ā鍨嬶紱鐐瑰嚮鈥滃紑濮嬩笅涓€杞€濅細鍏堜繚瀛樻湭鎻愪氦鏂囨湰锛屼繚瀛樺け璐ヤ笉娓呯┖銆佷笉寤鸿疆娆★紝骞跺悓姝ュ睍绀哄€欓€夐棬妲涗笌鍙搷浣滃師鍥犮€?
|
||||
|
||||
## [1.0.13] - 2026-07-15
|
||||
|
||||
- 详细工作流的任意未封存图像节点可打开独立素材抽屉,复用现有上传、粘贴、视觉识别、确认与素材库筛选能力;抽屉保留 workflow、branch、node、round 返回上下文。
|
||||
- 节点绑定接口只持久化已确认的 `material_id` 和安全导航上下文;data URL 仅在上传请求内存阶段使用,不进入节点元数据、异步任务或历史记录。
|
||||
- 每轮生成冻结不可变 material/reference snapshot;后续修改素材、分类或当前节点绑定不会改变历史轮次,重新打开角色会从后端恢复完整绑定集合。
|
||||
- 写入统一校验资源 owner、当前分支、节点阶段与只读状态;锁定/封存节点明确提示创建分支。抽屉使用主题 token、安全背景单击关闭和移动端布局。
|
||||
- 璇︾粏宸ヤ綔娴佺殑浠绘剰鏈皝瀛樺浘鍍忚妭鐐瑰彲鎵撳紑鐙珛绱犳潗鎶藉眽锛屽鐢ㄧ幇鏈変笂浼犮€佺矘璐淬€佽瑙夎瘑鍒€佺‘璁や笌绱犳潗搴撶瓫閫夎兘鍔涳紱鎶藉眽淇濈暀 workflow銆乥ranch銆乶ode銆乺ound 杩斿洖涓婁笅鏂囥€?
|
||||
- 鑺傜偣缁戝畾鎺ュ彛鍙寔涔呭寲宸茬‘璁ょ殑 `material_id` 鍜屽畨鍏ㄥ鑸笂涓嬫枃锛沝ata URL 浠呭湪涓婁紶璇锋眰鍐呭瓨闃舵浣跨敤锛屼笉杩涘叆鑺傜偣鍏冩暟鎹€佸紓姝ヤ换鍔℃垨鍘嗗彶璁板綍銆?
|
||||
- 姣忚疆鐢熸垚鍐荤粨涓嶅彲鍙?material/reference snapshot锛涘悗缁慨鏀圭礌鏉愩€佸垎绫绘垨褰撳墠鑺傜偣缁戝畾涓嶄細鏀瑰彉鍘嗗彶杞锛岄噸鏂版墦寮€瑙掕壊浼氫粠鍚庣鎭㈠瀹屾暣缁戝畾闆嗗悎銆?
|
||||
- 鍐欏叆缁熶竴鏍¢獙璧勬簮 owner銆佸綋鍓嶅垎鏀€佽妭鐐归樁娈典笌鍙鐘舵€侊紱閿佸畾/灏佸瓨鑺傜偣鏄庣‘鎻愮ず鍒涘缓鍒嗘敮銆傛娊灞変娇鐢ㄤ富棰?token銆佸畨鍏ㄨ儗鏅崟鍑诲叧闂拰绉诲姩绔竷灞€銆?
|
||||
|
||||
## [1.0.14] - 2026-07-15
|
||||
|
||||
- 保留原有 VLM 视觉质检,并新增独立生成式交叉审核;审核候选强制来自不同的 image-generation provider/model,缺少配置时返回可操作的 `required_action`。
|
||||
- 审核池始终保留 01 主候选并标注适配器/模型;后续轮只重生用户勾选项,未勾选候选与槽位保持不变,所有 review/skip/approve 操作均写入历史。
|
||||
- 审核通过或跳过后,以幂等原子事务建立只读 XF 高清修复交接轮次、候选和素材快照,再推进工作流;注入失败会完整回滚,不留下半轮次或重复记录。
|
||||
- 审核决策、重生和通过接口统一接入 profile → workflow → node → round 的所有权链;前端审核弹窗使用暗色 token、安全背景单击关闭和窄屏布局。
|
||||
- 淇濈暀鍘熸湁 VLM 瑙嗚璐ㄦ锛屽苟鏂板鐙珛鐢熸垚寮忎氦鍙夊鏍革紱瀹℃牳鍊欓€夊己鍒舵潵鑷笉鍚岀殑 image-generation provider/model锛岀己灏戦厤缃椂杩斿洖鍙搷浣滅殑 `required_action`銆?
|
||||
- 瀹℃牳姹犲缁堜繚鐣?01 涓诲€欓€夊苟鏍囨敞閫傞厤鍣?妯″瀷锛涘悗缁疆鍙噸鐢熺敤鎴峰嬀閫夐」锛屾湭鍕鹃€夊€欓€変笌妲戒綅淇濇寔涓嶅彉锛屾墍鏈?review/skip/approve 鎿嶄綔鍧囧啓鍏ュ巻鍙层€?
|
||||
- 瀹℃牳閫氳繃鎴栬烦杩囧悗锛屼互骞傜瓑鍘熷瓙浜嬪姟寤虹珛鍙 XF 楂樻竻淇浜ゆ帴杞銆佸€欓€夊拰绱犳潗蹇収锛屽啀鎺ㄨ繘宸ヤ綔娴侊紱娉ㄥ叆澶辫触浼氬畬鏁村洖婊氾紝涓嶇暀涓嬪崐杞鎴栭噸澶嶈褰曘€?
|
||||
- 瀹℃牳鍐崇瓥銆侀噸鐢熷拰閫氳繃鎺ュ彛缁熶竴鎺ュ叆 profile 鈫?workflow 鈫?node 鈫?round 鐨勬墍鏈夋潈閾撅紱鍓嶇瀹℃牳寮圭獥浣跨敤鏆楄壊 token銆佸畨鍏ㄨ儗鏅崟鍑诲叧闂拰绐勫睆甯冨眬銆?
|
||||
|
||||
## [1.0.15] - 2026-07-15
|
||||
|
||||
- 在现有 `character_gradual` 工作流中补齐确认人设、拆解设定、预选素材、头像、上半身、下半身、全身、三视图、设定图、高清修复和档案卡共 11 个规范节点。
|
||||
- 保留旧节点 ID、图片与历史;`half_body / expression_sheet / pose_sheet / final_pack` 通过集中映射继续可读,旧工作流只惰性补充缺失的下半身节点。
|
||||
- 前后端提示词规划、素材绑定、依赖注入、模型分工和节点展示统一使用 canonical stage catalog。
|
||||
- 鍦ㄧ幇鏈?`character_gradual` 宸ヤ綔娴佷腑琛ラ綈纭浜鸿銆佹媶瑙h瀹氥€侀閫夌礌鏉愩€佸ご鍍忋€佷笂鍗婅韩銆佷笅鍗婅韩銆佸叏韬€佷笁瑙嗗浘銆佽瀹氬浘銆侀珮娓呬慨澶嶅拰妗f鍗″叡 11 涓鑼冭妭鐐广€?
|
||||
- 淇濈暀鏃ц妭鐐?ID銆佸浘鐗囦笌鍘嗗彶锛沗half_body / expression_sheet / pose_sheet / final_pack` 閫氳繃闆嗕腑鏄犲皠缁х画鍙锛屾棫宸ヤ綔娴佸彧鎯版€цˉ鍏呯己澶辩殑涓嬪崐韬妭鐐广€?
|
||||
- 鍓嶅悗绔彁绀鸿瘝瑙勫垝銆佺礌鏉愮粦瀹氥€佷緷璧栨敞鍏ャ€佹ā鍨嬪垎宸ュ拰鑺傜偣灞曠ず缁熶竴浣跨敤 canonical stage catalog銆?
|
||||
|
||||
## [1.0.16] - 2026-07-15
|
||||
|
||||
- 分支与物理节点副本改为单事务创建,校验父分支、自父、环、状态、切点和“仅已完成节点可分支”。
|
||||
- 增加多层祖先解析和 branch_state 隔离;依赖上下文明确标注继承来源分支与来源节点。
|
||||
- 工作台增加紧凑分支面板、父链/切点/状态展示和按需依赖上下文,保持三栏与移动端横向布局。
|
||||
- 鍒嗘敮涓庣墿鐞嗚妭鐐瑰壇鏈敼涓哄崟浜嬪姟鍒涘缓锛屾牎楠岀埗鍒嗘敮銆佽嚜鐖躲€佺幆銆佺姸鎬併€佸垏鐐瑰拰鈥滀粎宸插畬鎴愯妭鐐瑰彲鍒嗘敮鈥濄€?
|
||||
- 澧炲姞澶氬眰绁栧厛瑙f瀽鍜?branch_state 闅旂锛涗緷璧栦笂涓嬫枃鏄庣‘鏍囨敞缁ф壙鏉ユ簮鍒嗘敮涓庢潵婧愯妭鐐广€?
|
||||
- 宸ヤ綔鍙板鍔犵揣鍑戝垎鏀潰鏉裤€佺埗閾?鍒囩偣/鐘舵€佸睍绀哄拰鎸夐渶渚濊禆涓婁笅鏂囷紝淇濇寔涓夋爮涓庣Щ鍔ㄧ妯悜甯冨眬銆?
|
||||
|
||||
## [1.0.17] - 2026-07-15
|
||||
|
||||
- 档案卡封存改为单事务:校验活动分支与四类必填资产,同时写入卡、资产、头像、历史、档案卡节点并封存工作流。
|
||||
- 支持幂等、防跨分支串图、失败回滚,以及旧 `final_archive_*` 的只读档案卡视图。
|
||||
- 角色分类固定为未生成、快速角色、档案卡;详细工作流进度独立展示,三类列表边框、筛选和封存只读状态已接入。
|
||||
- 妗f鍗″皝瀛樻敼涓哄崟浜嬪姟锛氭牎楠屾椿鍔ㄥ垎鏀笌鍥涚被蹇呭~璧勪骇锛屽悓鏃跺啓鍏ュ崱銆佽祫浜с€佸ご鍍忋€佸巻鍙层€佹。妗堝崱鑺傜偣骞跺皝瀛樺伐浣滄祦銆?
|
||||
- 鏀寔骞傜瓑銆侀槻璺ㄥ垎鏀覆鍥俱€佸け璐ュ洖婊氾紝浠ュ強鏃?`final_archive_*` 鐨勫彧璇绘。妗堝崱瑙嗗浘銆?
|
||||
- 瑙掕壊鍒嗙被鍥哄畾涓烘湭鐢熸垚銆佸揩閫熻鑹层€佹。妗堝崱锛涜缁嗗伐浣滄祦杩涘害鐙珛灞曠ず锛屼笁绫诲垪琛ㄨ竟妗嗐€佺瓫閫夊拰灏佸瓨鍙鐘舵€佸凡鎺ュ叆銆?
|
||||
|
||||
## [1.0.18] - 2026-07-15
|
||||
|
||||
- `/影棚` 与 `/yp` 的帮助、状态、快速角色、轮次、候选、自然语言反馈、下一轮、严格单候选定稿、生成式交叉审查、素材、分支和档案卡命令逐项委托相同 canonical handler,与 Web 共用 progression/round/feedback/confirm 服务。
|
||||
- 快速角色聊天入口改为现有 `character_fast` 四图并行流;详细角色不再调用旧 select/adopt 捷径,活动分支和节点所有权由服务端校验,generation 节点无图不能空完成。
|
||||
- 长任务先返回入队回执;聊天 reply target 持久化到轮次,Worker 终态主动回传。重载后可恢复尚未确认的 scheduled 通知,已 delivered 的通知持久去重。
|
||||
- 单图任意白名单、快速/详细角色群聊与用户双白名单规则保持不变;知道资源 ID 也不能绕过 profile → workflow → node → round 所有权链。
|
||||
- 帮助与状态优先返回运行时生成的图片卡,渲染或平台能力不足时自动回退为文本,不会阻塞命令处理。
|
||||
- `/褰辨` 涓?`/yp` 鐨勫府鍔┿€佺姸鎬併€佸揩閫熻鑹层€佽疆娆°€佸€欓€夈€佽嚜鐒惰瑷€鍙嶉銆佷笅涓€杞€佷弗鏍煎崟鍊欓€夊畾绋裤€佺敓鎴愬紡浜ゅ弶瀹℃煡銆佺礌鏉愩€佸垎鏀拰妗f鍗″懡浠ら€愰」濮旀墭鐩稿悓 canonical handler锛屼笌 Web 鍏辩敤 progression/round/feedback/confirm 鏈嶅姟銆?
|
||||
- 蹇€熻鑹茶亰澶╁叆鍙f敼涓虹幇鏈?`character_fast` 鍥涘浘骞惰娴侊紱璇︾粏瑙掕壊涓嶅啀璋冪敤鏃?select/adopt 鎹峰緞锛屾椿鍔ㄥ垎鏀拰鑺傜偣鎵€鏈夋潈鐢辨湇鍔$鏍¢獙锛実eneration 鑺傜偣鏃犲浘涓嶈兘绌哄畬鎴愩€?
|
||||
- 闀夸换鍔″厛杩斿洖鍏ラ槦鍥炴墽锛涜亰澶?reply target 鎸佷箙鍖栧埌杞锛學orker 缁堟€佷富鍔ㄥ洖浼犮€傞噸杞藉悗鍙仮澶嶅皻鏈‘璁ょ殑 scheduled 閫氱煡锛屽凡 delivered 鐨勯€氱煡鎸佷箙鍘婚噸銆?
|
||||
- 鍗曞浘浠绘剰鐧藉悕鍗曘€佸揩閫?璇︾粏瑙掕壊缇よ亰涓庣敤鎴峰弻鐧藉悕鍗曡鍒欎繚鎸佷笉鍙橈紱鐭ラ亾璧勬簮 ID 涔熶笉鑳界粫杩?profile 鈫?workflow 鈫?node 鈫?round 鎵€鏈夋潈閾俱€?
|
||||
- 甯姪涓庣姸鎬佷紭鍏堣繑鍥炶繍琛屾椂鐢熸垚鐨勫浘鐗囧崱锛屾覆鏌撴垨骞冲彴鑳藉姏涓嶈冻鏃惰嚜鍔ㄥ洖閫€涓烘枃鏈紝涓嶄細闃诲鍛戒护澶勭悊銆?
|
||||
|
||||
## [1.0.19] - 2026-07-15
|
||||
|
||||
- 保留现有三栏工作台并抽出 `WorkflowComposer`;catalog、轮次、候选池、比较、确认、素材、分支与依赖面板继续使用单一组件实现,删除详细工作流对全局单图模型选择的耦合。
|
||||
- 工作流生图路由按“显式覆盖 → 父轮次 → 节点 → 模型分工 → 角色默认 → 系统默认”展示;首轮和下一轮仅在用户明确覆盖时发送 `model_route`,继承时请求体不包含该字段。
|
||||
- Composer 同时显示实际生图模型、继承来源与提示词规划 LLM;文本 LLM 优先使用 translation 治理路由,再回退到 prompt_planning 分工,并显示适配器/模型友好名。
|
||||
- 修正节点锁语义:生成完成但未最终采用的 `completed` 节点仍可反馈、创建下一轮和修改节点素材;仅 `selected`、未来节点及封存/归档工作流写锁。
|
||||
- 历史轮次默认显示最近三轮并可展开;终态历史不重复请求,事件只刷新当前页面和可见活动轮次。头像使用 cover,全身/三视图/设定图使用 contain。
|
||||
- 所有新增浮层使用主题 token 和安全背景单击关闭;窄屏 Composer、按钮布局、空状态、部分成功、错误与重试提示完成回归。
|
||||
- 淇濈暀鐜版湁涓夋爮宸ヤ綔鍙板苟鎶藉嚭 `WorkflowComposer`锛沜atalog銆佽疆娆°€佸€欓€夋睜銆佹瘮杈冦€佺‘璁ゃ€佺礌鏉愩€佸垎鏀笌渚濊禆闈㈡澘缁х画浣跨敤鍗曚竴缁勪欢瀹炵幇锛屽垹闄よ缁嗗伐浣滄祦瀵瑰叏灞€鍗曞浘妯″瀷閫夋嫨鐨勮€﹀悎銆?
|
||||
- 宸ヤ綔娴佺敓鍥捐矾鐢辨寜鈥滄樉寮忚鐩?鈫?鐖惰疆娆?鈫?鑺傜偣 鈫?妯″瀷鍒嗗伐 鈫?瑙掕壊榛樿 鈫?绯荤粺榛樿鈥濆睍绀猴紱棣栬疆鍜屼笅涓€杞粎鍦ㄧ敤鎴锋槑纭鐩栨椂鍙戦€?`model_route`锛岀户鎵挎椂璇锋眰浣撲笉鍖呭惈璇ュ瓧娈点€?
|
||||
- Composer 鍚屾椂鏄剧ず瀹為檯鐢熷浘妯″瀷銆佺户鎵挎潵婧愪笌鎻愮ず璇嶈鍒?LLM锛涙枃鏈?LLM 浼樺厛浣跨敤 translation 娌荤悊璺敱锛屽啀鍥為€€鍒?prompt_planning 鍒嗗伐锛屽苟鏄剧ず閫傞厤鍣?妯″瀷鍙嬪ソ鍚嶃€?
|
||||
- 淇鑺傜偣閿佽涔夛細鐢熸垚瀹屾垚浣嗘湭鏈€缁堥噰鐢ㄧ殑 `completed` 鑺傜偣浠嶅彲鍙嶉銆佸垱寤轰笅涓€杞拰淇敼鑺傜偣绱犳潗锛涗粎 `selected`銆佹湭鏉ヨ妭鐐瑰強灏佸瓨/褰掓。宸ヤ綔娴佸啓閿併€?
|
||||
- 鍘嗗彶杞榛樿鏄剧ず鏈€杩戜笁杞苟鍙睍寮€锛涚粓鎬佸巻鍙蹭笉閲嶅璇锋眰锛屼簨浠跺彧鍒锋柊褰撳墠椤甸潰鍜屽彲瑙佹椿鍔ㄨ疆娆°€傚ご鍍忎娇鐢?cover锛屽叏韬?涓夎鍥?璁惧畾鍥句娇鐢?contain銆?
|
||||
- 鎵€鏈夋柊澧炴诞灞備娇鐢ㄤ富棰?token 鍜屽畨鍏ㄨ儗鏅崟鍑诲叧闂紱绐勫睆 Composer銆佹寜閽竷灞€銆佺┖鐘舵€併€侀儴鍒嗘垚鍔熴€侀敊璇笌閲嶈瘯鎻愮ず瀹屾垚鍥炲綊銆?
|
||||
|
||||
## [1.0.8] - 2026-07-15
|
||||
|
||||
- 详细角色工作流支持逐节点解锁:锁定节点可查看,只有当前节点可操作。
|
||||
- 前后端增加防越级校验;生图节点必须采用图片后才能推进。
|
||||
- 提示词规划、素材绑定保存与确认分离,并兼容旧工作流数据。
|
||||
- 璇︾粏瑙掕壊宸ヤ綔娴佹敮鎸侀€愯妭鐐硅В閿侊細閿佸畾鑺傜偣鍙煡鐪嬶紝鍙湁褰撳墠鑺傜偣鍙搷浣溿€?
|
||||
- 鍓嶅悗绔鍔犻槻瓒婄骇鏍¢獙锛涚敓鍥捐妭鐐瑰繀椤婚噰鐢ㄥ浘鐗囧悗鎵嶈兘鎺ㄨ繘銆?
|
||||
- 鎻愮ず璇嶈鍒掋€佺礌鏉愮粦瀹氫繚瀛樹笌纭鍒嗙锛屽苟鍏煎鏃у伐浣滄祦鏁版嵁銆?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@
|
|||
"default": true
|
||||
},
|
||||
"model_material_recognition": {"description":"素材导入解析使用的 Vision 路由。","type":"string","default":"material_vlm"},
|
||||
"model_advanced_style_consensus": {"description":"\u8fdb\u9636\u753b\u98ce\u591a\u56fe\u4ea4\u53c9\u5f52\u7eb3\u4f7f\u7528\u7684 Vision \u8def\u7531\uff1b\u7559\u7a7a\u65f6\u6cbf\u7528\u8fdb\u9636\u7d20\u6750\u8bc6\u522b\u8def\u7531\u3002","type":"string","default":""},
|
||||
"model_advanced_material_recognition": {"description":"进阶素材导入与高保真特征提取使用的 Vision 路由。","type":"string","default":"material_vlm"},
|
||||
"model_advanced_material_validation_generation": {"description":"进阶素材还原度验证图使用的生图路由。留空时回退到默认生图路由。","type":"string","default":""},
|
||||
"advanced_material_budget_enabled": {"description":"启用进阶素材验证图预算守卫。","type":"bool","default":false},
|
||||
|
|
|
|||
|
|
@ -238,6 +238,15 @@ class AdvancedStyleValidationCase:
|
|||
completed_at: str | None
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
metadata = dict(self.metadata)
|
||||
applied = bool(metadata.get("reference_image_applied"))
|
||||
if "input_image_count" in metadata:
|
||||
try:
|
||||
input_image_count = int(metadata.get("input_image_count") or 0)
|
||||
except (TypeError, ValueError):
|
||||
input_image_count = 1 if applied else 0
|
||||
else:
|
||||
input_image_count = 1 if applied else (1 if metadata.get("validation_reference_enabled") and metadata.get("validation_reference_source_uri") else 0)
|
||||
return {
|
||||
"case_id": self.case_id,
|
||||
"attempt_id": self.attempt_id,
|
||||
|
|
@ -261,7 +270,8 @@ class AdvancedStyleValidationCase:
|
|||
"style_review": dict(self.style_review),
|
||||
"fidelity_score": self.fidelity_score,
|
||||
"error": dict(self.error),
|
||||
"metadata": dict(self.metadata),
|
||||
"metadata": metadata,
|
||||
"input_image_count": input_image_count,
|
||||
"created_at": self.created_at,
|
||||
"updated_at": self.updated_at,
|
||||
"completed_at": self.completed_at,
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ ROUTES: tuple[RouteSpec, ...] = (
|
|||
RouteSpec("DELETE", "jobs/{task_id}", "backend.routes.job_routes.delete_job", "retry"),
|
||||
RouteSpec("POST", "jobs/{task_id}/cancel", "backend.routes.job_routes.cancel_job", "write"),
|
||||
RouteSpec("POST", "jobs/{task_id}/retry", "backend.routes.job_routes.retry_job", "retry"),
|
||||
RouteSpec("POST", "jobs/failed/retry", "backend.routes.job_routes.retry_failed_jobs", "retry"),
|
||||
RouteSpec("POST", "jobs/failed/clear", "backend.routes.job_routes.clear_failed_jobs", "retry"),
|
||||
RouteSpec("POST", "jobs/terminal/clear", "backend.routes.job_routes.clear_terminal_jobs", "retry"),
|
||||
RouteSpec("POST", "jobs/dead-letter/retry", "backend.routes.job_routes.retry_dead_letter_jobs", "retry"),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""Job and queue route handlers."""
|
||||
"""Job and queue route handlers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
@ -105,18 +105,134 @@ def retry_job(
|
|||
require_task_retry(ctx)
|
||||
queue_service = _create_queue_service()
|
||||
task = queue_service.get_job(task_id)
|
||||
if task.metadata.get("source") == "advanced_material":
|
||||
require_permission(ctx, "can_manage_materials")
|
||||
from backend.services.advanced_material_service import create_advanced_material_service
|
||||
|
||||
import_id = str(task.metadata.get("advanced_material_import_id") or "").strip()
|
||||
return create_advanced_material_service().retry_import(import_id, ctx)
|
||||
resolved_retry_service = retry_service or _create_generation_job_retry_service()
|
||||
return resolved_retry_service.retry_job(task_id, ctx, overrides=payload or {}).to_dict()
|
||||
return _retry_task(task, ctx, payload=payload, retry_service=retry_service)
|
||||
|
||||
return handle_request(ctx, action)
|
||||
|
||||
|
||||
def retry_failed_jobs(
|
||||
ctx: RequestContext,
|
||||
payload: dict[str, Any] | None = None,
|
||||
) -> dict:
|
||||
params = payload or {}
|
||||
|
||||
def action() -> dict[str, Any]:
|
||||
require_task_retry(ctx)
|
||||
queue_service = _create_queue_service()
|
||||
limit = max(1, min(int_or_default(params.get("limit"), 100), 100))
|
||||
tasks = []
|
||||
seen_task_ids: set[str] = set()
|
||||
for status in ("failed", "dead_letter", "cancelled"):
|
||||
remaining = limit - len(tasks)
|
||||
if remaining <= 0:
|
||||
break
|
||||
for task in queue_service.list_jobs(status=status, page=1, page_size=remaining).items:
|
||||
if task.task_id not in seen_task_ids:
|
||||
seen_task_ids.add(task.task_id)
|
||||
tasks.append(task)
|
||||
|
||||
tasks = _latest_retryable_tasks(tasks)
|
||||
retried: list[dict[str, Any]] = []
|
||||
errors: list[dict[str, Any]] = []
|
||||
retry_service: GenerationJobRetryService | None = None
|
||||
for task in tasks:
|
||||
try:
|
||||
if task.metadata.get("source") != "advanced_material":
|
||||
retry_service = retry_service or _create_generation_job_retry_service()
|
||||
retried.append(_retry_task(task, ctx, retry_service=retry_service))
|
||||
except Exception as exc:
|
||||
errors.append(_retry_error_payload(task.task_id, exc))
|
||||
|
||||
return {
|
||||
"retried": retried,
|
||||
"errors": errors,
|
||||
"total": len(retried),
|
||||
"processed": len(retried) + len(errors),
|
||||
"limit": limit,
|
||||
"remaining_by_status": {
|
||||
status: queue_service.repository.count_by_status().get(status, 0)
|
||||
for status in ("failed", "dead_letter", "cancelled")
|
||||
},
|
||||
}
|
||||
|
||||
return handle_request(ctx, action)
|
||||
|
||||
|
||||
def _latest_retryable_tasks(tasks: list[Any]) -> list[Any]:
|
||||
selected: list[Any] = []
|
||||
lineage_indexes: dict[tuple[str, str], int] = {}
|
||||
for task in tasks:
|
||||
lineage_key = _retry_lineage_key(task)
|
||||
if lineage_key is None:
|
||||
selected.append(task)
|
||||
continue
|
||||
previous_index = lineage_indexes.get(lineage_key)
|
||||
if previous_index is None:
|
||||
lineage_indexes[lineage_key] = len(selected)
|
||||
selected.append(task)
|
||||
continue
|
||||
previous_task = selected[previous_index]
|
||||
if _task_sort_key(task) > _task_sort_key(previous_task):
|
||||
selected[previous_index] = task
|
||||
return selected
|
||||
|
||||
|
||||
def _retry_lineage_key(task: Any) -> tuple[str, str] | None:
|
||||
metadata = task.metadata if isinstance(getattr(task, "metadata", None), dict) else {}
|
||||
source_id = str(metadata.get("advanced_style_source_id") or "").strip()
|
||||
case_id = str(metadata.get("advanced_style_validation_case_id") or "").strip()
|
||||
if task.task_type == "advanced_style_source_recognition" and source_id:
|
||||
return ("source", source_id)
|
||||
if task.task_type == "advanced_style_validation_generation" and case_id:
|
||||
return ("validation", case_id)
|
||||
return None
|
||||
|
||||
|
||||
def _task_sort_key(task: Any) -> str:
|
||||
return str(getattr(task, "updated_at", "") or getattr(task, "created_at", "") or "")
|
||||
|
||||
|
||||
def _retry_task(
|
||||
task: Any,
|
||||
ctx: RequestContext,
|
||||
*,
|
||||
payload: dict[str, Any] | None = None,
|
||||
retry_service: GenerationJobRetryService | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if task.metadata.get("source") == "advanced_material":
|
||||
require_permission(ctx, "can_manage_materials")
|
||||
from backend.services.advanced_material_service import create_advanced_material_service
|
||||
|
||||
advanced_service = create_advanced_material_service()
|
||||
import_id = str(task.metadata.get("advanced_material_import_id") or "").strip()
|
||||
if task.task_type == "advanced_style_source_recognition":
|
||||
source_id = str(task.metadata.get("advanced_style_source_id") or "").strip()
|
||||
result = advanced_service.style_sets.retry_source(import_id, source_id, ctx)
|
||||
elif task.task_type == "advanced_style_validation_generation":
|
||||
case_id = str(task.metadata.get("advanced_style_validation_case_id") or "").strip()
|
||||
result = advanced_service.style_sets.retry_validation_case(import_id, case_id, ctx)
|
||||
else:
|
||||
result = advanced_service.retry_import(import_id, ctx)
|
||||
if isinstance(result, dict) and isinstance(result.get("task"), dict):
|
||||
return result["task"]
|
||||
return result
|
||||
resolved_retry_service = retry_service or _create_generation_job_retry_service()
|
||||
return resolved_retry_service.retry_job(task.task_id, ctx, overrides=payload or {}).to_dict()
|
||||
|
||||
|
||||
def _retry_error_payload(task_id: str, exc: Exception) -> dict[str, Any]:
|
||||
error_code = getattr(getattr(exc, "error_code", None), "value", None) or str(getattr(exc, "error_code", "retry_failed"))
|
||||
message = str(getattr(exc, "message", None) or str(exc))
|
||||
raw_details = getattr(exc, "details", None)
|
||||
details = dict(raw_details) if isinstance(raw_details, dict) else {}
|
||||
return {
|
||||
"task_id": task_id,
|
||||
"error_code": error_code,
|
||||
"message": message,
|
||||
**({"replacement_task_id": details["replacement_task_id"]} if details.get("replacement_task_id") else {}),
|
||||
}
|
||||
|
||||
|
||||
def retry_dead_letter_jobs(
|
||||
ctx: RequestContext,
|
||||
payload: dict[str, Any] | None = None,
|
||||
|
|
@ -199,3 +315,5 @@ def _create_generation_job_retry_service() -> GenerationJobRetryService:
|
|||
queue_service=generation_service.queue_service,
|
||||
generation_service=generation_service,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ from core.astrbot_provider_bridge import astrbot_structured_text_callable
|
|||
from core.identity import RequestContext
|
||||
from core.image_formats import detect_image_format
|
||||
from core.storage import VfsStorage
|
||||
from database.db_helper import Database, load_config_payload, load_database_settings
|
||||
from database.db_helper import Database, load_config_file_payload, load_config_payload, load_database_settings
|
||||
from database.repositories.advanced_material_repository import AdvancedMaterialRepository
|
||||
from database.repositories.job_repository import JobRepository
|
||||
from database.repositories.material_repository import MaterialRepository
|
||||
|
|
@ -1484,6 +1484,16 @@ class AdvancedMaterialService:
|
|||
or "material_vlm"
|
||||
).strip()
|
||||
|
||||
def _consensus_route(self) -> str:
|
||||
assignments = self.config.get("model_assignments") if isinstance(self.config.get("model_assignments"), dict) else {}
|
||||
return str(
|
||||
assignments.get("advanced_style_consensus")
|
||||
or assignments.get("advanced_material_recognition")
|
||||
or assignments.get("material_recognition")
|
||||
or self._recognition_route()
|
||||
or "material_vlm"
|
||||
).strip()
|
||||
|
||||
def _generation_route(self) -> str:
|
||||
assignments = self.config.get("model_assignments") if isinstance(self.config.get("model_assignments"), dict) else {}
|
||||
generation = self.config.get("generation") if isinstance(self.config.get("generation"), dict) else {}
|
||||
|
|
@ -1697,6 +1707,20 @@ def create_advanced_material_service() -> AdvancedMaterialService:
|
|||
database = Database(load_database_settings())
|
||||
audit = AuditService(database)
|
||||
config = load_config_payload()
|
||||
# AstrBot may expose a stale/blank runtime default for newly-added plugin
|
||||
# fields. The writable plugin-data config is the source of truth for this
|
||||
# dedicated route because the settings page persists it there.
|
||||
file_config = load_config_file_payload()
|
||||
file_assignments = file_config.get("model_assignments") if isinstance(file_config.get("model_assignments"), dict) else {}
|
||||
persisted_consensus_route = str(file_assignments.get("advanced_style_consensus") or "").strip()
|
||||
if persisted_consensus_route:
|
||||
config = {
|
||||
**config,
|
||||
"model_assignments": {
|
||||
**(config.get("model_assignments") if isinstance(config.get("model_assignments"), dict) else {}),
|
||||
"advanced_style_consensus": persisted_consensus_route,
|
||||
},
|
||||
}
|
||||
model_service = ModelProviderService(ModelProviderRepository(database))
|
||||
sync_generation_provider_from_config(model_service, config)
|
||||
sync_vision_provider_from_config(model_service, config)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class AdvancedMaterialWorkerRuntime:
|
|||
):
|
||||
self.service = service
|
||||
self.ctx = ctx or RequestContext.system("advanced-material-worker")
|
||||
recognition_concurrency = _recognition_concurrency(getattr(service, "config", {}))
|
||||
self.pool = QueueWorkerPool(
|
||||
service.queue_service,
|
||||
self._execute,
|
||||
|
|
@ -34,11 +35,11 @@ class AdvancedMaterialWorkerRuntime:
|
|||
retry_policy=RetryPolicy(max_attempts=1),
|
||||
task_filter=_is_advanced_material_task,
|
||||
terminal_callback=self._on_terminal,
|
||||
# A style set intentionally fans out one task per source image and
|
||||
# one task per validation scene. They must not share a route-wide
|
||||
# single-flight lock: every task has its own persisted timeout,
|
||||
# retry and terminal state.
|
||||
per_route_limit=worker_count,
|
||||
# Keep worker threads available for queue progress, but limit
|
||||
# simultaneous calls to the same vision route. Vision providers
|
||||
# and relay services commonly rate-limit image requests more
|
||||
# aggressively than ordinary text requests.
|
||||
per_route_limit=recognition_concurrency,
|
||||
)
|
||||
|
||||
def start(self) -> dict[str, Any]:
|
||||
|
|
@ -153,3 +154,14 @@ def _is_advanced_material_task(task: GenerationTask) -> bool:
|
|||
"advanced_style_consensus",
|
||||
"advanced_style_validation_generation",
|
||||
}
|
||||
|
||||
|
||||
|
||||
def _recognition_concurrency(config: dict[str, Any] | None) -> int:
|
||||
advanced_materials = config.get("advanced_materials") if isinstance(config, dict) else None
|
||||
if not isinstance(advanced_materials, dict):
|
||||
return 2
|
||||
try:
|
||||
return min(max(int(advanced_materials.get("recognition_concurrency", 2)), 1), 8)
|
||||
except (TypeError, ValueError):
|
||||
return 2
|
||||
|
|
|
|||
文件差异内容过多而无法显示
加载差异
|
|
@ -103,6 +103,7 @@ class SettingsService:
|
|||
"fields": [
|
||||
_field("material_recognition", "string", label="素材解析路由"),
|
||||
_field("advanced_material_recognition", "string", label="进阶素材识别路由"),
|
||||
_field("advanced_style_consensus", "string", label="进阶画风交叉归纳路由"),
|
||||
_field("advanced_material_validation_generation", "string", label="进阶素材验证生图路由"),
|
||||
_field("profile_parse", "string", label="角色导入解析路由"),
|
||||
_field("persona_split", "string", label="人设拆解路由"),
|
||||
|
|
|
|||
|
|
@ -2,16 +2,20 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import threading
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Any
|
||||
|
||||
from backend.dto.common import ApiError
|
||||
from backend.dto.job_dto import GenerationTask
|
||||
from backend.services.queue_service import QueueService
|
||||
from core.identity import RequestContext
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
WorkerHandler = Callable[[GenerationTask], "WorkerTaskUpdate | dict[str, Any] | None"]
|
||||
WorkerTaskFilter = Callable[[GenerationTask], bool]
|
||||
|
|
@ -161,7 +165,9 @@ class QueueWorker:
|
|||
with self._lock:
|
||||
if self.is_running():
|
||||
return {"worker_id": self.worker_id, "running": True, "already_running": True}
|
||||
self._stop_event.clear()
|
||||
# A previous thread may have died without clearing state. Always
|
||||
# rebuild a fresh stop event + thread so callers can revive workers.
|
||||
self._stop_event = threading.Event()
|
||||
self._thread = threading.Thread(
|
||||
target=self._run_loop,
|
||||
args=(ctx,),
|
||||
|
|
@ -184,7 +190,17 @@ class QueueWorker:
|
|||
|
||||
def _run_loop(self, ctx: RequestContext) -> None:
|
||||
while not self._stop_event.is_set():
|
||||
result = self.run_once(ctx)
|
||||
try:
|
||||
result = self.run_once(ctx)
|
||||
except Exception:
|
||||
# Provider/business failures must never kill the worker thread.
|
||||
# A dead thread permanently stalls claim of later queued tasks.
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s crashed while processing; continuing",
|
||||
self.worker_id,
|
||||
)
|
||||
self._stop_event.wait(self.interval_seconds)
|
||||
continue
|
||||
if result.status == "idle":
|
||||
self._stop_event.wait(self.interval_seconds)
|
||||
|
||||
|
|
@ -205,73 +221,147 @@ class QueueWorker:
|
|||
return None
|
||||
|
||||
def _handle_failure(self, task: GenerationTask, exc: Exception, ctx: RequestContext) -> WorkerRunResult:
|
||||
latest = self.queue_service.get_job(task.task_id)
|
||||
if latest.status == "cancelled":
|
||||
self._notify_terminal(task, latest, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="cancelled",
|
||||
task_id=latest.task_id,
|
||||
processed=1,
|
||||
error_message=latest.error_message,
|
||||
)
|
||||
"""Mark the claimed task failed without ever re-raising.
|
||||
|
||||
Queue progress is more important than perfect failure bookkeeping. Any
|
||||
secondary error while recording failure must leave the worker thread
|
||||
alive so later queued work can still be claimed.
|
||||
"""
|
||||
message = _safe_error_message(exc)
|
||||
attempt = _int(latest.metadata.get("worker_attempt"), _int(task.metadata.get("worker_attempt"), 1))
|
||||
failed = self.queue_service.update_task(
|
||||
task.task_id,
|
||||
{
|
||||
"status": "failed",
|
||||
"error_message": message,
|
||||
"metadata": {
|
||||
**task.metadata,
|
||||
"worker": {
|
||||
"worker_id": self.worker_id,
|
||||
"status": "failed",
|
||||
"error_type": type(exc).__name__,
|
||||
"failed_at": _now(),
|
||||
},
|
||||
},
|
||||
},
|
||||
ctx,
|
||||
latest = task
|
||||
try:
|
||||
latest = self.queue_service.get_job(task.task_id)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s could not reload task %s during failure handling",
|
||||
self.worker_id,
|
||||
task.task_id,
|
||||
)
|
||||
latest = task
|
||||
|
||||
try:
|
||||
if latest.status == "cancelled":
|
||||
self._notify_terminal(task, latest, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="cancelled",
|
||||
task_id=latest.task_id,
|
||||
processed=1,
|
||||
error_message=latest.error_message,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s failed while handling cancelled task %s",
|
||||
self.worker_id,
|
||||
task.task_id,
|
||||
)
|
||||
|
||||
attempt = _int(
|
||||
(latest.metadata or {}).get("worker_attempt"),
|
||||
_int((task.metadata or {}).get("worker_attempt"), 1),
|
||||
)
|
||||
if self.retry_policy.should_retry(attempt, exc):
|
||||
queued = self.queue_service.update_task(
|
||||
failed.task_id,
|
||||
base_metadata = dict(task.metadata or {})
|
||||
try:
|
||||
if isinstance(latest.metadata, dict):
|
||||
base_metadata = {**base_metadata, **latest.metadata}
|
||||
except Exception:
|
||||
base_metadata = dict(task.metadata or {})
|
||||
|
||||
failed = latest
|
||||
try:
|
||||
failed = self.queue_service.update_task(
|
||||
task.task_id,
|
||||
{
|
||||
"status": "queued",
|
||||
"progress": 0,
|
||||
"error_message": None,
|
||||
"status": "failed",
|
||||
"error_message": message,
|
||||
"metadata": {
|
||||
**failed.metadata,
|
||||
"retry": {
|
||||
"scheduled": True,
|
||||
"attempt": attempt,
|
||||
"max_attempts": max(int(self.retry_policy.max_attempts), 1),
|
||||
"next_retry_at": self.retry_policy.next_retry_at(attempt),
|
||||
"last_error": message,
|
||||
**base_metadata,
|
||||
"worker": {
|
||||
"worker_id": self.worker_id,
|
||||
"status": "failed",
|
||||
"error_type": type(exc).__name__,
|
||||
"failed_at": _now(),
|
||||
},
|
||||
},
|
||||
},
|
||||
ctx,
|
||||
)
|
||||
self._notify_terminal(task, queued, exc)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s could not mark task %s as failed",
|
||||
self.worker_id,
|
||||
task.task_id,
|
||||
)
|
||||
self._notify_terminal(task, latest, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="retry_scheduled",
|
||||
task_id=queued.task_id,
|
||||
status="failed",
|
||||
task_id=task.task_id,
|
||||
processed=1,
|
||||
failed=1,
|
||||
error_message=message,
|
||||
)
|
||||
|
||||
try:
|
||||
if self.retry_policy.should_retry(attempt, exc):
|
||||
try:
|
||||
queued = self.queue_service.update_task(
|
||||
failed.task_id,
|
||||
{
|
||||
"status": "queued",
|
||||
"progress": 0,
|
||||
"error_message": None,
|
||||
"metadata": {
|
||||
**(failed.metadata or {}),
|
||||
"retry": {
|
||||
"scheduled": True,
|
||||
"attempt": attempt,
|
||||
"max_attempts": max(int(self.retry_policy.max_attempts), 1),
|
||||
"next_retry_at": self.retry_policy.next_retry_at(attempt),
|
||||
"last_error": message,
|
||||
"error_type": type(exc).__name__,
|
||||
},
|
||||
},
|
||||
},
|
||||
ctx,
|
||||
)
|
||||
self._notify_terminal(task, queued, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="retry_scheduled",
|
||||
task_id=queued.task_id,
|
||||
processed=1,
|
||||
error_message=message,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s could not requeue task %s after failure",
|
||||
self.worker_id,
|
||||
task.task_id,
|
||||
)
|
||||
self._notify_terminal(task, failed, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="failed",
|
||||
task_id=failed.task_id,
|
||||
processed=1,
|
||||
failed=1,
|
||||
error_message=failed.error_message or message,
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"ImageStudio queue worker %s hit a secondary error after failing task %s",
|
||||
self.worker_id,
|
||||
task.task_id,
|
||||
)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="failed",
|
||||
task_id=task.task_id,
|
||||
processed=1,
|
||||
failed=1,
|
||||
error_message=message,
|
||||
)
|
||||
self._notify_terminal(task, failed, exc)
|
||||
return WorkerRunResult(
|
||||
worker_id=self.worker_id,
|
||||
status="failed",
|
||||
task_id=failed.task_id,
|
||||
processed=1,
|
||||
failed=1,
|
||||
error_message=failed.error_message,
|
||||
)
|
||||
|
||||
def _notify_terminal(
|
||||
self,
|
||||
|
|
@ -422,6 +512,24 @@ def _optional_text(value: Any) -> str | None:
|
|||
|
||||
|
||||
def _safe_error_message(exc: Exception) -> str:
|
||||
if isinstance(exc, ApiError):
|
||||
code = exc.error_code.value if hasattr(exc.error_code, "value") else str(exc.error_code)
|
||||
parts = [str(exc.message or "").strip(), f"[{code}]"]
|
||||
if isinstance(exc.details, dict) and exc.details:
|
||||
# Keep a short, single-line hint without dumping full provider payloads.
|
||||
hint_keys = ("reason", "finish_reason", "provider", "model")
|
||||
hints = []
|
||||
for key in hint_keys:
|
||||
value = exc.details.get(key)
|
||||
if value is None:
|
||||
continue
|
||||
text_value = " ".join(str(value).split())
|
||||
if text_value:
|
||||
hints.append(f"{key}={text_value[:80]}")
|
||||
if hints:
|
||||
parts.append("(" + ", ".join(hints) + ")")
|
||||
text = " ".join(part for part in parts if part)
|
||||
return text[:500] if text else f"ApiError [{code}]"
|
||||
text = " ".join(str(exc or type(exc).__name__).split())
|
||||
return text[:500] if text else type(exc).__name__
|
||||
|
||||
|
|
|
|||
38
config.yaml
38
config.yaml
|
|
@ -1,7 +1,7 @@
|
|||
plugin:
|
||||
name: astrbot_plugin_imagestudio
|
||||
display_name: ImageStudio
|
||||
version: 1.0.32
|
||||
version: 1.0.66
|
||||
|
||||
features:
|
||||
quick_profile: true
|
||||
|
|
@ -12,7 +12,7 @@ features:
|
|||
private_companion_integration: false
|
||||
|
||||
generation:
|
||||
# default_model 是 ImageStudio 路由名;route_name 留空时复用它。
|
||||
# default_model 鏄?ImageStudio 璺敱鍚嶏紱route_name 鐣欑┖鏃跺鐢ㄥ畠銆?
|
||||
default_model: ""
|
||||
provider:
|
||||
provider_id: imagestudio_default
|
||||
|
|
@ -27,9 +27,9 @@ generation:
|
|||
enabled: true
|
||||
|
||||
vision:
|
||||
# 素材识别路由;provider 中留空的连接字段会复用 generation.provider。
|
||||
# 若地址、密钥或超时不同且 provider_id 留空,会自动派生独立 Vision provider ID,避免覆盖生图配置。
|
||||
# Vision 模型必须单独填写,不能假定生图模型具备视觉理解能力。
|
||||
# 绱犳潗璇嗗埆璺敱锛沺rovider 涓暀绌虹殑杩炴帴瀛楁浼氬鐢?generation.provider銆?
|
||||
# 鑻ュ湴鍧€銆佸瘑閽ユ垨瓒呮椂涓嶅悓涓?provider_id 鐣欑┖锛屼細鑷姩娲剧敓鐙珛 Vision provider ID锛岄伩鍏嶈鐩栫敓鍥鹃厤缃€?
|
||||
# Vision 妯″瀷蹇呴』鍗曠嫭濉啓锛屼笉鑳藉亣瀹氱敓鍥炬ā鍨嬪叿澶囪瑙夌悊瑙h兘鍔涖€?
|
||||
default_route: material_vlm
|
||||
provider:
|
||||
provider_id: ""
|
||||
|
|
@ -43,10 +43,12 @@ vision:
|
|||
priority: 10
|
||||
enabled: true
|
||||
|
||||
# 按功能分配模型路由。留空时回退到 generation.default_model 或 vision.default_route。
|
||||
# 鎸夊姛鑳藉垎閰嶆ā鍨嬭矾鐢便€傜暀绌烘椂鍥為€€鍒?generation.default_model 鎴?vision.default_route銆?
|
||||
model_assignments:
|
||||
material_recognition: material_vlm
|
||||
advanced_material_recognition: material_vlm
|
||||
# 留空时沿用进阶素材识别路由;填写后仅多图画风交叉归纳使用该视觉路由。
|
||||
advanced_style_consensus: ""
|
||||
advanced_material_validation_generation: ""
|
||||
profile_parse: ""
|
||||
persona_split: ""
|
||||
|
|
@ -70,12 +72,13 @@ model_assignments:
|
|||
|
||||
recognition_prompts:
|
||||
default_instruction: >-
|
||||
请先判断图片中素材的准确分类,再尽可能完整地提取所有可见事实,包括物品类型、主色与辅色、材质、纹理、结构、轮廓、图案、裁剪、缝线、褶皱、装饰、配件、状态、视角、光照及可复用的设计特征。不要把无法确认的推测写成事实,并明确区分确定信息与低置信度判断。根据识别结果生成一段细节充分、可直接用于生图且能够保留原素材设计的正向提示词,同时生成用于排除错误类别、错误材质、结构畸变、文字、水印和无关背景的负向提示词。仅返回 JSON,字段必须包含 prompt、negative_prompt、tags、confidence、description;tags 应简短、可检索,并包含分类、颜色、材质和关键设计元素。
|
||||
璇峰厛鍒ゆ柇鍥剧墖涓礌鏉愮殑鍑嗙‘鍒嗙被锛屽啀灏藉彲鑳藉畬鏁村湴鎻愬彇鎵€鏈夊彲瑙佷簨瀹烇紝鍖呮嫭鐗╁搧绫诲瀷銆佷富鑹蹭笌杈呰壊銆佹潗璐ㄣ€佺汗鐞嗐€佺粨鏋勩€佽疆寤撱€佸浘妗堛€佽鍓€佺紳绾裤€佽ざ鐨便€佽楗般€侀厤浠躲€佺姸鎬併€佽瑙掋€佸厜鐓у強鍙鐢ㄧ殑璁捐鐗瑰緛銆備笉瑕佹妸鏃犳硶纭鐨勬帹娴嬪啓鎴愪簨瀹烇紝骞舵槑纭尯鍒嗙‘瀹氫俊鎭笌浣庣疆淇″害鍒ゆ柇銆傛牴鎹瘑鍒粨鏋滅敓鎴愪竴娈电粏鑺傚厖鍒嗐€佸彲鐩存帴鐢ㄤ簬鐢熷浘涓旇兘澶熶繚鐣欏師绱犳潗璁捐鐨勬鍚戞彁绀鸿瘝锛屽悓鏃剁敓鎴愮敤浜庢帓闄ら敊璇被鍒€侀敊璇潗璐ㄣ€佺粨鏋勭暩鍙樸€佹枃瀛椼€佹按鍗板拰鏃犲叧鑳屾櫙鐨勮礋鍚戞彁绀鸿瘝銆備粎杩斿洖 JSON锛屽瓧娈靛繀椤诲寘鍚?prompt銆乶egative_prompt銆乼ags銆乧onfidence銆乨escription锛泃ags 搴旂畝鐭€佸彲妫€绱紝骞跺寘鍚垎绫汇€侀鑹层€佹潗璐ㄥ拰鍏抽敭璁捐鍏冪礌銆?
|
||||
category_requirements: []
|
||||
|
||||
# 进阶素材验证图的独立预算守卫。开启后,每次验证(含自动 NSFW
|
||||
# 回退)都会在调用提供方前检查时间窗口内的任务、图片和估算费用。
|
||||
# 杩涢樁绱犳潗楠岃瘉鍥剧殑鐙珛棰勭畻瀹堝崼銆傚紑鍚悗锛屾瘡娆¢獙璇侊紙鍚嚜鍔?NSFW
|
||||
# 鍥為€€锛夐兘浼氬湪璋冪敤鎻愪緵鏂瑰墠妫€鏌ユ椂闂寸獥鍙e唴鐨勪换鍔°€佸浘鐗囧拰浼扮畻璐圭敤銆?
|
||||
advanced_materials:
|
||||
recognition_concurrency: 2
|
||||
cost_budget:
|
||||
enabled: false
|
||||
days: 30
|
||||
|
|
@ -87,8 +90,8 @@ advanced_materials:
|
|||
per_image: 0
|
||||
per_1k_tokens: 0
|
||||
|
||||
# 提示词转译、内容审核和普通/NSFW 模型动态分流。
|
||||
# 默认只启用本地规则审核;LLM 转译与成人自动分流必须由管理员明确开启。
|
||||
# 鎻愮ず璇嶈浆璇戙€佸唴瀹瑰鏍稿拰鏅€?NSFW 妯″瀷鍔ㄦ€佸垎娴併€?
|
||||
# 榛樿鍙惎鐢ㄦ湰鍦拌鍒欏鏍革紱LLM 杞瘧涓庢垚浜鸿嚜鍔ㄥ垎娴佸繀椤荤敱绠$悊鍛樻槑纭紑鍚€?
|
||||
prompt_governance:
|
||||
translation:
|
||||
enabled: false
|
||||
|
|
@ -136,8 +139,8 @@ chat_access:
|
|||
allow_4k: false
|
||||
|
||||
storage:
|
||||
# 这里使用逻辑 data/... 路径;AstrBot 运行时映射到
|
||||
# data/plugin_data/astrbot_plugin_imagestudio/...,本地开发仍映射到仓库 data/。
|
||||
# 杩欓噷浣跨敤閫昏緫 data/... 璺緞锛汚strBot 杩愯鏃舵槧灏勫埌
|
||||
# data/plugin_data/astrbot_plugin_imagestudio/...锛屾湰鍦板紑鍙戜粛鏄犲皠鍒颁粨搴?data/銆?
|
||||
db_path: data/db/imagestudio.db
|
||||
images_path: data/images
|
||||
thumbnails_path: data/thumbnails
|
||||
|
|
@ -148,9 +151,9 @@ storage:
|
|||
temp_path: data/temp
|
||||
|
||||
database:
|
||||
# auto: 默认使用 SQLite;配置并启用 PostgreSQL 后自动切换
|
||||
# sqlite: 强制使用本地 SQLite
|
||||
# postgresql: 强制使用 PostgreSQL,驱动或连接配置缺失时会直接报错
|
||||
# auto: 榛樿浣跨敤 SQLite锛涢厤缃苟鍚敤 PostgreSQL 鍚庤嚜鍔ㄥ垏鎹?
|
||||
# sqlite: 寮哄埗浣跨敤鏈湴 SQLite
|
||||
# postgresql: 寮哄埗浣跨敤 PostgreSQL锛岄┍鍔ㄦ垨杩炴帴閰嶇疆缂哄け鏃朵細鐩存帴鎶ラ敊
|
||||
backend: auto
|
||||
sqlite:
|
||||
path: data/db/imagestudio.db
|
||||
|
|
@ -167,3 +170,6 @@ security:
|
|||
integration_token_set: false
|
||||
allowed_integration_plugins:
|
||||
- astrbot_plugin_private_companion
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from core.runtime_paths import resolve_config_path
|
|||
from database.db_helper import load_config_payload
|
||||
|
||||
|
||||
PLUGIN_VERSION = "1.0.32"
|
||||
PLUGIN_VERSION = "1.0.66"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
@ -87,3 +87,6 @@ class ConfigService:
|
|||
|
||||
def _resolve_path(path: str | Path) -> Path:
|
||||
return resolve_config_path(path)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
> 更新时间:2026-07-18(Asia/Shanghai)
|
||||
> 当前工作区:`C:\Users\Administrator\Documents\AstrBot ImageStudio`
|
||||
> 当前开发版本:`1.0.32`
|
||||
> 1.0.32 代码快照提交:`937ee73`
|
||||
> 目标读者:迁移后的新 Codex 账号、新工作区维护者、后续开发者
|
||||
> 文档目的:只读取本文件即可恢复当前开发背景、代码状态、实机环境、最新问题和下一步修复任务。
|
||||
|
||||
|
|
@ -10,9 +11,19 @@
|
|||
|
||||
## 0. 必须首先阅读的迁移警告
|
||||
|
||||
当前 Forgejo 远端、远端分支和 Git 提交历史只到 **v1.0.20**。
|
||||
Forgejo 的 `main` 分支和正式标签仍停在 **v1.0.20**,但完整的 1.0.21~1.0.32 开发成果已经提交并推送到:
|
||||
|
||||
本地工作区中从 **1.0.21 到 1.0.32** 的大量核心代码尚未提交,其中很多文件仍是 `??` 未跟踪状态,包括:
|
||||
```text
|
||||
origin/codex/ui-navigation-s130-s145
|
||||
```
|
||||
|
||||
1.0.32 代码快照提交为:
|
||||
|
||||
```text
|
||||
937ee73 release: complete ImageStudio 1.0.32 advanced material workflows
|
||||
```
|
||||
|
||||
该提交已经包含:
|
||||
|
||||
- 进阶素材主服务;
|
||||
- 多图片画风工作流;
|
||||
|
|
@ -23,21 +34,26 @@
|
|||
- 1.0.21~1.0.31 发布包;
|
||||
- 1.0.32 最新算法修改。
|
||||
|
||||
因此迁移时:
|
||||
因此迁移时可以直接从 Forgejo 恢复,但必须切换到正确分支:
|
||||
|
||||
1. **不能只在新地址重新 `git clone` Forgejo 仓库。**
|
||||
2. **不能执行 `git reset --hard`、`git clean -fdx` 或删除所有未跟踪文件。**
|
||||
3. 必须复制当前项目完整目录,包括 `.git`、未跟踪文件和当前工作树。
|
||||
4. 迁移完成后先执行 `git status --short --branch`,确认下面列出的修改与未跟踪文件仍存在。
|
||||
5. 在完成备份、审查和提交前,不要把远端 v1.0.20 当作当前源码真相。
|
||||
1. 可以重新 `git clone` Forgejo 仓库。
|
||||
2. 克隆后必须执行 `git checkout codex/ui-navigation-s130-s145`。
|
||||
3. 必须确认 HEAD 至少包含提交 `937ee73`。
|
||||
4. 不要直接停留在 `main`,否则只会得到 v1.0.20。
|
||||
5. `.tmp` 中的视觉审计副本没有推送,但它不是源码真相;真实测试图片和数据库仍在 NAS `plugin_data`。
|
||||
|
||||
最安全的迁移方式是复制整个目录:
|
||||
推荐恢复命令:
|
||||
|
||||
```text
|
||||
C:\Users\Administrator\Documents\AstrBot ImageStudio
|
||||
```powershell
|
||||
git clone ssh://git@forgejo-nas:18086/YokiiroBW/astrbot_plugin_imagestudio.git
|
||||
cd astrbot_plugin_imagestudio
|
||||
git checkout codex/ui-navigation-s130-s145
|
||||
git pull --ff-only
|
||||
git status --short --branch
|
||||
git log -3 --oneline --decorate
|
||||
```
|
||||
|
||||
包括隐藏的 `.git` 目录。复制完成后再切换 Codex 账号或更改项目地址。
|
||||
也可以复制整个本地项目目录(包括 `.git`),但现在已经不再是唯一安全方式。
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -47,8 +63,8 @@ C:\Users\Administrator\Documents\AstrBot ImageStudio
|
|||
|
||||
- 当前分支:`codex/ui-navigation-s130-s145`
|
||||
- 跟踪分支:`origin/codex/ui-navigation-s130-s145`
|
||||
- 当前 HEAD:`176ee24`
|
||||
- 当前 HEAD 标签:`v1.0.20`
|
||||
- 1.0.32 代码快照:`937ee73`
|
||||
- 当前 HEAD 可能在其后包含仅交接文档同步的提交
|
||||
- `origin/main` 也位于 `176ee24`
|
||||
- Forgejo 远端:
|
||||
|
||||
|
|
@ -59,6 +75,7 @@ ssh://git@forgejo-nas:18086/YokiiroBW/astrbot_plugin_imagestudio.git
|
|||
### 1.2 最近提交
|
||||
|
||||
```text
|
||||
937ee73 release: complete ImageStudio 1.0.32 advanced material workflows
|
||||
176ee24 release: add ImageStudio 1.0.20 install package
|
||||
7cfa01b docs: record ImageStudio 1.0.20 deployment verification
|
||||
2212800 merge: synchronize Forgejo main before 1.0.20
|
||||
|
|
@ -69,14 +86,14 @@ b5dd6c5 release: publish ImageStudio 1.0.8
|
|||
### 1.3 重要结论
|
||||
|
||||
- 当前本地代码版本是 `1.0.32`。
|
||||
- Git 历史仍停留在 `1.0.20`。
|
||||
- 1.0.21~1.0.32 尚未 commit/push。
|
||||
- 本轮没有执行 Git 暂存、提交、推送或发布。
|
||||
- 后续必须先审查并保存当前脏工作树,再决定如何整理提交历史。
|
||||
- 1.0.21~1.0.32 已提交到 `937ee73`。
|
||||
- `codex/ui-navigation-s130-s145` 已推送并与远端同步。
|
||||
- 提交后的工作树干净。
|
||||
- `main` 尚未合并,v1.0.32 尚未建立正式 tag/release。
|
||||
|
||||
### 1.4 当前主要修改文件
|
||||
### 1.4 1.0.32 提交的主要修改范围
|
||||
|
||||
已有文件的修改包括但不限于:
|
||||
提交中包含但不限于:
|
||||
|
||||
- `CHANGELOG.md`
|
||||
- `_conf_schema.json`
|
||||
|
|
@ -93,9 +110,9 @@ b5dd6c5 release: publish ImageStudio 1.0.8
|
|||
- `pages/imagestudio/` 和 `web/` 的构建产物
|
||||
- AstrBot provider bridge 相关测试
|
||||
|
||||
### 1.5 当前关键未跟踪文件
|
||||
### 1.5 已纳入版本控制的关键新增文件
|
||||
|
||||
这些文件绝对不能在迁移时丢失:
|
||||
这些文件已经包含在 `937ee73` 中,切换到正确分支后应当存在:
|
||||
|
||||
```text
|
||||
backend/dto/advanced_material_dto.py
|
||||
|
|
@ -124,7 +141,7 @@ tests/test_material_catalog_resolver.py
|
|||
tests/test_model_route_chain.py
|
||||
```
|
||||
|
||||
发布包 `release/astrbot_plugin_imagestudio-1.0.21.zip` 至 `1.0.31.zip` 也仍是未跟踪文件。
|
||||
发布包 `release/astrbot_plugin_imagestudio-1.0.21.zip` 至 `1.0.31.zip` 已包含在 `937ee73` 中。
|
||||
|
||||
目前没有正式生成 `release/astrbot_plugin_imagestudio-1.0.32.zip`;1.0.32 是通过临时 tar 包直接部署到 NAS,NAS 临时包已删除。
|
||||
|
||||
|
|
@ -142,7 +159,7 @@ frontend/package.json: version = 1.0.32
|
|||
frontend/package-lock.json: version = 1.0.32
|
||||
```
|
||||
|
||||
`CHANGELOG.md` 已新增 1.0.21~1.0.32 的开发记录,但这些记录仍未提交到 Git。
|
||||
`CHANGELOG.md` 已新增并提交 1.0.21~1.0.32 的开发记录。
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -235,15 +252,22 @@ C:\Program Files\Git\usr\bin\ssh.exe
|
|||
|
||||
### 3.4 当前实机状态
|
||||
|
||||
- 实际插件目录版本:`1.0.32`
|
||||
- 实际插件目录版本:`1.0.33`
|
||||
- 日志确认:
|
||||
|
||||
```text
|
||||
Plugin astrbot_plugin_imagestudio (1.0.32) by YokiiroBW
|
||||
Plugin astrbot_plugin_imagestudio (1.0.33) by YokiiroBW
|
||||
```
|
||||
|
||||
- AstrBot 主页面返回 HTTP 200。
|
||||
- 插件 Web 路径直接无认证访问会返回 `Missing API key`,这是正常鉴权行为。
|
||||
- 插件数据库文件仍存在,启动日志未出现导入失败、`no such table` 或 Traceback。
|
||||
- 1.0.32 部署前备份:
|
||||
|
||||
```text
|
||||
/volume2/Dockers/qqbot/astrbot-ops-pro/data/plugin_backups/astrbot_plugin_imagestudio-1.0.32-pre-1.0.33-20260719-202040
|
||||
```
|
||||
|
||||
- 本轮部署没有触发真实生图。
|
||||
|
||||
### 3.5 Docker Health 已知问题
|
||||
|
|
@ -1046,26 +1070,22 @@ tests/test_model_route_chain.py
|
|||
```text
|
||||
请先完整读取 docs/project-migration-handoff-2026-07-18.md。
|
||||
|
||||
这是 AstrBot ImageStudio 的当前开发交接文档。当前工作树从远端 v1.0.20
|
||||
继续开发到了本地 1.0.32,但 1.0.21~1.0.32 仍有大量未提交和未跟踪文件。
|
||||
禁止 git reset --hard、git clean 或用远端重新覆盖本地。
|
||||
这是 AstrBot ImageStudio 的当前开发交接文档。1.0.33 后端算法修复已经提交并推送到
|
||||
origin/codex/ui-navigation-s130-s145,代码提交为 a828f02,并已部署到 NAS 的 astrbot-ops-pro。
|
||||
main 仍停留在 v1.0.20,因此克隆后必须切换到 codex/ui-navigation-s130-s145,不能直接使用 main 开发。
|
||||
|
||||
先执行只读检查:
|
||||
1. git status --short --branch
|
||||
2. 确认 backend/services/advanced_style_set_service.py 存在
|
||||
3. 确认 metadata.yaml 和 core/config_service.py 均为 1.0.32
|
||||
4. 阅读交接文档第 7~10 节
|
||||
1. git checkout codex/ui-navigation-s130-s145
|
||||
2. git pull --ff-only
|
||||
3. git log -3 --oneline --decorate,并确认历史包含 a828f02
|
||||
4. git status --short --branch,并确认工作树干净
|
||||
5. 确认 backend/services/advanced_style_set_service.py 存在
|
||||
6. 确认 metadata.yaml 和 core/config_service.py 均为 1.0.33
|
||||
7. 阅读交接文档第 7~10 节
|
||||
|
||||
下一项开发目标是完成文档中的 1.0.33 修复队列:
|
||||
- 年龄与身体比例解耦
|
||||
- 审核分数一致性
|
||||
- 核心特征证据门控
|
||||
- safe rewrite 二次语义审查
|
||||
- 公共与尺度胶囊去重
|
||||
- 中性验证场景
|
||||
|
||||
要求先写测试,再增量修改现有工作流;不要创建平行工作流,不破坏现有前端结构,
|
||||
不要触发真实付费生图。完成全部本地测试后,再通过 SSH 部署到 astrbot-ops-pro。
|
||||
1.0.33 的年龄/身体解耦、审核一致性、证据门控、safe rewrite 二次审查、公共/尺度胶囊去重、
|
||||
中性验证场景、提交、推送和 NAS 部署均已完成。下一步由用户手动重新导入参考图并进行真实效果验收;
|
||||
不要由自动化流程触发付费生图。
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -1074,7 +1094,7 @@ tests/test_model_route_chain.py
|
|||
|
||||
### 文件完整性
|
||||
|
||||
- [ ] `.git` 已复制。
|
||||
- [ ] 已复制完整 `.git`,或已经从 Forgejo 重新克隆仓库。
|
||||
- [ ] `backend/services/advanced_style_set_service.py` 存在。
|
||||
- [ ] `database/migrations/0016_advanced_materials.sql` 存在。
|
||||
- [ ] `database/migrations/0018_advanced_style_sets.sql` 存在。
|
||||
|
|
@ -1085,14 +1105,15 @@ tests/test_model_route_chain.py
|
|||
### Git 状态
|
||||
|
||||
- [ ] 当前分支仍为 `codex/ui-navigation-s130-s145`,或已明确创建新的 `codex/` 分支。
|
||||
- [ ] 未跟踪的进阶素材文件仍显示在 `git status` 中。
|
||||
- [ ] 没有执行 destructive reset/clean。
|
||||
- [ ] Git 历史包含 `a828f02`。
|
||||
- [ ] `git status --short` 没有意外修改或未跟踪源码。
|
||||
- [ ] 没有把 `origin/main` 的 v1.0.20 当成当前代码。
|
||||
|
||||
### 版本
|
||||
|
||||
- [ ] `metadata.yaml` 为 1.0.32。
|
||||
- [ ] `core/config_service.py` 为 1.0.32。
|
||||
- [ ] `frontend/package.json` 为 1.0.32。
|
||||
- [ ] `metadata.yaml` 为 1.0.33。
|
||||
- [ ] `core/config_service.py` 为 1.0.33。
|
||||
- [ ] `frontend/package.json` 为 1.0.33。
|
||||
|
||||
### 测试
|
||||
|
||||
|
|
@ -1113,7 +1134,7 @@ tests/test_model_route_chain.py
|
|||
|
||||
## 14. 当前任务停止点
|
||||
|
||||
当前代码和实机均停在 `1.0.32`。
|
||||
当前本地代码、Forgejo 功能分支和 NAS 实机均停在 `1.0.33`。
|
||||
|
||||
已经完成:
|
||||
|
||||
|
|
@ -1126,11 +1147,49 @@ tests/test_model_route_chain.py
|
|||
- 211 项测试;
|
||||
- NAS 实机部署与加载确认;
|
||||
- 最新导入图片、提示词和数据库的只读审计。
|
||||
- 年龄、脸部幼态与身体成熟度解耦,正向画风提示词不再携带未成年身体措辞;
|
||||
- 核心特征及背景、光效、色盘的多图证据门控;
|
||||
- 审核分数、偏差、修正补丁和语义风险的一致性校准;
|
||||
- 发丝高光等物体化措辞的服务器侧二次改写与负向形状约束;
|
||||
- 公共 detailed 胶囊与尺度胶囊跨层去重;
|
||||
- 成年且中性光照的三组验证场景;
|
||||
- 新增 6 组算法回归,完整测试为 217 passed。
|
||||
|
||||
尚未完成:
|
||||
|
||||
- 1.0.33 修复队列中的年龄/身体、安全、证据门控、评分一致性、二次语义审查、跨层消重和中性验证场景。
|
||||
- 1.0.32 正式 release zip。
|
||||
- 1.0.21~1.0.32 的 Git 整理、commit、push 和 Forgejo 发布。
|
||||
- 由用户手动重新导入参考图并进行真实付费生图验收,重点观察发丝高光、背景饱和度/光效和全身体型。
|
||||
- 正式 release zip、功能分支合并到 `main` 以及 v1.0.33 tag/release。
|
||||
|
||||
不要把“插件已部署到实机”等同于“代码已保存到 Forgejo”。当前最重要的迁移动作仍然是完整保存本地工作树。
|
||||
1.0.33 已同时保存在本地 Git、Forgejo 功能分支和 NAS 实机。新账号切换到正确分支并读取本文件后,
|
||||
即可从真实效果验收与正式发布阶段继续。
|
||||
|
||||
---
|
||||
|
||||
## 15. 2026-07-19:1.0.34 进阶画风验证超时修复
|
||||
|
||||
用户在真实进阶画风验证中遇到网页显示 `timeout`,但中转站 API 侧没有失败记录。根因不是生图请求必然失败,
|
||||
而是慢速验证任务的后端 Provider 与前端插件桥没有共享同一套长任务时间预算,且任务卡把 SQLite 无时区 UTC
|
||||
时间当成本地时间解析,导致页面可能提前报错或显示错误的数小时耗时。
|
||||
|
||||
本轮已经完成:
|
||||
|
||||
- 版本提升为 `1.0.34`;
|
||||
- 仅进阶画风 `portrait`、`fullbody`、`novel_scene` 三路迁移验证使用独立 `900` 秒生图超时;
|
||||
- `900` 秒同时写入验证 case、队列 request、队列 metadata 和实际 `ImageGenerationRequest`;
|
||||
- `OpenAIImageProvider` 支持单次请求覆盖适配器默认超时,安全范围为 `10~3600` 秒;
|
||||
- 普通快速生图和其他任务仍使用各自适配器超时,没有被全局提高到 900 秒;
|
||||
- AstrBot 插件页面桥与前端 API 客户端共同引用 `frontend/shared/config/timeouts.ts` 中的 900 秒常量;
|
||||
- 任务卡优先读取后端 request/metadata 中的 `timeout_seconds`,显示为“耗时 / 后端时限”;
|
||||
- 无时区后端时间按 UTC 解析,终态任务耗时固定为 `updated_at - created_at`,不再持续增长或错误显示 8 小时;
|
||||
- 已重新构建插件页与 standalone web 产物;
|
||||
- 后端超时专项 `25 passed`,前端契约 `19 passed`,前端 typecheck 通过;
|
||||
- 完整 pytest 共收集 219 项;首轮 9 个失败均为当前 Windows 主机上旧 Worker 测试自身的短等待阈值,
|
||||
放宽测试等待和 Barrier 容差后,所有失败项均已逐项复验通过,但没有再次运行约 38 分钟的整套测试;
|
||||
- 已通过 SSH 覆盖部署到 NAS 的 `astrbot-ops-pro`,AstrBot 日志成功加载 `1.0.34`;
|
||||
- 实机备份目录:
|
||||
`/volume2/Dockers/qqbot/astrbot-ops-pro/data/plugin_backups/astrbot_plugin_imagestudio-1.0.33-pre-1.0.34-20260719-215744`;
|
||||
- 浏览器只读验收确认页面显示 `ImageStudio · 1.0.34`、后端已连接,历史任务耗时恢复为秒级;
|
||||
- 未由自动化触发真实付费生图。
|
||||
|
||||
当前 Git 状态:`1.0.34` 修改仍在本地分支 `codex/ui-navigation-s130-s145` 的工作树中,尚未提交或推送。
|
||||
下一步应由用户手动重试画风验证;确认真实生成不再出现前端提前超时后,再提交、推送并制作正式发布包。
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
# ImageStudio 前端 UI 审计
|
||||
|
||||
日期:2026-07-21
|
||||
范围:`frontend/standalone-web` 工作台、共享 API 类型、导航与 Gallery 页面
|
||||
方法:Impeccable `audit` 技术检查、源码静态审计、基线 typecheck/build/contract tests
|
||||
|
||||
## 项目盘点
|
||||
|
||||
### 技术栈与入口
|
||||
|
||||
- Vue 3 Composition API + TypeScript + Vite 6。
|
||||
- 独立 Web 入口:`frontend/standalone-web/src/main.ts` → `App.vue`。
|
||||
- AstrBot 插件页入口:`frontend/plugin-page/src/main.ts`,通过 `astrbot-page-bridge` 注入后复用 `standalone-web/src/App.vue`。
|
||||
- API 统一入口:`frontend/shared/api/client.ts`;路径常量集中在 `frontend/shared/api/endpoints.ts`,基础路径为 `/api/v1/plugins/extensions/astrbot_plugin_imagestudio`。
|
||||
- 当前无 Vue Router;页面切换由 `activeNav` + URL 查询参数 `view` / `module` / `materialView` / `profile` 维护,并使用 `history.replaceState`。
|
||||
|
||||
### 页面与主要组件
|
||||
|
||||
- 工作台页面:overview、generate、queue、performance、gallery、profiles、materials、settings、logs。
|
||||
- 主要页面组件:`GalleryPage.vue`、`ProfilesPage.vue`、`AdvancedMaterialImportPage.vue`、`SettingsPage.vue`、`BackupPage.vue`、`LogsPage.vue`。
|
||||
- 主要复用组件:`AppNavigationRail.vue`、`StateCard.vue`、`EmptyState.vue`、`MetricCardGrid.vue`、多个 Dialog/Drawer 组件。
|
||||
- 复杂业务子域:workflow、profiles、materials;多数页面仍由 `App.vue` 组合和持有状态。
|
||||
|
||||
### 不能改变的契约
|
||||
|
||||
- 不改变导航 key、module 映射、URL 查询参数语义及插件页/独立 Web 双入口。
|
||||
- 不改变 `frontend/shared/api/endpoints.ts` 中的 endpoint 名称、HTTP 方法、请求体字段和响应类型。
|
||||
- 不改变 `frontend/shared/types/**` 的数据结构,尤其是 image、job、workflow、profile、material、settings、storage 相关类型。
|
||||
- 不改变生成、队列、图库批量操作、工作流轮次/分支、角色卡、素材识别、设置备份与日志的现有交互语义。
|
||||
- 不删除 AstrBot plugin page bridge、媒体签名/载荷流程、后端连接状态与错误恢复路径。
|
||||
|
||||
## Audit Health Score
|
||||
|
||||
| 维度 | 分数 | 关键发现 |
|
||||
|---|---:|---|
|
||||
| Accessibility | 2/4 | 已有语义按钮、`aria-current`、`aria-pressed`、状态 live region;但部分表单控件缺少显式 label,图片预览/弹层焦点管理与键盘闭环需要统一验证。 |
|
||||
| Performance | 2/4 | 生产构建可用;`App.vue` 单文件约 22k 行、Web JS gzip 约 211.5 kB,且存在 `transition: width`、`transition: max-height` 等布局属性动画。 |
|
||||
| Theming | 2/4 | 有 dark/light 变量和主色持久化;但 tokens 集中在 `App.vue`,大量页面级颜色/阴影/渐变仍混杂,主题边界难以复用。 |
|
||||
| Responsive Design | 2/4 | Gallery 等页面有 1180/900/560 断点;工作台整体仍依赖 244px rail、宽 topbar 与多列面板,窄桌面窗口存在拥挤/溢出风险。 |
|
||||
| Anti-Patterns | 2/4 | 本地 detector 命中布局属性动画、圆角元素厚边、侧边/顶部强调条、占位图片检测;背景网格、玻璃模糊和多层渐变也提高了视觉噪声。 |
|
||||
| **Total** | **10/20** | **Acceptable:功能基础稳定,但需要有边界的结构化 UI 重构。** |
|
||||
|
||||
## Anti-Patterns Verdict
|
||||
|
||||
**部分通过,仍有明显 AI/模板化痕迹。** 具体包括:工作台背景的装饰性网格、多个 surface 的渐变与 blur、状态卡片的顶部强调条、导航 active 状态的侧边强调、圆角 + 宽阴影组合,以及大单体 App 文件导致的重复视觉词汇难以治理。它们不是功能阻塞,但会让工具界面显得“装饰先于任务”。
|
||||
|
||||
## 问题清单与优先级
|
||||
|
||||
### P0 Blocking
|
||||
|
||||
- 当前没有确认到会阻塞主要任务完成的 P0 UI 问题。基线功能检查全部通过。
|
||||
|
||||
### P1 Major
|
||||
|
||||
- **P1-01:工作台壳层与业务页面耦合过重**:`frontend/standalone-web/src/App.vue` 约 22k 行,同时承载导航、数据加载、弹层、生成器、队列、图库、素材与设置。影响:任何视觉调整都容易触碰业务状态,回归面大。
|
||||
- **P1-02:桌面窄窗口的结构风险**:导航 rail、sticky topbar、双栏工作区和多个固定最小宽度并存,约 1024–1280px 宽度下容易造成操作区压缩、横向滚动或首屏信息层级失衡。
|
||||
- **P1-03:主题 token 没有形成可复用层**:核心变量主要位于 `App.vue` 的全局 style,页面组件继续直接组合 `var(--panel)`、`var(--border)`、颜色混合和阴影。影响:dark/light 与未来页面统一成本高。
|
||||
- **P1-04:交互状态覆盖不均**:部分按钮有 disabled/hover/focus,弹层、批量操作、加载、空态、错误态的状态表达不完全统一;需要以组件级状态矩阵补齐。
|
||||
- **P1-05:可访问性需专项修复**:`GalleryPage.vue` 搜索框和批量 checkbox 等控件依赖邻近文本,部分复杂弹层/预览需要确认 focus return、Escape、焦点陷阱与可读名称;不能只依赖视觉状态。
|
||||
- **P1-06:性能边界**:`App.vue` 产生单一大 JS/CSS 包,构建已给出超过 500 kB 的 chunk 警告;本轮不改业务加载策略,但应避免新增全局样式和重型运行时依赖。
|
||||
|
||||
### P2 Minor
|
||||
|
||||
- **P2-01:视觉节奏不一致**:8/10/12/14/16/18/22/24 等间距和 7/8/10/12 等圆角并存,需抽取有限的 spacing/radius scale。
|
||||
- **P2-02:装饰噪声偏高**:背景网格、渐变、backdrop-filter 在多个层级重复,降低任务区域的对比度和层级清晰度。
|
||||
- **P2-03:状态色与表面色混用**:good/warn/bad/idle 的 border、背景、顶部条规则分散在多个选择器,需集中到语义状态 tokens。
|
||||
- **P2-04:图库卡片信息密度不稳定**:grid/list/inspector 三种模式的操作按钮、选中态和媒体占比不完全一致,批量操作区在窄桌面易成为第二工具栏。
|
||||
- **P2-05:部分过渡动画直接改变布局属性**:检测命中 `transition: width` 与 `transition: max-height`;应优先改为 transform/opacity 或 grid 行过渡。
|
||||
- **P2-06:图片替代文本规则不统一**:多数业务图片有 alt,但预览/通知缩略图存在空 alt 或依赖上下文的情况,需要区分装饰图与内容图。
|
||||
|
||||
## 正向发现
|
||||
|
||||
- 业务 API 与类型文件集中,页面重构可以保持数据契约不变。
|
||||
- 导航、状态卡、空态、预览对话框已有复用组件,不需要推倒重来。
|
||||
- Gallery 已具备搜索、筛选、grid/list、批量操作、预览、错误和 loading 路径,适合作为第一批页面。
|
||||
- 基线 `npm.cmd run typecheck`、`npm.cmd run build:web`、`npm.cmd run test:contracts` 均通过。
|
||||
|
||||
## 来源与边界
|
||||
|
||||
- 本地源码:`frontend/standalone-web/src/App.vue`、`frontend/standalone-web/src/features/gallery/GalleryPage.vue`、`frontend/standalone-web/src/components/AppNavigationRail.vue`、`frontend/shared/api/client.ts`、`frontend/shared/api/endpoints.ts`、`frontend/shared/types/**`。
|
||||
- 本地配置:`frontend/package.json`、`frontend/standalone-web/vite.config.ts`、`frontend/plugin-page/vite.config.ts`。
|
||||
- Impeccable 本地 detector:命中 5 项静态提示,未替代人工审计。
|
||||
- 未使用外部网络资料;本次目标是对现有仓库实现做代码级审计。
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
# ImageStudio UI 重构后续开发队列
|
||||
|
||||
日期:2026-07-21
|
||||
基线分支:`codex/ui-redesign-gallery`
|
||||
范围:仅覆盖本轮 UI 重构尚未完成的事项;不包含后端功能新增。
|
||||
|
||||
## 当前结论
|
||||
|
||||
- 已完成:共享视觉 token、工作台壳层、主要页面统一 surface/间距/圆角/状态/focus、Gallery 首批重构、桌面横向溢出修复、静态 detector 检查。
|
||||
- 尚未完成:真实 AstrBot 后端数据验收、逐页深度视觉精修、完整键盘/焦点审计、多个桌面尺寸验证、性能拆包、提交与发布收口。
|
||||
- 当前分支仍有未提交源码和文档改动;主支未修改。
|
||||
|
||||
## P0:交付阻断项
|
||||
|
||||
### Q0-01 真实 AstrBot 后端联调
|
||||
|
||||
**目标**:在真实 plugin-page bridge 和后端 API 下验证 UI,不再只依赖 preview mode。
|
||||
**涉及**:`frontend/plugin-page/src/main.ts`、`frontend/shared/api/client.ts`、所有主要页面。
|
||||
**验收**:
|
||||
|
||||
- plugin-page 能加载真实 bootstrap、dashboard、profiles、images、jobs、settings、logs。
|
||||
- 后端未连接、401、超时、空数据、部分数据错误状态均有可读反馈。
|
||||
- 真实媒体签名、预览、刷新和批量操作不出现空白或死状态。
|
||||
|
||||
### Q0-02 保护当前未提交改动并完成分支交付
|
||||
|
||||
**目标**:确认 `GalleryPage.vue` 原有改动与本轮改动的归属,完成 diff review、提交和 PR。
|
||||
**验收**:
|
||||
|
||||
- `git diff --check` 通过。
|
||||
- 无构建产物污染 `web/` 或 `pages/imagestudio/`。
|
||||
- 用户确认后创建 commit/PR;未确认前不合并主支。
|
||||
|
||||
## P1:发布前必须完成
|
||||
|
||||
### Q1-01 逐页深度视觉精修
|
||||
|
||||
当前统一主要通过共享 CSS 层完成,以下页面还需要逐页检查内容层级、密度和操作优先级:
|
||||
|
||||
- Overview:指标条、监控摘要、队列摘要、最近图片之间的层级和密度。
|
||||
- Generate:预览区、提示词输入、模型选择、生成操作和结果信息的空间分配。
|
||||
- Queue:过滤、任务状态、进度、详情和批量操作的优先级。
|
||||
- Performance:指标、趋势/明细、空态和失败态。
|
||||
- Profiles:master/detail/wardrobe 三栏在有数据、无数据和 sealed 状态下的层级。
|
||||
- Materials:导入、识别、确认、筛选、详情和空态。
|
||||
- Settings:section 导航、配置编辑、保存/校验/回滚状态。
|
||||
- Logs:筛选、日志列表、错误状态和长文本换行。
|
||||
- Workflow:节点流、轮次、分支、候选图、审查 dialog、素材 drawer。
|
||||
|
||||
**验收**:每页保留现有功能,并有明确的主操作、次操作、危险操作和恢复路径。
|
||||
|
||||
### Q1-02 完整可访问性审计
|
||||
|
||||
**涉及**:所有 `*.vue` 页面和 Dialog/Drawer 组件。
|
||||
**任务**:
|
||||
|
||||
- 为搜索、筛选、checkbox、select、textarea、icon-only button 补齐稳定 label。
|
||||
- 验证 Tab 顺序、Enter/Space、Escape、焦点回收和 dialog focus trap。
|
||||
- 检查 heading 层级、landmark、`aria-current`、`aria-expanded`、`aria-selected`、`aria-live`。
|
||||
- 检查真实图片 alt、装饰图空 alt、加载/失败图片的替代内容。
|
||||
- 使用键盘完成 Gallery 批量操作、Profiles 选择、Workflow 节点操作和 Settings 保存。
|
||||
|
||||
**验收**:关键路径不依赖鼠标;焦点在 dark/light 两主题下可见。
|
||||
|
||||
### Q1-03 多尺寸响应式验收
|
||||
|
||||
**必须验证尺寸**:
|
||||
|
||||
- 1024×768:窄桌面,检查 rail、topbar、双栏/三栏区域。
|
||||
- 1280×800:常见桌面工作区。
|
||||
- 1440×900:宽桌面,检查内容是否过度拉伸。
|
||||
- 1600×900:超宽窗口,检查 max-width 和阅读线长。
|
||||
|
||||
**验收**:无横向溢出;sticky topbar/rail 不遮挡内容;批量工具栏和 dialog 不被裁切。
|
||||
|
||||
### Q1-04 状态矩阵补齐
|
||||
|
||||
为每个主要页面记录并验证:default、hover、focus、active/selected、disabled、loading、empty、error、success、backend disconnected。
|
||||
重点组件:按钮、tabs、filters、cards、dialogs、drawers、图片预览、表单保存栏。
|
||||
|
||||
## P2:质量和维护性
|
||||
|
||||
### Q2-01 视觉回归测试
|
||||
|
||||
- 为 9 个主要 view 建立最小 Playwright/浏览器 smoke test。
|
||||
- 固定至少一组 dark/light 截图或 DOM 断言。
|
||||
- 断言 `scrollWidth === clientWidth`、页面标题、主要 landmark 和关键操作存在。
|
||||
- 将真实 backend 不可用场景纳入 preview-mode regression。
|
||||
|
||||
### Q2-02 前端拆包与性能优化
|
||||
|
||||
**现状**:Web JS gzip 约 211.6 kB,Vite 报告单 chunk 超过 500 kB。
|
||||
**任务**:
|
||||
|
||||
- 评估按页面动态导入 Generate、Profiles、Materials、Settings、Workflow。
|
||||
- 保证 plugin-page bridge 首屏和 `App.vue` 的 URL 参数恢复不受影响。
|
||||
- 避免新增 UI 运行时依赖;对大图片列表保持懒加载和稳定的媒体 URL。
|
||||
- 对生成预览、Workflow 候选图和 Materials grid 做渲染数量边界检查。
|
||||
|
||||
**验收**:构建 chunk 警告下降或有明确的保留理由;交互没有新增延迟。
|
||||
|
||||
### Q2-03 样式边界整理
|
||||
|
||||
- 将 `App.vue` 中新增的全局 override 按壳层、页面、组件拆到可定位样式文件。
|
||||
- 避免继续增长 22k 行级别的单体 `App.vue`。
|
||||
- 保留 `tokens.css` 作为唯一视觉 token 来源,减少页面内直接写颜色/圆角/阴影。
|
||||
- 清理重复的局部样式和已被全局层覆盖的旧规则。
|
||||
|
||||
### Q2-04 主题和对比度验证
|
||||
|
||||
- 验证 dark/light 下正文、placeholder、disabled、warning、danger、success 的对比度。
|
||||
- 复核用户自定义 primary/accent 颜色的极端值,避免 focus 和文字失去对比度。
|
||||
- 记录至少一组自动化 contrast 检查结果。
|
||||
|
||||
## P3:可选增强
|
||||
|
||||
### Q3-01 设计文档和组件清单
|
||||
|
||||
- 为 token、button、input、surface、status、dialog、empty state 建立简短使用约定。
|
||||
- 在 `docs/` 维护页面状态矩阵和可复用组件清单。
|
||||
|
||||
### Q3-02 真实数据密度优化
|
||||
|
||||
- 用真实 profiles、materials、images、jobs、logs 数据压测长标题、长 prompt、长错误消息。
|
||||
- 检查分页/滚动/虚拟化需求,避免只在空数据预览态下看起来稳定。
|
||||
|
||||
### Q3-03 发布前人工验收
|
||||
|
||||
- 在 AstrBot plugin page 中完成一次完整生成、图库复用、角色选择、素材导入、设置保存、日志查看流程。
|
||||
- 记录阻塞项、截图和最终版本信息。
|
||||
|
||||
## 推荐执行顺序
|
||||
|
||||
1. `Q0-01` 真实后端联调。
|
||||
2. `Q1-01` 逐页深度视觉精修。
|
||||
3. `Q1-02` 可访问性审计与修复。
|
||||
4. `Q1-03` 四种桌面尺寸验收。
|
||||
5. `Q1-04` 状态矩阵补齐。
|
||||
6. `Q2-01` 回归测试。
|
||||
7. `Q2-02` 拆包优化。
|
||||
8. `Q2-03` 样式边界整理。
|
||||
9. `Q2-04` 主题对比度验证。
|
||||
10. `Q0-02` 最终 diff review、commit 和 PR。
|
||||
11. `Q3-03` 真实插件页发布前验收。
|
||||
|
||||
## 暂不列入本队列
|
||||
|
||||
- 后端 API 新功能。
|
||||
- 多租户权限链、持久 Worker、数据库迁移等后端架构事项。
|
||||
- 更换 Vue/Vite/TypeScript 或引入新的 UI 框架。
|
||||
|
||||
|
||||
## Execution update (2026-07-21)
|
||||
|
||||
- Q0-01: source-level bridge/error/preview paths validated; live AstrBot host acceptance remains pending.
|
||||
- Q1-01: shared visual layer, page-level surface hierarchy, action states, and overview narrow-desktop override completed; all nine views smoke-tested.
|
||||
- Q1-02: stable search/workbench/status labels added; image preview dialog now traps focus and restores focus; existing confirmation dialog trap retained.
|
||||
- Q1-03: 1024x768, 1280x800, 1440x900, and 1600x900 passed across all nine views with no horizontal overflow.
|
||||
- Q1-04: state matrix recorded in docs/ui-redesign-state-matrix-2026-07-21.md.
|
||||
- Q2-01: added frontend/tests/ui-redesign-smoke.test.mjs and frontend/tests/ui-theme-contract.test.mjs; 7 UI contract tests pass.
|
||||
- Q2-02: page and workflow components use defineAsyncComponent; production chunks are split and the largest JS chunk is below the prior warning threshold.
|
||||
- Q2-03: new workbench overrides moved from App.vue into frontend/standalone-web/src/styles/workbench.css.
|
||||
- Q2-04: dark/light token contrast checks added; measured text pair ratios are 16.40, 7.52, 15.14, and 4.59.
|
||||
- Q0-02: diff review, build-artifact cleanup, full validation, commit, and PR are the remaining delivery actions.
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
# ImageStudio 全页面 UI 统一性检查
|
||||
|
||||
日期:2026-07-21
|
||||
分支:`codex/ui-redesign-gallery`
|
||||
|
||||
## 覆盖范围
|
||||
|
||||
- 工作台壳层、导航 rail、topbar、主题和全局状态。
|
||||
- Overview、Generate、Queue、Performance、Gallery、Profiles、Materials、Settings、Logs。
|
||||
- Workflow 子组件、Profiles 子面板、Settings 子面板、Dialogs/Drawers。
|
||||
- 独立 Web 与 AstrBot plugin-page 两个 Vite 入口。
|
||||
|
||||
## 统一规则
|
||||
|
||||
- 视觉 token:`frontend/standalone-web/src/styles/tokens.css`。
|
||||
- 统一 surface:`var(--panel)` / `var(--panel-muted)`,默认取消装饰性宽阴影。
|
||||
- 统一形状:小控件 6–8px,页面 surface 10px,状态 pill 使用 999px。
|
||||
- 统一间距:4/8/12/16/20/24px。
|
||||
- 统一 focus:主色 3px focus ring,表单和按钮保留键盘可见焦点。
|
||||
- 统一状态:good/warn/bad/idle 使用语义边框和背景,不再依赖顶部/侧边粗色条。
|
||||
- 统一动效:保留必要状态反馈;移除布局属性过渡,支持 `prefers-reduced-motion`。
|
||||
- 统一响应式:修复 1265px 桌面窗口下 Overview/Gallery 横向溢出,9 个主要 view 均通过 smoke test。
|
||||
|
||||
## 结果
|
||||
|
||||
- Impeccable detector:0 条命中。
|
||||
- 浏览器 smoke test:`overview`、`generate`、`queue`、`performance`、`images`、`profiles`、`materials`、`settings`、`logs` 均成功加载。
|
||||
- 桌面窗口检查:`scrollWidth === clientWidth`,未发现横向溢出。
|
||||
- plugin-page bridge 入口与独立 Web 入口均可构建。
|
||||
|
||||
## 验证命令
|
||||
|
||||
- `npm.cmd run typecheck`
|
||||
- `npm.cmd run test:contracts`:19/19 通过
|
||||
- `npm.cmd run build:web`
|
||||
- `npm.cmd run build:plugin`
|
||||
- `node C:\Users\Administrator\.agents\skills\impeccable\scripts\detect.mjs --json frontend/standalone-web/src/App.vue frontend/standalone-web/src/components frontend/standalone-web/src/features`
|
||||
|
||||
## 已知遗留
|
||||
|
||||
- Web JS gzip 仍约 211.6 kB,构建保留 Vite 的大 chunk 警告;这是后续代码拆分/动态导入工作,不在本轮视觉重构中处理。
|
||||
- 未连接真实 AstrBot 后端,因此 smoke test 验证的是前端预览态、路由切换和布局,不替代真实 API/插件页数据联调。
|
||||
|
||||
|
||||
## Final execution evidence
|
||||
|
||||
- Browser smoke: 36 checks across 9 views and 4 desktop sizes; all passed with scrollWidth equal to clientWidth.
|
||||
- Frontend UI tests: 7/7 passed.
|
||||
- Contract tests: 25/25 passed.
|
||||
- Typecheck: passed.
|
||||
- Plugin build: passed.
|
||||
- Standalone build: passed.
|
||||
- Generated web/pages artifacts were removed from the working tree after validation.
|
||||
- Live AstrBot plugin-page acceptance is explicitly pending and documented in docs/ui-redesign-integration-validation-2026-07-21.md.
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# UI Integration Validation
|
||||
|
||||
Date: 2026-07-21
|
||||
Branch: codex/ui-redesign-gallery
|
||||
|
||||
## Local checks
|
||||
|
||||
- Plugin bridge source keeps ready/context handshake, GET/POST request routing, timeout handling, JSON-safe payload cloning, and error unwrapping.
|
||||
- Direct API base remains /api/v1/plugins/extensions/astrbot_plugin_imagestudio.
|
||||
- Plugin-page production build passed.
|
||||
- Standalone-web production build passed.
|
||||
- No local AstrBot host was available on the checked ports; no real bootstrap or signed-media response was claimed.
|
||||
|
||||
## Checked failure paths
|
||||
|
||||
- Direct transport reports network_unreachable when the API is unavailable.
|
||||
- HTML/non-JSON responses are converted to invalid_api_response with a bounded preview.
|
||||
- 401/HTTP failures remain ApiClientError values and are surfaced through the backend connection banner.
|
||||
- Preview mode is explicit and write actions are blocked until a connected backend with write permission is present.
|
||||
- Media URLs use the plugin bridge signing path instead of unauthenticated direct img requests.
|
||||
|
||||
## Required host acceptance
|
||||
|
||||
Run the following in an AstrBot plugin page with a real session:
|
||||
|
||||
1. Load ui/bootstrap, dashboard, profiles, images, jobs, settings, logs.
|
||||
2. Verify signed image preview, refresh, batch selection, retry/cancel, settings save, and log filtering.
|
||||
3. Verify 401, timeout, empty data, partial data, and backend restart recovery.
|
||||
4. Record AstrBot version, ImageStudio plugin version, and screenshots.
|
||||
|
||||
Status: source-level integration is ready; live host acceptance is pending because no AstrBot plugin host is running in this workspace.
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
# ImageStudio 桌面端 UI 重构方案
|
||||
|
||||
日期:2026-07-21
|
||||
分支:`codex/ui-redesign-gallery`
|
||||
原则:保留业务逻辑、路由查询参数、API 与数据结构;先改一个页面,再扩展共享视觉层。
|
||||
|
||||
## 设计方向
|
||||
|
||||
ImageStudio 是桌面端创作工具,不采用营销网站的 hero、宣传卡片或装饰性动效。视觉方向为“安静的工作台”:冷中性背景、单一主色作为动作/选中/状态强调,内容区保持高对比和稳定密度;圆角、阴影、渐变只服务层级,不作为装饰。
|
||||
|
||||
## P0:先保证安全边界
|
||||
|
||||
本项目当前没有已确认的 P0 UI 阻塞项。P0 阶段只包含保护措施:
|
||||
|
||||
- 保留现有 URL 参数:`view`、`module`、`materialView`、`profile`。
|
||||
- 保留 plugin-page bridge、API endpoint、shared types 和现有事件 emit。
|
||||
- 每批修改前后运行 `npm.cmd run typecheck`、`npm.cmd run build:web`,并运行 `npm.cmd run test:contracts`。
|
||||
- 不删除当前工作树已有的 `GalleryPage.vue` 未提交修改;本分支在其基础上继续。
|
||||
|
||||
## P1:首批桌面端可用性重构
|
||||
|
||||
### P1-01 只重构 Gallery 页面
|
||||
|
||||
目标文件:
|
||||
|
||||
- `frontend/standalone-web/src/features/gallery/GalleryPage.vue`
|
||||
- 必要时复用而不改逻辑:`frontend/standalone-web/src/components/ImagePreviewDialog.vue`、`frontend/standalone-web/src/components/EmptyState.vue`、`frontend/standalone-web/src/components/StateCard.vue`
|
||||
- 契约测试:`frontend/tests/production-data-boundary.test.mjs` 与图库相关测试
|
||||
|
||||
实施内容:
|
||||
|
||||
- 保持 props、emits、筛选值、批量 action、endpoint 调用和预览行为不变。
|
||||
- 重排为稳定的桌面工作区:页面标题/主操作 → 搜索筛选 → 结果区 + inspector;减少重复 surface。
|
||||
- 统一按钮、输入框、筛选 tabs、选中态、禁用态、loading、error、empty 状态。
|
||||
- 让 grid/list 在 1024px–1440px 桌面宽度下优先保持主要内容可读,inspector 只在有选择时占据空间。
|
||||
- 为搜索、批量选择、卡片操作和图片预览补齐可见 focus、名称、Escape/关闭路径检查。
|
||||
- 不新增依赖,不引入营销式动画;保留现有 reduced-motion 规则并覆盖新过渡。
|
||||
|
||||
### P1-02 抽取最小共享视觉 token
|
||||
|
||||
候选文件:
|
||||
|
||||
- 新增 `frontend/standalone-web/src/styles/tokens.css` 或现有入口可接受的等价 token 文件。
|
||||
- 调整 `frontend/standalone-web/src/App.vue` 的全局工作台变量接入 token。
|
||||
|
||||
范围:颜色角色、spacing、radius、border、shadow、focus ring、motion duration、z-index;只抽取已经在现有 UI 中出现的语义,不改变默认主题含义。
|
||||
|
||||
## P2:扩展一致性
|
||||
|
||||
- `frontend/standalone-web/src/components/AppNavigationRail.vue`:统一 active/hover/focus/compact rail,不改变导航 key 或 pin 行为。
|
||||
- `frontend/standalone-web/src/features/profiles/ProfilesPage.vue`、`ProfileMasterPane.vue`、`ProfileDetailPane.vue`、`ProfileWardrobePane.vue`:应用同一 surface、表单和状态矩阵。
|
||||
- `frontend/standalone-web/src/features/materials/AdvancedMaterialImportPage.vue`:统一导入步骤、loading/error/empty 和内容密度。
|
||||
- `frontend/standalone-web/src/features/settings/SettingsPage.vue` 与 settings panels:统一 section、保存/校验/回滚状态。
|
||||
- `frontend/standalone-web/src/features/workflow/*.vue`:只做视觉层和焦点/状态修复,不改变 workflow route、round、branch、review API。
|
||||
- `frontend/standalone-web/src/features/logs/LogsPage.vue` 与 queue/performance 区块:统一状态色、表格/列表密度和窄桌面布局。
|
||||
|
||||
## P2:技术收口
|
||||
|
||||
- 将 `App.vue` 的局部视觉规则迁移到可定位的页面/组件样式,降低后续回归风险;不在第一批做大规模逻辑拆分。
|
||||
- 评估路由页面的动态导入,但只有在不影响 plugin-page bridge 和首屏加载契约时才实施。
|
||||
- 将布局属性过渡替换为 transform/opacity 或明确的 grid track 过渡。
|
||||
- 统一图片 loading/失败/alt 规则,并复核对话框 focus return。
|
||||
|
||||
## 交付顺序与验证门
|
||||
|
||||
1. Gallery 页面视觉与交互状态;通过 typecheck、build:web、contract tests。
|
||||
2. Gallery 桌面窗口验证:1280×800、1440×900、1024×768;检查横向溢出、sticky 区域、键盘焦点和空/错/加载状态。
|
||||
3. 共享 tokens 接入;再次跑同一验证门,并确认 plugin build 不受影响。
|
||||
4. 导航、profiles、materials、settings、workflow、logs/queue 分批推进,每批单独验证。
|
||||
5. 最后一轮执行 Impeccable `polish`:桌面窗口、溢出、状态、可访问性与设计一致性。
|
||||
|
||||
## 明确不做
|
||||
|
||||
- 不重写后端、不改 API endpoint、不迁移数据结构。
|
||||
- 不更换 Vue/Vite/TypeScript 技术栈。
|
||||
- 不引入新的 UI 框架或图标依赖。
|
||||
- 不添加不必要的全屏动画、营销式 hero、装饰性玻璃卡片或渐变文字。
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# UI State Matrix
|
||||
|
||||
Date: 2026-07-21
|
||||
Branch: codex/ui-redesign-gallery
|
||||
|
||||
## Coverage
|
||||
|
||||
| Area | default | hover | focus | selected | disabled | loading | empty | error | success | disconnected |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| Navigation rail | yes | yes | yes | aria-current=page | n/a | n/a | n/a | n/a | n/a | yes |
|
||||
| Generate composer | yes | yes | yes | mode button | yes | submit text | preview empty | inline error | result card | write blocked |
|
||||
| Queue | yes | yes | yes | filter/task | action disabled | refresh text | empty state | task error | completed status | read-only |
|
||||
| Gallery | yes | yes | yes | card/batch | batch disabled | media loading | empty state | media fallback | selection feedback | read-only |
|
||||
| Profiles | yes | yes | yes | profile/tab | sealed/read-only | pane loading | empty pane | inline error | saved state | read-only |
|
||||
| Materials | yes | yes | yes | filter/category | permission disabled | operation busy | empty state | action error | operation message | read-only |
|
||||
| Settings | yes | yes | yes | section/tab | permission disabled | save/reload | missing schema | validation error | saved message | read-only |
|
||||
| Logs | yes | yes | yes | filter | refresh disabled | load text | empty state | error state | refreshed state | unavailable |
|
||||
| Workflow | yes | yes | yes | node/candidate | sealed/locked | task progress | candidate empty | node error | adopted state | read-only |
|
||||
|
||||
## Keyboard paths
|
||||
|
||||
- Global search: focus, ArrowUp/ArrowDown, Enter, Escape.
|
||||
- Navigation and tabs: Tab, Enter, Space, aria-current/aria-pressed.
|
||||
- Confirm dialog: Escape, Tab loop, focus return.
|
||||
- Image preview dialog: Escape, Tab loop, focus return, zoom controls.
|
||||
- Backend banner: retry is keyboard reachable and status is aria-live.
|
||||
|
||||
## Notes
|
||||
|
||||
The matrix is backed by shared states in App.vue and feature components. Real backend disconnected states are represented by the existing preview/error/blocked paths; live plugin-host acceptance remains a deployment-bound check.
|
||||
|
|
@ -65,6 +65,7 @@ class ImageGenerationRequest:
|
|||
count: int = 1
|
||||
input_images: tuple[str, ...] = ()
|
||||
metadata: dict[str, Any] = field(default_factory=dict)
|
||||
timeout_seconds: int | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
@ -142,7 +143,12 @@ class OpenAIImageProvider:
|
|||
**self.config.extra_headers,
|
||||
}
|
||||
try:
|
||||
response = self._transport(self.config.endpoint_url(), payload, headers, self.config.timeout_seconds)
|
||||
response = self._transport(
|
||||
self.config.endpoint_url(),
|
||||
payload,
|
||||
headers,
|
||||
_generation_request_timeout_seconds(request.timeout_seconds, self.config.timeout_seconds),
|
||||
)
|
||||
except ImageProviderError as exc:
|
||||
if exc.provider_id != "unknown":
|
||||
raise
|
||||
|
|
@ -299,6 +305,14 @@ def _post_json(url: str, payload: JsonDict, headers: dict[str, str], timeout_sec
|
|||
return _parse_json_body(body)
|
||||
|
||||
|
||||
def _generation_request_timeout_seconds(value: Any, fallback: Any) -> int:
|
||||
try:
|
||||
timeout = int(value if value is not None else fallback)
|
||||
except (TypeError, ValueError):
|
||||
timeout = 180
|
||||
return min(max(timeout, 10), 3600)
|
||||
|
||||
|
||||
def _parse_json_body(body: str) -> JsonDict:
|
||||
try:
|
||||
parsed = json.loads(body)
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ class SingleFlowEngine:
|
|||
count=count,
|
||||
input_images=_normalize_input_images(request.get("input_images") or request.get("image")),
|
||||
metadata={"task_id": task.task_id, "model_route": model_route},
|
||||
timeout_seconds=_optional_timeout_seconds(request.get("timeout_seconds")),
|
||||
)
|
||||
)
|
||||
assets: list[MockGeneratedAsset] = []
|
||||
|
|
@ -377,6 +378,15 @@ def _normalize_input_images(value: Any) -> tuple[str, ...]:
|
|||
return (text,) if text else ()
|
||||
|
||||
|
||||
def _optional_timeout_seconds(value: Any) -> int | None:
|
||||
if value is None:
|
||||
return None
|
||||
try:
|
||||
return min(max(int(value), 10), 3600)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def _image_bytes(
|
||||
b64_json: str | None,
|
||||
url: str | None,
|
||||
|
|
|
|||
5
frontend/package-lock.json
自动生成
5
frontend/package-lock.json
自动生成
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.66",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.66",
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.0",
|
||||
"pinia": "^2.3.0",
|
||||
|
|
@ -1531,3 +1531,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "astrbot-plugin-imagestudio-frontend",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.66",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
@ -10,7 +10,8 @@
|
|||
"build:web": "vite build --config standalone-web/vite.config.ts",
|
||||
"build": "npm run build:plugin && npm run build:web",
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
"test:contracts": "node --test tests/*.test.mjs"
|
||||
"test:contracts": "node --test tests/*.test.mjs",
|
||||
"test:ui": "node --test tests/ui-redesign-smoke.test.mjs tests/ui-theme-contract.test.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vitejs/plugin-vue": "^5.2.0",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { LONG_TASK_TIMEOUT_MS } from "../config/timeouts"
|
||||
|
||||
const CHANNEL = "astrbot-plugin-page"
|
||||
const READY_RETRY_MS = 250
|
||||
const DEFAULT_REQUEST_TIMEOUT_MS = 30000
|
||||
const LONG_TASK_REQUEST_TIMEOUT_MS = 300000
|
||||
const LONG_TASK_ENDPOINT = /(?:^|\/)(?:generate|retry|review|execute-character|expand|governance-preview|probe-provider|probe-model|recognize|re-recognize|renormalize|renormalize-batch|import-pack|migrate|restore)(?:\/|$)/
|
||||
|
||||
type PendingRequest = {
|
||||
|
|
@ -87,7 +88,7 @@ export function installAstrBotPluginPageBridge() {
|
|||
const cloneablePayload = toPostMessagePayload(payload)
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const timeoutMs = action === "api:post" && LONG_TASK_ENDPOINT.test(endpoint)
|
||||
? LONG_TASK_REQUEST_TIMEOUT_MS
|
||||
? LONG_TASK_TIMEOUT_MS
|
||||
: DEFAULT_REQUEST_TIMEOUT_MS
|
||||
const timer = window.setTimeout(() => {
|
||||
pending.delete(requestId)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { API_BASE } from "./endpoints"
|
||||
import { LONG_TASK_TIMEOUT_MS } from "../config/timeouts"
|
||||
import type { ApiResponse, AstrBotApiResponse } from "../types/api"
|
||||
|
||||
export type ApiTransport = "plugin-bridge" | "direct-fetch"
|
||||
|
|
@ -10,7 +11,6 @@ const PLUGIN_BRIDGE_DISCOVERY_TIMEOUT_MS = 2500
|
|||
const PLUGIN_BRIDGE_READY_TIMEOUT_MS = 1200
|
||||
const PLUGIN_BRIDGE_GET_TIMEOUT_MS = 15000
|
||||
const PLUGIN_BRIDGE_POST_TIMEOUT_MS = 30000
|
||||
const PLUGIN_BRIDGE_LONG_TASK_TIMEOUT_MS = 300000
|
||||
const LONG_TASK_ENDPOINT = /(?:^|\/)(?:generate|retry|review|execute-character|expand|governance-preview|probe-provider|probe-model|recognize|re-recognize|renormalize|renormalize-batch|import-pack|migrate|restore)(?:\/|$)/
|
||||
|
||||
type PluginBridge = NonNullable<Window["AstrBotPluginPage"]>
|
||||
|
|
@ -167,7 +167,7 @@ async function requestViaPluginBridge<T>(
|
|||
|
||||
function pluginBridgePostTimeout(endpoint: string) {
|
||||
return LONG_TASK_ENDPOINT.test(endpoint)
|
||||
? PLUGIN_BRIDGE_LONG_TASK_TIMEOUT_MS
|
||||
? LONG_TASK_TIMEOUT_MS
|
||||
: PLUGIN_BRIDGE_POST_TIMEOUT_MS
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ export const endpoints = {
|
|||
jobDelete: (taskId: string) => `jobs/${taskId}`,
|
||||
jobCancel: (taskId: string) => `jobs/${taskId}/cancel`,
|
||||
jobRetry: (taskId: string) => `jobs/${taskId}/retry`,
|
||||
jobRetryFailed: "jobs/failed/retry",
|
||||
jobClearFailed: "jobs/failed/clear",
|
||||
jobClearTerminal: "jobs/terminal/clear",
|
||||
jobDeadLetterRetry: "jobs/dead-letter/retry",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
export const LONG_TASK_TIMEOUT_SECONDS = 900
|
||||
export const LONG_TASK_TIMEOUT_MS = LONG_TASK_TIMEOUT_SECONDS * 1000
|
||||
|
|
@ -147,6 +147,7 @@ export interface AdvancedStyleValidationCase {
|
|||
input_image_count?: number
|
||||
style_scores: Record<string, unknown>
|
||||
style_review?: Record<string, unknown>
|
||||
rendering_layers?: Record<string, number>
|
||||
content_novelty: Record<string, unknown>
|
||||
usage?: Record<string, unknown>
|
||||
fidelity_score?: number | null
|
||||
|
|
@ -339,4 +340,15 @@ export interface AdvancedMaterialDecisionRequest {
|
|||
reuse_validation_scenarios?: boolean
|
||||
decision_notes?: string
|
||||
fidelity_score?: number
|
||||
validation_reference_enabled?: boolean
|
||||
validation_reference_source_id?: string
|
||||
}
|
||||
|
||||
export interface AdvancedStyleConsensusRequest {
|
||||
analysis_strategy?: "text_only" | "vision_assisted"
|
||||
included_source_ids?: string[]
|
||||
validation_reference_enabled?: boolean
|
||||
validation_reference_source_id?: string
|
||||
style_adjustment_text?: string
|
||||
validation_instruction?: string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import type { CostUsageSummary } from "../types/cost"
|
||||
import type { GenerationJob } from "../types/job"
|
||||
|
||||
const BACKEND_NAIVE_UTC_TIMESTAMP = /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/
|
||||
const TERMINAL_JOB_STATUSES = new Set(["completed", "succeeded", "failed", "cancelled", "dead_letter", "superseded"])
|
||||
|
||||
export function normalizeStatus(status: string): string {
|
||||
return String(status || "").trim().toLowerCase()
|
||||
}
|
||||
|
|
@ -58,7 +61,9 @@ export function formatCostEstimate(summary: CostUsageSummary): string {
|
|||
|
||||
export function formatTime(value?: string): string {
|
||||
if (!value) return "-"
|
||||
const date = new Date(value)
|
||||
const parsed = timestamp(value)
|
||||
if (!parsed) return value
|
||||
const date = new Date(parsed)
|
||||
if (Number.isNaN(date.getTime())) return value
|
||||
return new Intl.DateTimeFormat("zh-CN", {
|
||||
month: "2-digit",
|
||||
|
|
@ -69,17 +74,43 @@ export function formatTime(value?: string): string {
|
|||
}
|
||||
|
||||
export function timestamp(value: string): number {
|
||||
const parsed = Date.parse(value)
|
||||
const text = String(value || "").trim()
|
||||
const normalized = BACKEND_NAIVE_UTC_TIMESTAMP.test(text)
|
||||
? `${text.replace(" ", "T")}Z`
|
||||
: text
|
||||
const parsed = Date.parse(normalized)
|
||||
return Number.isFinite(parsed) ? parsed : 0
|
||||
}
|
||||
|
||||
export function waitTime(job: GenerationJob): string {
|
||||
const start = timestamp(job.created_at)
|
||||
if (!start) return "-"
|
||||
const minutes = Math.max(0, Math.round((Date.now() - start) / 60000))
|
||||
if (minutes < 1) return "刚刚"
|
||||
const status = normalizeStatus(job.status)
|
||||
const terminal = TERMINAL_JOB_STATUSES.has(status)
|
||||
const persistedEnd = terminal ? timestamp(job.updated_at) : 0
|
||||
const elapsedSeconds = Math.max(0, Math.round(((persistedEnd || Date.now()) - start) / 1000))
|
||||
const elapsed = formatDurationSeconds(elapsedSeconds)
|
||||
const timeout = jobTimeoutSeconds(job)
|
||||
return timeout ? `${elapsed} / 上限 ${formatDurationSeconds(timeout)}` : elapsed
|
||||
}
|
||||
|
||||
export function jobTimeoutSeconds(job: GenerationJob): number | undefined {
|
||||
const requestValue = job.request?.timeout_seconds
|
||||
const metadataValue = job.metadata?.timeout_seconds
|
||||
const value = requestValue ?? metadataValue
|
||||
const timeout = Number(value)
|
||||
if (!Number.isFinite(timeout) || timeout <= 0) return undefined
|
||||
return Math.round(timeout)
|
||||
}
|
||||
|
||||
function formatDurationSeconds(value: number): string {
|
||||
const seconds = Math.max(0, Math.round(value))
|
||||
if (seconds < 60) return seconds < 1 ? "刚刚" : `${seconds} 秒`
|
||||
const minutes = Math.round(seconds / 60)
|
||||
if (minutes < 60) return `${minutes} 分钟`
|
||||
return `${Math.round(minutes / 60)} 小时`
|
||||
const hours = Math.floor(minutes / 60)
|
||||
const remainder = minutes % 60
|
||||
return remainder ? `${hours} 小时 ${remainder} 分钟` : `${hours} 小时`
|
||||
}
|
||||
|
||||
export function shortId(value: string): string {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue"
|
||||
import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue"
|
||||
import "./styles/tokens.css"
|
||||
import "./styles/workbench.css"
|
||||
import AppNavigationRail from "./components/AppNavigationRail.vue"
|
||||
import ConfirmDialog from "./components/ConfirmDialog.vue"
|
||||
import EmptyState from "./components/EmptyState.vue"
|
||||
|
|
@ -10,22 +12,22 @@ import MaterialOperationDialog from "./components/MaterialOperationDialog.vue"
|
|||
import { MATERIAL_BODY_SLOT_OPTIONS } from "./material-labels"
|
||||
import MetricCardGrid from "./components/MetricCardGrid.vue"
|
||||
import StateCard from "./components/StateCard.vue"
|
||||
import AdvancedMaterialImportPage from "./features/materials/AdvancedMaterialImportPage.vue"
|
||||
const AdvancedMaterialImportPage = defineAsyncComponent(() => import("./features/materials/AdvancedMaterialImportPage.vue"))
|
||||
import {
|
||||
parseMaterialLibraryView,
|
||||
type MaterialLibraryView,
|
||||
} from "./features/materials/advanced-material-state"
|
||||
import GalleryPage from "./features/gallery/GalleryPage.vue"
|
||||
const GalleryPage = defineAsyncComponent(() => import("./features/gallery/GalleryPage.vue"))
|
||||
import type { GalleryImage } from "./features/gallery/types"
|
||||
import LogsPage from "./features/logs/LogsPage.vue"
|
||||
const LogsPage = defineAsyncComponent(() => import("./features/logs/LogsPage.vue"))
|
||||
import { navItems, visibleNavItems } from "./features/navigation/navigation-config"
|
||||
import {
|
||||
profileGenerationKind,
|
||||
type ProfileGenerationKind,
|
||||
} from "./features/profiles/profile-ui"
|
||||
import ProfilesPage from "./features/profiles/ProfilesPage.vue"
|
||||
const ProfilesPage = defineAsyncComponent(() => import("./features/profiles/ProfilesPage.vue"))
|
||||
import type { ProfileImageTarget } from "./features/profiles/types"
|
||||
import SettingsPage from "./features/settings/SettingsPage.vue"
|
||||
const SettingsPage = defineAsyncComponent(() => import("./features/settings/SettingsPage.vue"))
|
||||
import {
|
||||
cleanImportedProfileValue,
|
||||
createDefaultQuickProfileQuestionnaire,
|
||||
|
|
@ -34,14 +36,14 @@ import {
|
|||
type ExternalProfileImportDraft,
|
||||
type QuickProfileQuestionnaire,
|
||||
} from "./features/quick-profile/profile-import"
|
||||
import WorkflowCompareDialog from "./features/workflow/WorkflowCompareDialog.vue"
|
||||
import WorkflowBranchPanel from "./features/workflow/WorkflowBranchPanel.vue"
|
||||
import WorkflowCandidatePool from "./features/workflow/WorkflowCandidatePool.vue"
|
||||
import WorkflowComposer from "./features/workflow/WorkflowComposer.vue"
|
||||
import WorkflowDependencyContextCard from "./features/workflow/WorkflowDependencyContextCard.vue"
|
||||
import WorkflowGenerationReviewDialog from "./features/workflow/WorkflowGenerationReviewDialog.vue"
|
||||
import WorkflowMaterialDrawer from "./features/workflow/WorkflowMaterialDrawer.vue"
|
||||
import WorkflowRoundPanel from "./features/workflow/WorkflowRoundPanel.vue"
|
||||
const WorkflowCompareDialog = defineAsyncComponent(() => import("./features/workflow/WorkflowCompareDialog.vue"))
|
||||
const WorkflowBranchPanel = defineAsyncComponent(() => import("./features/workflow/WorkflowBranchPanel.vue"))
|
||||
const WorkflowCandidatePool = defineAsyncComponent(() => import("./features/workflow/WorkflowCandidatePool.vue"))
|
||||
const WorkflowComposer = defineAsyncComponent(() => import("./features/workflow/WorkflowComposer.vue"))
|
||||
const WorkflowDependencyContextCard = defineAsyncComponent(() => import("./features/workflow/WorkflowDependencyContextCard.vue"))
|
||||
const WorkflowGenerationReviewDialog = defineAsyncComponent(() => import("./features/workflow/WorkflowGenerationReviewDialog.vue"))
|
||||
const WorkflowMaterialDrawer = defineAsyncComponent(() => import("./features/workflow/WorkflowMaterialDrawer.vue"))
|
||||
const WorkflowRoundPanel = defineAsyncComponent(() => import("./features/workflow/WorkflowRoundPanel.vue"))
|
||||
import {
|
||||
CHARACTER_WORKFLOW_PREVIEW_NODE_SPECS,
|
||||
canonicalCharacterWorkflowNodeKey,
|
||||
|
|
@ -3311,7 +3313,7 @@ const selectedQueueJobRows = computed<QueueDetailRow[]>(() => {
|
|||
{ label: "状态", value: statusLabel(job.status) },
|
||||
{ label: "模型路由", value: job.model_route || "-" },
|
||||
{ label: "进度", value: `${progressValue(job)}%` },
|
||||
{ label: "等待时间", value: waitTime(job) },
|
||||
{ label: "耗时 / 后端时限", value: waitTime(job) },
|
||||
{ label: "角色", value: context.profileName || "未关联角色" },
|
||||
{ label: "工作流", value: context.workflowName || "未关联工作流" },
|
||||
{ label: "节点", value: context.nodeName || "未关联节点" },
|
||||
|
|
@ -3363,6 +3365,20 @@ const queueActionCards = computed<QueueActionCard[]>(() => {
|
|||
!executingId && job && canWrite && canRetry && failedJobs.value.some((item) => item.task_id === job.task_id),
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "retry-all-failed",
|
||||
title: "一键重试全部失败任务",
|
||||
detail: !canManageQueue
|
||||
? "当前账号缺少任务重试权限。"
|
||||
: failedJobs.value.length
|
||||
? `当前检测到 ${failedJobs.value.length} 条失败、取消或死信记录;将逐条创建替代任务,旧记录会标记为已被重试替代。`
|
||||
: "当前没有可重试的失败、取消或死信记录。",
|
||||
badge: "BATCH",
|
||||
endpoint: endpoints.jobRetryFailed,
|
||||
action: executingId === "retry-all-failed" ? "批量处理中" : "一键重试全部",
|
||||
tone: "warn",
|
||||
enabled: Boolean(!executingId && canWrite && canRetry && failedJobs.value.length > 0),
|
||||
},
|
||||
{
|
||||
id: "cancel",
|
||||
title: "取消运行任务",
|
||||
|
|
@ -10201,7 +10217,7 @@ async function executeQueueAction(actionId: string, taskId?: string) {
|
|||
bootstrap.value?.permissions.can_write && bootstrap.value?.permissions.can_retry_tasks,
|
||||
)
|
||||
|
||||
if (["delete", "clear-failed", "clear-completed", "clear-terminal"].includes(actionId) && !canManageQueue) {
|
||||
if (["delete", "retry-all-failed", "clear-failed", "clear-completed", "clear-terminal"].includes(actionId) && !canManageQueue) {
|
||||
jobsError.value = "当前账号缺少任务清理权限,请刷新页面后重试。"
|
||||
return
|
||||
}
|
||||
|
|
@ -10212,6 +10228,10 @@ async function executeQueueAction(actionId: string, taskId?: string) {
|
|||
jobsError.value = "目标任务已不存在或状态已经变化,只有失败、取消、死信和已完成记录可以删除。"
|
||||
return
|
||||
}
|
||||
if (actionId === "retry-all-failed" && failedJobs.value.length === 0) {
|
||||
jobsError.value = "当前已经没有可重试的失败、取消或死信记录。"
|
||||
return
|
||||
}
|
||||
if (actionId === "clear-failed" && failedJobs.value.length === 0) {
|
||||
jobsError.value = "当前已经没有可清理的异常记录。"
|
||||
return
|
||||
|
|
@ -10232,6 +10252,9 @@ async function executeQueueAction(actionId: string, taskId?: string) {
|
|||
const retried = await postJson<GenerationJob>(endpoints.jobRetry(job.task_id), {})
|
||||
selectedQueueTaskId.value = retried.task_id
|
||||
queueActionMessage.value = `替代任务 ${shortId(retried.task_id)} 已执行,状态:${statusLabel(retried.status)}。`
|
||||
} else if (actionId === "retry-all-failed") {
|
||||
const result = await postJson<Record<string, unknown>>(endpoints.jobRetryFailed, { limit: 100 })
|
||||
queueActionMessage.value = queueBatchActionMessage(result, "失败任务已批量重试")
|
||||
} else if (actionId === "cancel") {
|
||||
if (!job) return
|
||||
const cancelled = await postJson<GenerationJob>(endpoints.jobCancel(job.task_id), {})
|
||||
|
|
@ -10840,7 +10863,7 @@ function displayMediaUrl(rawUrl?: string | null): string {
|
|||
}
|
||||
|
||||
// AstrBot's sandbox bridge carries the dashboard login state. A direct
|
||||
// <img> request cannot add that credential and is rejected with HTTP 401,
|
||||
// Direct image requests cannot add the bridge credential and are rejected.
|
||||
// so avoid rendering the known-broken URL while its Blob is being loaded.
|
||||
return getApiTransport() === "plugin-bridge" ? "" : value
|
||||
}
|
||||
|
|
@ -11010,6 +11033,7 @@ function errorMessage(err: unknown) {
|
|||
<template>
|
||||
<main
|
||||
class="navigation-shell"
|
||||
aria-label="ImageStudio workbench"
|
||||
:class="{ 'rail-collapsed': !navigationRailExpanded }"
|
||||
:data-theme="themeMode"
|
||||
:style="shellStyle"
|
||||
|
|
@ -11026,7 +11050,7 @@ function errorMessage(err: unknown) {
|
|||
@togglePinned="toggleNavigationRailPinned"
|
||||
/>
|
||||
|
||||
<section class="workbench">
|
||||
<section class="workbench" aria-label="ImageStudio workspace">
|
||||
<header class="topbar">
|
||||
<div class="active-heading">
|
||||
<span>{{ activeItem.label }}</span>
|
||||
|
|
@ -11037,6 +11061,7 @@ function errorMessage(err: unknown) {
|
|||
<span aria-hidden="true">⌕</span>
|
||||
<input
|
||||
ref="searchInputRef"
|
||||
aria-label="Search ImageStudio"
|
||||
v-model="searchQuery"
|
||||
type="search"
|
||||
role="combobox"
|
||||
|
|
@ -11187,6 +11212,7 @@ function errorMessage(err: unknown) {
|
|||
v-if="showBackendConnectionBanner"
|
||||
:class="['backend-connection-banner', backendConnectionClass]"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div>
|
||||
<strong>{{ backendConnection.title }}</strong>
|
||||
|
|
@ -11420,7 +11446,8 @@ function errorMessage(err: unknown) {
|
|||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<span v-if="imageGenerationSubmitting" class="model-state" role="status">生成中</span>
|
||||
<span v-if="imageGenerationSubmitting" class="model-state" role="status"
|
||||
aria-live="polite">生成中</span>
|
||||
<span v-else-if="imageGenerationError" class="model-state model-state-error" role="alert">
|
||||
{{ imageGenerationError }}
|
||||
</span>
|
||||
|
|
@ -11810,7 +11837,8 @@ function errorMessage(err: unknown) {
|
|||
<span v-else class="feature-action">{{ quickProfileActionButtonLabel(card) }}</span>
|
||||
</article>
|
||||
</div>
|
||||
<p v-if="quickCharacterGenerationNotice" class="generation-notice" role="status">
|
||||
<p v-if="quickCharacterGenerationNotice" class="generation-notice" role="status"
|
||||
aria-live="polite">
|
||||
{{ quickCharacterGenerationNotice }}
|
||||
</p>
|
||||
<p v-if="quickCharacterGenerationError" class="generation-error" role="alert">
|
||||
|
|
@ -13538,7 +13566,7 @@ function errorMessage(err: unknown) {
|
|||
<li v-for="job in overviewQueueItems" :key="job.task_id">
|
||||
<div class="queue-main">
|
||||
<strong>{{ jobTitle(job) }}</strong>
|
||||
<small>{{ job.model_route || "未指定模型" }} / 等待 {{ waitTime(job) }}</small>
|
||||
<small>{{ job.model_route || "未指定模型" }} / 耗时 {{ waitTime(job) }}</small>
|
||||
<div class="progress-track">
|
||||
<span :style="{ width: `${progressValue(job)}%` }" />
|
||||
</div>
|
||||
|
|
@ -17516,7 +17544,7 @@ body {
|
|||
height: 100%;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(90deg, var(--primary), var(--accent));
|
||||
transition: width 220ms ease;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.workflow-node-card.done .workflow-node-progress i {
|
||||
|
|
@ -18395,8 +18423,8 @@ body {
|
|||
}
|
||||
|
||||
.workflow-draft-grid > article.final {
|
||||
border-color: var(--accent);
|
||||
box-shadow: inset 0 3px 0 var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
|
||||
background: color-mix(in srgb, var(--accent) 10%, var(--panel-muted));
|
||||
}
|
||||
|
||||
.workflow-draft-select {
|
||||
|
|
@ -18614,15 +18642,15 @@ body {
|
|||
}
|
||||
|
||||
.workflow-action-card.accent {
|
||||
border-top-color: var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
|
||||
}
|
||||
|
||||
.workflow-action-card.warn {
|
||||
border-top-color: var(--warn);
|
||||
border-color: color-mix(in srgb, var(--warn) 52%, var(--border));
|
||||
}
|
||||
|
||||
.workflow-action-card.neutral {
|
||||
border-top-color: var(--neutral);
|
||||
border-color: color-mix(in srgb, var(--neutral) 52%, var(--border));
|
||||
}
|
||||
|
||||
.workflow-action-card.disabled {
|
||||
|
|
@ -19937,7 +19965,7 @@ body {
|
|||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
padding-right: 4px;
|
||||
transition: max-height 240ms var(--rail-ease);
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.quick-profile-material-picker-list.accessory {
|
||||
|
|
@ -20105,7 +20133,6 @@ body {
|
|||
min-height: 134px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border);
|
||||
border-top: 3px solid var(--primary);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
background: var(--panel-muted);
|
||||
|
|
@ -20113,15 +20140,15 @@ body {
|
|||
}
|
||||
|
||||
.quick-profile-command-card.accent {
|
||||
border-top-color: var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
|
||||
}
|
||||
|
||||
.quick-profile-command-card.warn {
|
||||
border-top-color: var(--warn);
|
||||
border-color: color-mix(in srgb, var(--warn) 52%, var(--border));
|
||||
}
|
||||
|
||||
.quick-profile-command-card.neutral {
|
||||
border-top-color: var(--neutral);
|
||||
border-color: color-mix(in srgb, var(--neutral) 52%, var(--border));
|
||||
}
|
||||
|
||||
.quick-profile-command-card.disabled {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue"
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue"
|
||||
|
||||
import { createSafeBackdropClose } from "../safe-backdrop-close"
|
||||
|
||||
|
|
@ -23,6 +23,8 @@ const scale = ref(1)
|
|||
const offset = ref({ x: 0, y: 0 })
|
||||
const dragging = ref(false)
|
||||
const dragStart = ref({ pointerId: -1, x: 0, y: 0, offsetX: 0, offsetY: 0 })
|
||||
const dialogRef = ref<HTMLElement | null>(null)
|
||||
let previousFocus: HTMLElement | null = null
|
||||
|
||||
const scaleLabel = computed(() => `${Math.round(scale.value * 100)}%`)
|
||||
const imageTransform = computed(
|
||||
|
|
@ -31,7 +33,16 @@ const imageTransform = computed(
|
|||
|
||||
watch(
|
||||
() => [props.open, props.src] as const,
|
||||
() => reset(),
|
||||
([open]) => {
|
||||
reset()
|
||||
if (open) {
|
||||
previousFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null
|
||||
void nextTick(() => focusableElements()[0]?.focus())
|
||||
} else {
|
||||
void nextTick(restoreFocus)
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
onMounted(() => window.addEventListener("keydown", handleEscape))
|
||||
|
|
@ -102,6 +113,39 @@ function endDrag(event: PointerEvent) {
|
|||
}
|
||||
}
|
||||
|
||||
function focusableElements() {
|
||||
return Array.from(
|
||||
dialogRef.value?.querySelectorAll<HTMLElement>(
|
||||
'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',
|
||||
) ?? [],
|
||||
).filter((element) => !element.hasAttribute("hidden"))
|
||||
}
|
||||
|
||||
function trapFocus(event: KeyboardEvent) {
|
||||
if (event.key !== "Tab") return
|
||||
const elements = focusableElements()
|
||||
if (!elements.length) {
|
||||
event.preventDefault()
|
||||
dialogRef.value?.focus()
|
||||
return
|
||||
}
|
||||
const first = elements[0]
|
||||
const last = elements[elements.length - 1]
|
||||
if (event.shiftKey && document.activeElement === first) {
|
||||
event.preventDefault()
|
||||
last.focus()
|
||||
} else if (!event.shiftKey && document.activeElement === last) {
|
||||
event.preventDefault()
|
||||
first.focus()
|
||||
}
|
||||
}
|
||||
|
||||
function restoreFocus() {
|
||||
const target = previousFocus
|
||||
previousFocus = null
|
||||
if (target?.isConnected) target.focus()
|
||||
}
|
||||
|
||||
function handleEscape(event: KeyboardEvent) {
|
||||
if (props.open && event.key === "Escape") close()
|
||||
}
|
||||
|
|
@ -125,7 +169,7 @@ function clamp(value: number, min: number, max: number) {
|
|||
@pointercancel="backdropClose.pointerCancel"
|
||||
@wheel.prevent="zoomFromWheel"
|
||||
>
|
||||
<section class="image-viewer-card" data-overlay-root="imageViewer">
|
||||
<section ref="dialogRef" class="image-viewer-card" data-overlay-root="imageViewer" tabindex="-1" @keydown="trapFocus">
|
||||
<header>
|
||||
<div>
|
||||
<span>图片预览</span>
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ async function runBatch(action:"select"|"unselect"|"archive"|"delete"|"permanent
|
|||
<section class="gallery-toolbar" aria-label="图库筛选">
|
||||
<label class="gallery-search">
|
||||
<span aria-hidden="true">⌕</span>
|
||||
<input v-model="query" type="search" placeholder="搜索标题、提示词、模型或来源" />
|
||||
<input id="gallery-search" v-model="query" type="search" aria-label="Search gallery" placeholder="搜索标题、提示词、模型或来源" />
|
||||
</label>
|
||||
<div class="gallery-filter-tabs" role="group" aria-label="图片状态">
|
||||
<button
|
||||
|
|
@ -211,7 +211,7 @@ async function runBatch(action:"select"|"unselect"|"archive"|"delete"|"permanent
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<section class="gallery-batchbar"><label><input type="checkbox" :checked="filteredImages.length>0&&filteredImages.filter(image=>!isSample(image)).every(image=>checkedIds.includes(image.image_id))" @change="toggleAllVisible"><span>已选 {{checkedIds.length}} 张</span></label><div><span v-if="actionMessage">{{actionMessage}}</span><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('select')">标记选中</button><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('unselect')">取消选中</button><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('archive')">归档</button><button class="danger" :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('delete')">安全删除</button><button class="danger" :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('permanent')">永久删除</button></div></section>
|
||||
<section class="gallery-batchbar" aria-label="Gallery batch actions"><label><input type="checkbox" aria-label="Select all visible images" :checked="filteredImages.length>0&&filteredImages.filter(image=>!isSample(image)).every(image=>checkedIds.includes(image.image_id))" @change="toggleAllVisible"><span>已选 {{checkedIds.length}} 张</span></label><div class="gallery-batch-actions"><span v-if="actionMessage" aria-live="polite">{{actionMessage}}</span><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('select')">标记选中</button><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('unselect')">取消选中</button><button :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('archive')">归档</button><button class="danger" :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('delete')">安全删除</button><button class="danger" :disabled="!checkedIds.length||actionBusy||!backendConnected" @click="runBatch('permanent')">永久删除</button></div></section>
|
||||
|
||||
<section class="gallery-workspace">
|
||||
<div class="gallery-results">
|
||||
|
|
@ -237,7 +237,7 @@ async function runBatch(action:"select"|"unselect"|"archive"|"delete"|"permanent
|
|||
:key="image.image_id"
|
||||
:class="['gallery-card', { active: selectedImage?.image_id === image.image_id, archived: isArchived(image) }]"
|
||||
>
|
||||
<label v-if="!isSample(image)" class="gallery-card-check"><input type="checkbox" :checked="checkedIds.includes(image.image_id)" @change="toggleChecked(image.image_id)"><span></span></label>
|
||||
<label v-if="!isSample(image)" class="gallery-card-check"><input type="checkbox" :aria-label="`Select ${image.title}`" :checked="checkedIds.includes(image.image_id)" @change="toggleChecked(image.image_id)"><span></span></label>
|
||||
<button
|
||||
type="button"
|
||||
class="gallery-card-media"
|
||||
|
|
@ -964,4 +964,280 @@ async function runBatch(action:"select"|"unselect"|"archive"|"delete"|"permanent
|
|||
min-height: 30px;
|
||||
}
|
||||
}
|
||||
.gallery-page {
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.gallery-hero,
|
||||
.gallery-toolbar,
|
||||
.gallery-results,
|
||||
.gallery-inspector,
|
||||
.gallery-load-notice,
|
||||
.gallery-metrics article {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 24px color-mix(in srgb, var(--bg) 18%, transparent);
|
||||
}
|
||||
|
||||
.gallery-hero {
|
||||
align-items: flex-start;
|
||||
padding: 24px;
|
||||
background:
|
||||
linear-gradient(120deg, color-mix(in srgb, var(--primary-soft) 72%, var(--panel)), var(--panel) 62%);
|
||||
}
|
||||
|
||||
.gallery-hero h2 {
|
||||
font-size: clamp(24px, 2.2vw, 30px);
|
||||
letter-spacing: -0.025em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.gallery-hero p {
|
||||
max-width: 62ch;
|
||||
}
|
||||
|
||||
.gallery-toolbar {
|
||||
gap: 14px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.gallery-search,
|
||||
.gallery-filter-tabs button,
|
||||
.gallery-view-switch button,
|
||||
.gallery-hero-actions button,
|
||||
.gallery-card-actions button,
|
||||
.gallery-inspector-actions button,
|
||||
.gallery-empty button {
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.gallery-search input:focus-visible,
|
||||
.gallery-filter-tabs button:focus-visible,
|
||||
.gallery-view-switch button:focus-visible,
|
||||
.gallery-hero-actions button:focus-visible,
|
||||
.gallery-card-actions button:focus-visible,
|
||||
.gallery-inspector-actions button:focus-visible,
|
||||
.gallery-empty button:focus-visible,
|
||||
.gallery-batchbar button:focus-visible,
|
||||
.gallery-card:focus-visible,
|
||||
.gallery-inspector-media:focus-visible {
|
||||
outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.gallery-metrics {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.gallery-metrics article {
|
||||
gap: 8px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.gallery-metrics strong {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.gallery-results {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.gallery-results-header {
|
||||
align-items: flex-start;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.gallery-results-header h3,
|
||||
.gallery-inspector h3 {
|
||||
font-size: 18px;
|
||||
letter-spacing: -0.015em;
|
||||
}
|
||||
|
||||
.gallery-grid {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.gallery-card {
|
||||
border-radius: 10px;
|
||||
background: var(--panel-muted);
|
||||
transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
|
||||
}
|
||||
|
||||
.gallery-card:hover,
|
||||
.gallery-card:focus-within {
|
||||
border-color: color-mix(in srgb, var(--primary) 44%, var(--border));
|
||||
background: color-mix(in srgb, var(--primary-soft) 22%, var(--panel-muted));
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.gallery-card-media {
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.gallery-empty {
|
||||
min-height: 300px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.gallery-skeleton-grid span {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.gallery-card,
|
||||
.gallery-skeleton-grid span {
|
||||
animation: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
.gallery-page {
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.gallery-hero,
|
||||
.gallery-toolbar,
|
||||
.gallery-results,
|
||||
.gallery-inspector,
|
||||
.gallery-load-notice,
|
||||
.gallery-metrics article,
|
||||
.gallery-batchbar {
|
||||
border-radius: 10px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.gallery-hero {
|
||||
align-items: flex-start;
|
||||
padding: 22px 24px;
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.gallery-hero h2 {
|
||||
font-size: clamp(24px, 2.2vw, 30px);
|
||||
letter-spacing: -0.025em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.gallery-hero p {
|
||||
max-width: 62ch;
|
||||
}
|
||||
|
||||
.gallery-toolbar {
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.gallery-search,
|
||||
.gallery-filter-tabs button,
|
||||
.gallery-view-switch button,
|
||||
.gallery-hero-actions button,
|
||||
.gallery-card-actions button,
|
||||
.gallery-inspector-actions button,
|
||||
.gallery-empty button,
|
||||
.gallery-batchbar button {
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.gallery-search input:focus-visible,
|
||||
.gallery-filter-tabs button:focus-visible,
|
||||
.gallery-view-switch button:focus-visible,
|
||||
.gallery-hero-actions button:focus-visible,
|
||||
.gallery-card-actions button:focus-visible,
|
||||
.gallery-inspector-actions button:focus-visible,
|
||||
.gallery-empty button:focus-visible,
|
||||
.gallery-batchbar button:focus-visible,
|
||||
.gallery-card-check input:focus-visible,
|
||||
.gallery-card-media:focus-visible,
|
||||
.gallery-card-copy:focus-visible,
|
||||
.gallery-inspector-media:focus-visible {
|
||||
outline: 2px solid var(--primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.gallery-metrics {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.gallery-metrics article {
|
||||
gap: 8px;
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.gallery-metrics strong {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.gallery-batchbar {
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.gallery-batch-actions {
|
||||
min-width: 0;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.gallery-batch-actions span {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.gallery-results {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.gallery-results-header {
|
||||
align-items: flex-start;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.gallery-results-header h3,
|
||||
.gallery-inspector h3 {
|
||||
font-size: 18px;
|
||||
letter-spacing: -0.015em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.gallery-grid {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.gallery-card {
|
||||
border-radius: 10px;
|
||||
background: var(--panel-muted);
|
||||
transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
|
||||
}
|
||||
|
||||
.gallery-card:hover,
|
||||
.gallery-card:focus-within {
|
||||
border-color: color-mix(in srgb, var(--primary) 44%, var(--border));
|
||||
background: color-mix(in srgb, var(--primary-soft) 22%, var(--panel-muted));
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.gallery-card-media {
|
||||
border-radius: 7px;
|
||||
}
|
||||
|
||||
.gallery-empty {
|
||||
min-height: 300px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.gallery-skeleton-grid span {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.gallery-batch-actions {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.gallery-card,
|
||||
.gallery-skeleton-grid span {
|
||||
animation: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ const materials = ref<AdvancedMaterial[]>([])
|
|||
const attempts = ref<AdvancedMaterialValidationAttempt[]>([])
|
||||
const selectedImportId = ref("")
|
||||
const selectedImportDetail = ref<AdvancedMaterialImport | null>(null)
|
||||
const reviewWorkbenchOpen = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const actionBusy = ref("")
|
||||
|
|
@ -83,6 +84,9 @@ const validationInstructionText = ref("")
|
|||
const decisionNotes = ref("")
|
||||
const fidelityPercent = ref(85)
|
||||
const acceptConfirmed = ref(false)
|
||||
const validationReferenceEnabled = ref(true)
|
||||
const consensusAnalysisStrategy = ref<"text_only" | "vision_assisted">("text_only")
|
||||
const validationReferenceSourceId = ref("")
|
||||
|
||||
let pollTimer = 0
|
||||
const ownedMediaObjectUrls = new Set<string>()
|
||||
|
|
@ -97,7 +101,8 @@ const selectedUploadCategory = computed(() =>
|
|||
)
|
||||
const styleSetUploadEnabled = computed(() => isStyleCategory(selectedUploadCategory.value))
|
||||
|
||||
const sortedImports = computed(() => sortAdvancedImports(imports.value))
|
||||
const isVisibleImport = (item: AdvancedMaterialImport) => !["accepted", "archived"].includes(normalizeStatus(item.status))
|
||||
const sortedImports = computed(() => sortAdvancedImports(imports.value.filter(isVisibleImport)))
|
||||
const sortedMaterials = computed(() => sortAdvancedMaterials(materials.value))
|
||||
const selectedImport = computed(() =>
|
||||
selectedImportDetail.value?.import_id === selectedImportId.value
|
||||
|
|
@ -119,6 +124,23 @@ const activeStyleSources = computed(() => styleSources.value.filter((source) =>
|
|||
const recognizedStyleSources = computed(() =>
|
||||
activeStyleSources.value.filter((source) => ["recognized", "completed", "succeeded"].includes(normalizeStatus(source.status))),
|
||||
)
|
||||
|
||||
const defaultValidationReferenceSourceId = computed(() => {
|
||||
const representatives = styleConsensus.value?.representative_source_ids ?? []
|
||||
const activeIds = new Set(recognizedStyleSources.value.map((source) => source.source_id))
|
||||
const fromRepresentative = representatives.find((sourceId) => activeIds.has(sourceId))
|
||||
if (fromRepresentative) return fromRepresentative
|
||||
const primary = recognizedStyleSources.value.find((source) => source.is_primary)
|
||||
return primary?.source_id || recognizedStyleSources.value[0]?.source_id || ""
|
||||
})
|
||||
|
||||
const effectiveValidationReferenceSourceId = computed(() => {
|
||||
if (!validationReferenceEnabled.value) return ""
|
||||
const selected = validationReferenceSourceId.value
|
||||
if (selected && recognizedStyleSources.value.some((source) => source.source_id === selected)) return selected
|
||||
return defaultValidationReferenceSourceId.value
|
||||
})
|
||||
|
||||
const styleConsensus = computed(() => selectedImport.value?.consensus ?? null)
|
||||
const styleValidationCases = computed(() => {
|
||||
const cases = currentAttempt.value?.validation_cases?.length
|
||||
|
|
@ -290,13 +312,18 @@ async function refreshAll(silent = false) {
|
|||
: Promise.resolve({ items: [] }),
|
||||
getJson<unknown>(endpoints.advancedMaterials, { page: 1, page_size: 100 }),
|
||||
])
|
||||
imports.value = listItems<AdvancedMaterialImport>(importPayload).map(normalizeImport)
|
||||
imports.value = listItems<AdvancedMaterialImport>(importPayload).map(normalizeImport).filter(isVisibleImport)
|
||||
materials.value = listItems<AdvancedMaterial>(materialPayload).map(normalizeMaterial)
|
||||
await resolveRecordMedia([...imports.value, ...materials.value])
|
||||
|
||||
if (selectedImportId.value) {
|
||||
const exists = imports.value.some((item) => item.import_id === selectedImportId.value)
|
||||
if (exists) await loadImportDetail(selectedImportId.value, true)
|
||||
else {
|
||||
selectedImportId.value = ""
|
||||
selectedImportDetail.value = null
|
||||
if (sortedImports.value.length) await selectImport(sortedImports.value[0].import_id)
|
||||
}
|
||||
} else if (sortedImports.value.length) {
|
||||
await selectImport(sortedImports.value[0].import_id)
|
||||
}
|
||||
|
|
@ -336,8 +363,8 @@ async function pollActiveState() {
|
|||
async function refreshImportSummaries() {
|
||||
if (!props.canManage) return
|
||||
const payload = await getJson<unknown>(endpoints.advancedMaterialImports, { page: 1, page_size: 100 })
|
||||
const nextItems = listItems<AdvancedMaterialImport>(payload).map(normalizeImport)
|
||||
imports.value = mergeImportSummaries(imports.value, nextItems)
|
||||
const nextItems = listItems<AdvancedMaterialImport>(payload).map(normalizeImport).filter(isVisibleImport)
|
||||
imports.value = mergeImportSummaries(imports.value, nextItems).filter(isVisibleImport)
|
||||
const selectedSummary = imports.value.find((item) => item.import_id === selectedImportId.value)
|
||||
if (selectedImportDetail.value && selectedSummary) {
|
||||
selectedImportDetail.value = preserveStableMedia(selectedImportDetail.value, {
|
||||
|
|
@ -347,6 +374,10 @@ async function refreshImportSummaries() {
|
|||
consensus: selectedImportDetail.value.consensus,
|
||||
validation_cases: selectedImportDetail.value.validation_cases,
|
||||
})
|
||||
} else if (selectedImportId.value && !selectedSummary) {
|
||||
selectedImportId.value = ""
|
||||
selectedImportDetail.value = null
|
||||
if (sortedImports.value.length) await selectImport(sortedImports.value[0].import_id)
|
||||
}
|
||||
await resolveRecordMedia(imports.value)
|
||||
}
|
||||
|
|
@ -354,6 +385,7 @@ async function refreshImportSummaries() {
|
|||
async function selectImport(importId: string) {
|
||||
deleteConfirmImportId.value = ""
|
||||
selectedImportId.value = importId
|
||||
reviewWorkbenchOpen.value = false
|
||||
await loadImportDetail(importId)
|
||||
}
|
||||
|
||||
|
|
@ -662,10 +694,18 @@ async function createStyleConsensus() {
|
|||
error.value = ""
|
||||
message.value = ""
|
||||
try {
|
||||
const referenceSourceId = effectiveValidationReferenceSourceId.value
|
||||
await postJson<unknown>(endpoints.advancedMaterialStyleConsensus(item.import_id), {
|
||||
included_source_ids: recognizedStyleSources.value.map((source) => source.source_id),
|
||||
analysis_strategy: consensusAnalysisStrategy.value,
|
||||
validation_reference_enabled: validationReferenceEnabled.value,
|
||||
...(validationReferenceEnabled.value && referenceSourceId
|
||||
? { validation_reference_source_id: referenceSourceId }
|
||||
: {}),
|
||||
})
|
||||
message.value = "画风交叉分析已入队;模型会同时读取所有有效原图与逐图报告。"
|
||||
message.value = validationReferenceEnabled.value
|
||||
? "画风交叉分析已入队;验证轮将附带 1 张风格参考图。"
|
||||
: "画风交叉分析已入队;验证轮保持纯文本迁移。"
|
||||
await loadImportDetail(item.import_id, true)
|
||||
} catch (err) {
|
||||
error.value = errorMessage(err)
|
||||
|
|
@ -731,6 +771,7 @@ async function rejectAndRegenerate() {
|
|||
error.value = ""
|
||||
message.value = ""
|
||||
try {
|
||||
const referenceSourceId = effectiveValidationReferenceSourceId.value
|
||||
const payload: AdvancedMaterialDecisionRequest = {
|
||||
adjustment_text: selectedStyleSet.value ? undefined : adjustment,
|
||||
style_adjustment_text: selectedStyleSet.value ? adjustment || undefined : undefined,
|
||||
|
|
@ -738,6 +779,14 @@ async function rejectAndRegenerate() {
|
|||
fidelity_score: fidelityPercent.value / 100,
|
||||
decision_notes: decisionNotes.value.trim() || undefined,
|
||||
reuse_validation_scenarios: selectedStyleSet.value && !validationInstruction || undefined,
|
||||
...(selectedStyleSet.value
|
||||
? {
|
||||
validation_reference_enabled: validationReferenceEnabled.value,
|
||||
...(validationReferenceEnabled.value && referenceSourceId
|
||||
? { validation_reference_source_id: referenceSourceId }
|
||||
: {}),
|
||||
}
|
||||
: {}),
|
||||
}
|
||||
await postJson<unknown>(endpoints.advancedMaterialAttemptReject(item.import_id, attempt.attempt_id), payload)
|
||||
message.value = "本轮反馈已保存,调整后的下一轮验证图已加入队列。"
|
||||
|
|
@ -1221,6 +1270,21 @@ function styleValidationFidelityPercent(validationCase: AdvancedStyleValidationC
|
|||
return Number.isFinite(score) ? Math.max(0, Math.min(100, Math.round(score * 100))) : null
|
||||
}
|
||||
|
||||
function styleValidationReviewTrust(validationCase: AdvancedStyleValidationCase) {
|
||||
const review = validationCase.style_review && typeof validationCase.style_review === "object"
|
||||
? validationCase.style_review as Record<string, any>
|
||||
: {}
|
||||
const calibration = review.score_calibration && typeof review.score_calibration === "object"
|
||||
? review.score_calibration as Record<string, any>
|
||||
: {}
|
||||
const coverage = Number(calibration.dimension_coverage)
|
||||
const inconsistent = Boolean(calibration.review_inconsistent || calibration.dimension_consistency_capped)
|
||||
const risks = Array.isArray(review.semantic_risks) && review.semantic_risks.length > 0
|
||||
if (inconsistent || risks) return "????????????????"
|
||||
if (Number.isFinite(coverage)) return `????? ? ???? ${Math.round(coverage * 100)}%`
|
||||
return "?????"
|
||||
}
|
||||
|
||||
function styleValidationReviewSummary(validationCase: AdvancedStyleValidationCase) {
|
||||
const review = validationCase.style_review && typeof validationCase.style_review === "object"
|
||||
? validationCase.style_review
|
||||
|
|
@ -1436,6 +1500,7 @@ function errorMessage(err: unknown) {
|
|||
<p>{{ categoryName(selectedImport.category_id) }} · 导入于 {{ formatDate(selectedImport.created_at) }}</p>
|
||||
</div>
|
||||
<div class="advanced-review-header-actions">
|
||||
<button type="button" @click="reviewWorkbenchOpen = !reviewWorkbenchOpen">{{ reviewWorkbenchOpen ? "收起工作台" : "展开工作台" }}</button>
|
||||
<div :class="['advanced-status-chip', selectedStatus.tone]"><i /><span><strong>{{ selectedStatus.label }}</strong><small>{{ selectedStatus.detail }}</small></span></div>
|
||||
<button
|
||||
v-if="canManage && !selectedImport.accepted_material_id"
|
||||
|
|
@ -1448,7 +1513,7 @@ function errorMessage(err: unknown) {
|
|||
</header>
|
||||
|
||||
<div v-if="detailLoading" class="advanced-review-loading">正在读取识别结果与验证轮次…</div>
|
||||
<template v-else>
|
||||
<template v-else-if="reviewWorkbenchOpen">
|
||||
<div v-if="importError(selectedImport) || attemptError(currentAttempt)" class="advanced-inline-error">
|
||||
<div><strong>任务错误</strong><span>{{ attemptError(currentAttempt) || importError(selectedImport) }}</span></div>
|
||||
<button
|
||||
|
|
@ -1463,6 +1528,7 @@ function errorMessage(err: unknown) {
|
|||
<article class="advanced-style-stage">
|
||||
<header class="advanced-style-stage-header">
|
||||
<div><span>01 · 并行识别</span><h4>画风样本 {{ recognizedStyleSources.length }}/{{ activeStyleSources.length || styleSources.length }} 已完成</h4><p>每张图片拥有独立任务、计时器和错误;失败不会中断其他样本。</p></div>
|
||||
<label class="advanced-style-analysis-mode"><span>交叉归纳</span><select v-model="consensusAnalysisStrategy" :disabled="Boolean(actionBusy)"><option value="text_only">纯文本(推荐,避免视觉超时)</option><option value="vision_assisted">带图归纳(更强视觉复核)</option></select></label>
|
||||
<button v-if="canRunStyleConsensus" type="button" class="primary" @click="createStyleConsensus">{{ actionBusy === "style-consensus" ? "入队中" : "交叉分析有效样本" }}</button>
|
||||
</header>
|
||||
<div class="advanced-style-source-grid">
|
||||
|
|
@ -1483,6 +1549,33 @@ function errorMessage(err: unknown) {
|
|||
</article>
|
||||
</div>
|
||||
<p v-if="recognizedStyleSources.length < MIN_STYLE_IMAGES" class="advanced-style-stage-tip">至少需要 2 张有效样本才能交叉分析;失败样本可以单独重试或排除。</p>
|
||||
<div v-if="canRunStyleConsensus || canManage" class="advanced-style-reference-picker">
|
||||
<div class="advanced-style-reference-head">
|
||||
<strong>验证参考图</strong>
|
||||
<label class="advanced-style-reference-toggle">
|
||||
<input v-model="validationReferenceEnabled" type="checkbox" :disabled="Boolean(actionBusy)" />
|
||||
<span>第一轮验证附带 1 张源图作风格参考</span>
|
||||
</label>
|
||||
</div>
|
||||
<p class="advanced-style-stage-tip">参考图只提供线稿/配色/眼型等风格语法;不会复制人物身份、服装、姿势或场景。头像/全身/异场景共用同一张。</p>
|
||||
<div v-if="validationReferenceEnabled" class="advanced-style-reference-grid">
|
||||
<button
|
||||
v-for="(source, index) in recognizedStyleSources"
|
||||
:key="`ref:${source.source_id}`"
|
||||
type="button"
|
||||
class="advanced-style-reference-card"
|
||||
:class="{ active: effectiveValidationReferenceSourceId === source.source_id }"
|
||||
:disabled="Boolean(actionBusy)"
|
||||
@click="validationReferenceSourceId = source.source_id"
|
||||
>
|
||||
<img v-if="styleSourceImageUrl(source)" :src="styleSourceImageUrl(source)" :alt="`参考样本 ${index + 1}`" />
|
||||
<span v-else>样本 {{ index + 1 }}</span>
|
||||
<small>{{ source.is_primary ? "主参考" : `样本 ${index + 1}` }}</small>
|
||||
</button>
|
||||
<small v-if="!recognizedStyleSources.length">至少完成 2 张识别后可选择参考图。</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
|
||||
<article class="advanced-style-stage">
|
||||
|
|
@ -1516,8 +1609,9 @@ function errorMessage(err: unknown) {
|
|||
<p>{{ validationCase.content_prompt || "后端将规划与源样本不同、但便于对照的验证角色与场景。" }}</p>
|
||||
<small v-if="validationCase.metadata?.validation_instruction" class="advanced-applied-adjustment">已应用文字调整:{{ validationCase.metadata.validation_instruction }}</small>
|
||||
<small v-if="styleValidationFidelityPercent(validationCase) != null" class="advanced-style-fidelity">自动还原度:{{ styleValidationFidelityPercent(validationCase) }}%</small>
|
||||
<small v-if="styleValidationFidelityPercent(validationCase) != null" class="advanced-style-review-trust">{{ styleValidationReviewTrust(validationCase) }}</small>
|
||||
<small v-if="styleValidationReviewSummary(validationCase)" class="advanced-style-review-summary">{{ styleValidationReviewSummary(validationCase) }}</small>
|
||||
<small>纯文本验证 · {{ Number(validationCase.input_image_count || 0) }} 张参考图 · 种子 {{ validationCase.seed || "自动" }}</small>
|
||||
<small>{{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) > 0 || validationCase.metadata?.reference_image_applied ? "风格参考图验证" : "纯文本验证" }} · {{ Number(validationCase.input_image_count || validationCase.metadata?.input_image_count || 0) }} 张参考图 · 种子 {{ validationCase.seed || "自动" }}</small>
|
||||
<em v-if="advancedMaterialErrorMessage(validationCase.error)">{{ advancedMaterialErrorMessage(validationCase.error) }}</em>
|
||||
</div>
|
||||
<button v-if="normalizeStatus(validationCase.status) === 'failed'" type="button" :disabled="Boolean(actionBusy)" @click="retryStyleValidationCase(validationCase)">{{ actionBusy === `case-retry:${validationCase.case_id}` ? "入队中" : "单独重试" }}</button>
|
||||
|
|
@ -1759,6 +1853,8 @@ button:disabled { cursor: not-allowed; opacity: .52; }
|
|||
.advanced-style-stage { display: grid; gap: 11px; min-width: 0; border: 1px solid var(--border); border-radius: 9px; padding: 11px; background: var(--panel-muted); }
|
||||
.advanced-style-stage-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
|
||||
.advanced-style-stage-header > div { display: grid; gap: 3px; min-width: 0; }
|
||||
.advanced-style-analysis-mode { display: grid; gap: 4px; min-width: 190px; color: var(--text-soft); font-size: 11px; font-weight: 800; }
|
||||
.advanced-style-analysis-mode select { min-height: 30px; border: 1px solid var(--border); border-radius: 7px; padding: 0 8px; color: var(--text); background: var(--panel); font-size: 11px; }
|
||||
.advanced-style-stage-header span { color: var(--primary); font-size: 11px; font-weight: 900; letter-spacing: .04em; }
|
||||
.advanced-style-stage-header h4 { margin: 0; color: var(--text); font-size: 16px; }
|
||||
.advanced-style-stage-header p { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.45; }
|
||||
|
|
@ -1798,6 +1894,7 @@ button:disabled { cursor: not-allowed; opacity: .52; }
|
|||
.advanced-style-validation-copy small { color: var(--accent-strong); font-size: 10px; }
|
||||
.advanced-style-validation-copy .advanced-applied-adjustment { border-left: 2px solid var(--primary); padding-left: 6px; color: var(--primary); line-height: 1.4; }
|
||||
.advanced-style-validation-copy .advanced-style-fidelity { color: var(--text); font-weight: 900; }
|
||||
.advanced-style-validation-copy .advanced-style-review-trust { color: var(--muted-text, var(--text)); }
|
||||
.advanced-style-validation-copy .advanced-style-review-summary { border-left: 2px solid var(--warning, #d89b30); padding-left: 6px; color: var(--text-soft); line-height: 1.4; }
|
||||
.advanced-style-validation-copy em { color: var(--danger); font-size: 10px; font-style: normal; }
|
||||
.advanced-review-controls { gap: 10px; }
|
||||
|
|
@ -1859,4 +1956,15 @@ button:disabled { cursor: not-allowed; opacity: .52; }
|
|||
.advanced-attempt-history > div > article > img, .advanced-attempt-history-images { grid-column: 2; width: 100%; }
|
||||
.advanced-attempt-history > div > article > img { height: 120px; }
|
||||
}
|
||||
|
||||
.advanced-style-reference-picker { display: grid; gap: 8px; min-width: 0; border: 1px dashed var(--border); border-radius: 8px; padding: 10px; background: var(--panel); }
|
||||
.advanced-style-reference-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.advanced-style-reference-head strong { color: var(--text); font-size: 12px; }
|
||||
.advanced-style-reference-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 11px; font-weight: 700; }
|
||||
.advanced-style-reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
|
||||
.advanced-style-reference-card { display: grid; gap: 4px; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 6px; color: var(--text-soft); background: var(--panel-muted); text-align: left; cursor: pointer; }
|
||||
.advanced-style-reference-card.active { border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent); }
|
||||
.advanced-style-reference-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: #111; }
|
||||
.advanced-style-reference-card small { font-size: 10px; font-weight: 800; }
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ function forwardWardrobeAdd(materialId: string, wardrobeCategory: string) {
|
|||
}
|
||||
|
||||
.profile-detail.sealed {
|
||||
box-shadow: inset 0 3px 0 var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
|
||||
}
|
||||
|
||||
.detail-heading,
|
||||
|
|
@ -813,7 +813,7 @@ button.danger-button {
|
|||
}
|
||||
|
||||
.target-selector button.active {
|
||||
box-shadow: inset 3px 0 0 var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
|
||||
}
|
||||
|
||||
.target-thumb {
|
||||
|
|
|
|||
|
|
@ -272,19 +272,19 @@ watch(
|
|||
padding: 10px;
|
||||
text-align: left;
|
||||
background: transparent;
|
||||
box-shadow: inset 3px 0 0 var(--border);
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.profile-list-item.kind-ungenerated {
|
||||
box-shadow: inset 3px 0 0 var(--neutral, #7b8494);
|
||||
border-color: color-mix(in srgb, var(--neutral, #7b8494) 52%, var(--border));
|
||||
}
|
||||
|
||||
.profile-list-item.kind-quick {
|
||||
box-shadow: inset 3px 0 0 var(--warn, #d5963d);
|
||||
border-color: color-mix(in srgb, var(--warn, #d5963d) 52%, var(--border));
|
||||
}
|
||||
|
||||
.profile-list-item.kind-profile_card {
|
||||
box-shadow: inset 3px 0 0 var(--accent);
|
||||
border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
|
||||
}
|
||||
|
||||
.profile-list-item:hover {
|
||||
|
|
|
|||
|
|
@ -44,5 +44,5 @@ const adultUserCount = computed(() => ids("adult_user_allowlist").length)
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
.chat-access{display:grid;gap:14px}.intro{display:grid;gap:5px;border:1px solid var(--border);border-radius:10px;padding:15px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.intro span{color:var(--text-soft);font-size:11px;font-weight:800}.intro p,.rules p{margin:0;color:var(--text-soft);line-height:1.5}.rules,.lists{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.rules article{display:grid;gap:6px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.rules b{color:var(--text-soft);font-size:11px}.rules strong{color:var(--primary)}.lists label{display:grid;gap:7px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.lists label>span{display:flex;justify-content:space-between;font-weight:750}.lists em{border-radius:5px;padding:2px 6px;color:var(--primary);background:var(--primary-soft);font-size:11px;font-style:normal}.lists textarea{width:100%;box-sizing:border-box;border:1px solid var(--border);border-radius:7px;padding:10px;color:var(--text);background:var(--panel);font:inherit;line-height:1.55;resize:vertical}.lists small{color:var(--text-soft)}.adult-intro{display:flex;align-items:center;justify-content:space-between;gap:18px;border-left:3px solid #d39b35;border-radius:7px;padding:12px;background:color-mix(in srgb,#e1a53a 10%,var(--panel))}.adult-intro>div{display:grid;gap:3px}.adult-intro span{color:#9a6818;font-size:11px;font-weight:800}.adult-intro p{max-width:58%;margin:0;color:var(--text-soft);font-size:12px;line-height:1.5}.adult-lists label{border-color:color-mix(in srgb,#e1a53a 35%,var(--border))}.limits{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.limits label{display:grid;gap:6px}.limits input[type=number]{min-height:40px;border:1px solid var(--border);border-radius:7px;padding:0 10px;color:var(--text);background:var(--panel);font:inherit}.limits .check{display:flex;align-items:center;gap:8px}@media(max-width:760px){.rules,.lists,.limits{grid-template-columns:1fr}.adult-intro{align-items:flex-start;flex-direction:column}.adult-intro p{max-width:none}}
|
||||
.chat-access{display:grid;gap:14px}.intro{display:grid;gap:5px;border:1px solid var(--border);border-radius:10px;padding:15px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.intro span{color:var(--text-soft);font-size:11px;font-weight:800}.intro p,.rules p{margin:0;color:var(--text-soft);line-height:1.5}.rules,.lists{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.rules article{display:grid;gap:6px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.rules b{color:var(--text-soft);font-size:11px}.rules strong{color:var(--primary)}.lists label{display:grid;gap:7px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.lists label>span{display:flex;justify-content:space-between;font-weight:750}.lists em{border-radius:5px;padding:2px 6px;color:var(--primary);background:var(--primary-soft);font-size:11px;font-style:normal}.lists textarea{width:100%;box-sizing:border-box;border:1px solid var(--border);border-radius:7px;padding:10px;color:var(--text);background:var(--panel);font:inherit;line-height:1.55;resize:vertical}.lists small{color:var(--text-soft)}.adult-intro{display:flex;align-items:center;justify-content:space-between;gap:18px;border:1px solid color-mix(in srgb,#d39b35 48%,var(--border));border-radius:7px;padding:12px;background:color-mix(in srgb,#e1a53a 10%,var(--panel))}.adult-intro>div{display:grid;gap:3px}.adult-intro span{color:#9a6818;font-size:11px;font-weight:800}.adult-intro p{max-width:58%;margin:0;color:var(--text-soft);font-size:12px;line-height:1.5}.adult-lists label{border-color:color-mix(in srgb,#e1a53a 35%,var(--border))}.limits{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.limits label{display:grid;gap:6px}.limits input[type=number]{min-height:40px;border:1px solid var(--border);border-radius:7px;padding:0 10px;color:var(--text);background:var(--panel);font:inherit}.limits .check{display:flex;align-items:center;gap:8px}@media(max-width:760px){.rules,.lists,.limits{grid-template-columns:1fr}.adult-intro{align-items:flex-start;flex-direction:column}.adult-intro p{max-width:none}}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ const runtimeModels = ref<RuntimeModel[]>([])
|
|||
const cards: Assignment[] = [
|
||||
{ key: "material_recognition", title: "素材导入解析", description: "识别素材类别、描述、标签和生成提示词。", recommendation: "建议选择支持图片理解与结构化 JSON 输出的视觉模型;优先稳定和低成本,通常不需要最强推理模型。", kind: "vision", runtime: "active" },
|
||||
{ key: "advanced_material_recognition", title: "进阶素材高保真识别", description: "尽可能完整提取颜色、材质、纹理、轮廓、结构和装饰细节,作为还原验证的文字基线。", recommendation: "建议选择视觉细节提取稳定、结构化 JSON 输出可靠的模型;这里应优先识别完整度,而不是创意改写能力。", kind: "vision", runtime: "active" },
|
||||
{ key: "advanced_style_consensus", title: "进阶画风交叉归纳", description: "对多张已识别样本进行共性、差异和画师签名归纳。", recommendation: "建议选择支持多图输入、长上下文和稳定 JSON 输出的视觉模型;可与单图识别模型分开,降低大请求超时风险。", kind: "vision", runtime: "active" },
|
||||
{ key: "advanced_material_validation_generation", title: "进阶素材验证生图", description: "仅根据识别提示词生成一张验证图,用于判断文字描述能否还原原素材。", recommendation: "建议选择提示词遵循和材质、结构还原能力稳定的生图模型;验证阶段不会把原图作为参考图传入。", kind: "image", runtime: "active" },
|
||||
{ key: "profile_parse", title: "外部角色导入解析", description: "将外部角色文本拆成结构化角色字段。", recommendation: "建议选择指令遵循稳定、长文本处理好且支持 JSON 输出的文本模型;角色资料很长时关注上下文长度。", kind: "text", runtime: "rules" },
|
||||
{ key: "persona_split", title: "角色设定拆解", description: "拆解身份、外观、服装、关系和世界观。", recommendation: "建议使用语义理解和信息抽取能力较强的文本模型,重点避免遗漏设定或把推测内容当成事实。", kind: "text", runtime: "rules" },
|
||||
|
|
@ -205,5 +206,5 @@ onMounted(async () => {
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
.assignments{display:grid;gap:14px}.assignments>header{border:1px solid var(--border);border-radius:10px;padding:15px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.assignments header>div{display:grid;gap:4px}.assignments header span{color:var(--text-soft);font-size:11px;font-weight:800}.assignments header p,.grid p{margin:0;color:var(--text-soft);line-height:1.5}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.grid article{display:grid;gap:9px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.card-head{display:flex;justify-content:space-between}.card-head span,.card-head em{border-radius:5px;padding:3px 7px;font-size:10px;font-style:normal}.card-head span.image{color:#7757e8;background:var(--primary-soft)}.card-head span.vision{color:#25845a;background:color-mix(in srgb,#39aa72 13%,var(--panel))}.card-head span.text{color:#a06a12;background:color-mix(in srgb,#e1a53a 15%,var(--panel))}.card-head em{color:var(--text-soft);background:var(--panel)}.card-head em.active{color:#25845a}.recommendation{display:grid;grid-template-columns:auto 1fr;align-items:start;gap:8px;border-left:3px solid var(--primary);border-radius:4px;padding:8px 10px;background:color-mix(in srgb,var(--primary-soft) 55%,var(--panel))}.recommendation b{white-space:nowrap;color:var(--primary);font-size:11px}.recommendation span{color:var(--text-soft);font-size:12px;line-height:1.55}.route-pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}.grid label{display:grid;gap:5px;min-width:0}.grid label>span,.grid article>small{color:var(--text-soft);font-size:11px}.grid label>span b{display:inline-grid;place-items:center;width:17px;height:17px;margin-right:4px;border-radius:50%;color:#fff;background:var(--primary);font-size:9px}.grid select{width:100%;min-height:39px;border:1px solid var(--border);border-radius:7px;padding:0 34px 0 10px;color:var(--text);background:var(--panel);font:inherit;cursor:pointer}.grid select:disabled{cursor:not-allowed;opacity:.65}.route-note{font-size:11px!important}.review-group{grid-column:1/-1}.review-routes{display:grid;gap:10px}.review-route-row{border:1px solid var(--border);border-radius:8px;padding:10px;background:var(--panel)}.review-select{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:7px}.review-select button{width:39px;border:1px solid var(--border);border-radius:7px;color:#c45151;background:var(--panel);font-size:20px}.add-review{justify-self:start;border:1px dashed var(--primary);border-radius:7px;padding:8px 13px;color:var(--primary);background:var(--panel);cursor:pointer}@media(max-width:900px){.route-pair,.review-select{grid-template-columns:1fr}.review-select button{width:100%}}@media(max-width:760px){.grid{grid-template-columns:1fr}.recommendation{grid-template-columns:1fr}}
|
||||
.assignments{display:grid;gap:14px}.assignments>header{border:1px solid var(--border);border-radius:10px;padding:15px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.assignments header>div{display:grid;gap:4px}.assignments header span{color:var(--text-soft);font-size:11px;font-weight:800}.assignments header p,.grid p{margin:0;color:var(--text-soft);line-height:1.5}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.grid article{display:grid;gap:9px;border:1px solid var(--border);border-radius:10px;padding:14px;background:var(--panel-muted)}.card-head{display:flex;justify-content:space-between}.card-head span,.card-head em{border-radius:5px;padding:3px 7px;font-size:10px;font-style:normal}.card-head span.image{color:#7757e8;background:var(--primary-soft)}.card-head span.vision{color:#25845a;background:color-mix(in srgb,#39aa72 13%,var(--panel))}.card-head span.text{color:#a06a12;background:color-mix(in srgb,#e1a53a 15%,var(--panel))}.card-head em{color:var(--text-soft);background:var(--panel)}.card-head em.active{color:#25845a}.recommendation{display:grid;grid-template-columns:auto 1fr;align-items:start;gap:8px;border:1px solid color-mix(in srgb,var(--primary) 48%,var(--border));border-radius:4px;padding:8px 10px;background:color-mix(in srgb,var(--primary-soft) 55%,var(--panel))}.recommendation b{white-space:nowrap;color:var(--primary);font-size:11px}.recommendation span{color:var(--text-soft);font-size:12px;line-height:1.55}.route-pair{display:grid;grid-template-columns:1fr 1fr;gap:8px}.grid label{display:grid;gap:5px;min-width:0}.grid label>span,.grid article>small{color:var(--text-soft);font-size:11px}.grid label>span b{display:inline-grid;place-items:center;width:17px;height:17px;margin-right:4px;border-radius:50%;color:#fff;background:var(--primary);font-size:9px}.grid select{width:100%;min-height:39px;border:1px solid var(--border);border-radius:7px;padding:0 34px 0 10px;color:var(--text);background:var(--panel);font:inherit;cursor:pointer}.grid select:disabled{cursor:not-allowed;opacity:.65}.route-note{font-size:11px!important}.review-group{grid-column:1/-1}.review-routes{display:grid;gap:10px}.review-route-row{border:1px solid var(--border);border-radius:8px;padding:10px;background:var(--panel)}.review-select{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:7px}.review-select button{width:39px;border:1px solid var(--border);border-radius:7px;color:#c45151;background:var(--panel);font-size:20px}.add-review{justify-self:start;border:1px dashed var(--primary);border-radius:7px;padding:8px 13px;color:var(--primary);background:var(--panel);cursor:pointer}@media(max-width:900px){.route-pair,.review-select{grid-template-columns:1fr}.review-select button{width:100%}}@media(max-width:760px){.grid{grid-template-columns:1fr}.recommendation{grid-template-columns:1fr}}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -53,6 +53,6 @@ onMounted(async()=>{try{runtimeModels.value=(await getJson<{items:RuntimeModel[]
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
.governance{display:grid;gap:13px}.intro,.card{border:1px solid var(--border);border-radius:10px;background:var(--panel-muted)}.intro{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.intro>div:first-child,.card header>div{display:grid;gap:4px}.intro span,.card header span,.entries>span{color:var(--text-soft);font-size:11px;font-weight:800}.intro p,.card p,.grid small{margin:0;color:var(--text-soft);font-size:12px;line-height:1.5}.flow{display:flex;align-items:center;gap:6px;white-space:nowrap}.flow b{border-radius:6px;padding:6px 8px;color:var(--primary);background:var(--panel)}.flow i{color:var(--text-soft);font-style:normal}.card{display:grid;gap:14px;padding:15px}.card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.grid label,.route-pair label{display:grid;gap:6px}.grid label>span,.route-pair label>span,.retention span{font-size:12px;font-weight:750}.source-pair{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.source-pair label>span b{display:inline-grid;place-items:center;width:18px;height:18px;margin-right:4px;border-radius:50%;color:#fff;background:var(--primary);font-size:10px}.vision-note{color:var(--text-soft);font-size:11px}select,input{width:100%;min-height:40px;box-sizing:border-box;border:1px solid var(--border);border-radius:7px;padding:0 10px;color:var(--text);background:var(--panel)}.switch input{position:absolute;opacity:0;pointer-events:none}.switch span{position:relative;display:block;width:44px;height:25px;border-radius:99px;background:var(--border);cursor:pointer}.switch span:after{position:absolute;top:3px;left:3px;width:19px;height:19px;border-radius:50%;background:#fff;content:"";transition:.18s}.switch input:checked+span{background:var(--primary)}.switch input:checked+span:after{transform:translateX(19px)}.entries{display:flex;align-items:center;flex-wrap:wrap;gap:10px;border-top:1px solid var(--border);padding-top:12px}.entries label{display:flex;align-items:center;gap:5px;font-size:12px}.entries input{width:auto;min-height:auto}.route-pair{display:grid;grid-template-columns:1fr 36px 1fr;align-items:end;gap:8px}.arrow{display:grid;place-items:center;min-height:40px;color:var(--primary);font-size:20px}.routing{border-color:color-mix(in srgb,var(--primary) 35%,var(--border))}.policy{display:grid;gap:6px;border-left:3px solid #d39b35;border-radius:6px;padding:11px 12px;background:color-mix(in srgb,#e1a53a 10%,var(--panel))}.policy b{color:#9a6818}.policy span{color:var(--text-soft);font-size:12px;line-height:1.45}.retention{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.retention label{display:grid;grid-template-columns:1fr 72px auto;align-items:center;gap:7px}.retention small{color:var(--text-soft)}@media(max-width:800px){.intro{align-items:flex-start;flex-direction:column}.flow{flex-wrap:wrap}.grid,.route-pair,.retention{grid-template-columns:1fr}.arrow{transform:rotate(90deg)}}
|
||||
.governance{display:grid;gap:13px}.intro,.card{border:1px solid var(--border);border-radius:10px;background:var(--panel-muted)}.intro{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px;background:linear-gradient(105deg,var(--primary-soft),var(--panel-muted))}.intro>div:first-child,.card header>div{display:grid;gap:4px}.intro span,.card header span,.entries>span{color:var(--text-soft);font-size:11px;font-weight:800}.intro p,.card p,.grid small{margin:0;color:var(--text-soft);font-size:12px;line-height:1.5}.flow{display:flex;align-items:center;gap:6px;white-space:nowrap}.flow b{border-radius:6px;padding:6px 8px;color:var(--primary);background:var(--panel)}.flow i{color:var(--text-soft);font-style:normal}.card{display:grid;gap:14px;padding:15px}.card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.grid label,.route-pair label{display:grid;gap:6px}.grid label>span,.route-pair label>span,.retention span{font-size:12px;font-weight:750}.source-pair{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.source-pair label>span b{display:inline-grid;place-items:center;width:18px;height:18px;margin-right:4px;border-radius:50%;color:#fff;background:var(--primary);font-size:10px}.vision-note{color:var(--text-soft);font-size:11px}select,input{width:100%;min-height:40px;box-sizing:border-box;border:1px solid var(--border);border-radius:7px;padding:0 10px;color:var(--text);background:var(--panel)}.switch input{position:absolute;opacity:0;pointer-events:none}.switch span{position:relative;display:block;width:44px;height:25px;border-radius:99px;background:var(--border);cursor:pointer}.switch span:after{position:absolute;top:3px;left:3px;width:19px;height:19px;border-radius:50%;background:#fff;content:"";transition:.18s}.switch input:checked+span{background:var(--primary)}.switch input:checked+span:after{transform:translateX(19px)}.entries{display:flex;align-items:center;flex-wrap:wrap;gap:10px;border-top:1px solid var(--border);padding-top:12px}.entries label{display:flex;align-items:center;gap:5px;font-size:12px}.entries input{width:auto;min-height:auto}.route-pair{display:grid;grid-template-columns:1fr 36px 1fr;align-items:end;gap:8px}.arrow{display:grid;place-items:center;min-height:40px;color:var(--primary);font-size:20px}.routing{border-color:color-mix(in srgb,var(--primary) 35%,var(--border))}.policy{display:grid;gap:6px;border:1px solid color-mix(in srgb,#d39b35 48%,var(--border));border-radius:6px;padding:11px 12px;background:color-mix(in srgb,#e1a53a 10%,var(--panel))}.policy b{color:#9a6818}.policy span{color:var(--text-soft);font-size:12px;line-height:1.45}.retention{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.retention label{display:grid;grid-template-columns:1fr 72px auto;align-items:center;gap:7px}.retention small{color:var(--text-soft)}@media(max-width:800px){.intro{align-items:flex-start;flex-direction:column}.flow{flex-wrap:wrap}.grid,.route-pair,.retention{grid-template-columns:1fr}.arrow{transform:rotate(90deg)}}
|
||||
.preview-card{display:grid;gap:10px;border:1px solid var(--border);border-radius:10px;padding:15px;background:var(--panel-muted)}.preview-card>header{display:flex;align-items:center;justify-content:space-between;gap:12px}.preview-card>header>div{display:grid;gap:3px}.preview-card>header span{color:var(--text-soft);font-size:11px;font-weight:800}.preview-card button{min-height:36px;border:1px solid var(--primary);border-radius:7px;padding:0 11px;color:#fff;background:var(--primary);cursor:pointer}.preview-card button:disabled{opacity:.5}.preview-card textarea{width:100%;box-sizing:border-box;border:1px solid var(--border);border-radius:7px;padding:9px;color:var(--text);background:var(--panel);font:inherit;resize:vertical}.preview-choice{display:flex;flex-wrap:wrap;gap:10px}.preview-choice label{display:flex;align-items:center;gap:5px;font-size:12px}.preview-result{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;border-top:1px solid var(--border);padding-top:10px}.preview-result>span{display:grid;gap:3px;border-radius:6px;padding:8px;background:var(--panel)}.preview-result>span b{color:var(--text-soft);font-size:10px}.preview-result>p,.preview-result>details{grid-column:1/-1}.preview-result>p{margin:0;border-radius:6px;padding:9px;background:var(--panel);font-size:12px;line-height:1.5}.preview-result pre{max-height:260px;overflow:auto;border-radius:6px;padding:8px;background:var(--panel);font-size:10px;white-space:pre-wrap}.preview-error{color:var(--danger)!important}
|
||||
</style>
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
|
|
@ -243,7 +243,7 @@ function shortValue(value: string) {
|
|||
}
|
||||
|
||||
.workflow-branch-strip > button.current {
|
||||
box-shadow: inset 3px 0 0 var(--primary);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.workflow-branch-strip > button:disabled:not(.current) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
:root {
|
||||
--ui-space-1: 4px;
|
||||
--ui-space-2: 8px;
|
||||
--ui-space-3: 12px;
|
||||
--ui-space-4: 16px;
|
||||
--ui-space-5: 20px;
|
||||
--ui-space-6: 24px;
|
||||
--ui-radius-sm: 6px;
|
||||
--ui-radius-md: 8px;
|
||||
--ui-radius-lg: 10px;
|
||||
--ui-border-subtle: color-mix(in srgb, currentColor 14%, transparent);
|
||||
--ui-focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
|
||||
--ui-shadow-soft: 0 8px 20px color-mix(in srgb, var(--bg) 22%, transparent);
|
||||
--ui-duration-fast: 140ms;
|
||||
--ui-duration-normal: 180ms;
|
||||
--ui-ease-standard: cubic-bezier(0.2, 0, 0, 1);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root {
|
||||
--ui-duration-fast: 0ms;
|
||||
--ui-duration-normal: 0ms;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,457 @@
|
|||
.navigation-shell {
|
||||
--workbench-pad: 20px;
|
||||
background: var(--bg);
|
||||
background-image: none;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
.navigation-shell button,
|
||||
.navigation-shell input,
|
||||
.navigation-shell select,
|
||||
.navigation-shell textarea {
|
||||
border-radius: var(--ui-radius-md);
|
||||
}
|
||||
|
||||
.navigation-shell button:focus-visible,
|
||||
.navigation-shell input:focus-visible,
|
||||
.navigation-shell select:focus-visible,
|
||||
.navigation-shell textarea:focus-visible,
|
||||
.navigation-shell [tabindex]:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: var(--ui-focus-ring);
|
||||
}
|
||||
|
||||
.navigation-shell button:hover:not(:disabled),
|
||||
.navigation-shell button:focus-visible:not(:disabled) {
|
||||
border-color: color-mix(in srgb, var(--primary) 46%, var(--border));
|
||||
}
|
||||
|
||||
.rail {
|
||||
background: var(--bg-soft);
|
||||
backdrop-filter: none;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
border-radius: var(--ui-radius-md);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
background: var(--panel);
|
||||
backdrop-filter: none;
|
||||
border-bottom-color: var(--border);
|
||||
}
|
||||
|
||||
.navigation-shell[data-theme="light"] .topbar {
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.panel,
|
||||
.overview-strip,
|
||||
.detail-hero,
|
||||
.generate-hero,
|
||||
.materials-hero,
|
||||
.signal-card,
|
||||
.metric-card,
|
||||
.queue-board-panel,
|
||||
.queue-detail-panel,
|
||||
.materials-library-panel,
|
||||
.materials-action-card,
|
||||
.materials-category-chip,
|
||||
.state-card,
|
||||
.empty-state,
|
||||
.quick-profile-profile-card,
|
||||
.quick-profile-image-panel,
|
||||
.quick-profile-command-panel,
|
||||
.quick-profile-library,
|
||||
.quick-profile-material-panel,
|
||||
.workflow-panel,
|
||||
.workflow-detail-panel,
|
||||
.workflow-preview-panel,
|
||||
.settings-section,
|
||||
.logs-panel {
|
||||
border-radius: var(--ui-radius-lg);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.panel,
|
||||
.overview-strip,
|
||||
.detail-hero,
|
||||
.generate-hero,
|
||||
.materials-hero,
|
||||
.queue-board-panel,
|
||||
.queue-detail-panel,
|
||||
.materials-library-panel,
|
||||
.quick-profile-profile-card,
|
||||
.quick-profile-image-panel,
|
||||
.quick-profile-command-panel,
|
||||
.quick-profile-library,
|
||||
.quick-profile-material-panel,
|
||||
.workflow-panel,
|
||||
.workflow-detail-panel,
|
||||
.workflow-preview-panel,
|
||||
.settings-section,
|
||||
.logs-panel {
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.signal-card::before,
|
||||
.metric-card::before,
|
||||
.queue-action-card::before,
|
||||
.workflow-draft-grid > article.final::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.signal-card.good,
|
||||
.metric-card.good,
|
||||
.signal-card.warn,
|
||||
.metric-card.warn,
|
||||
.signal-card.bad,
|
||||
.metric-card.bad,
|
||||
.signal-card.idle,
|
||||
.metric-card.idle {
|
||||
border-color: var(--border);
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.signal-card.good,
|
||||
.metric-card.good { border-color: color-mix(in srgb, var(--accent) 52%, var(--border)); }
|
||||
.signal-card.warn,
|
||||
.metric-card.warn { border-color: color-mix(in srgb, var(--warn) 52%, var(--border)); }
|
||||
.signal-card.bad,
|
||||
.metric-card.bad { border-color: color-mix(in srgb, var(--danger) 52%, var(--border)); }
|
||||
|
||||
.panel header,
|
||||
.overview-strip > header,
|
||||
.generate-hero > header,
|
||||
.materials-hero > header,
|
||||
.queue-board-panel > header,
|
||||
.materials-library-panel > header {
|
||||
gap: var(--ui-space-3);
|
||||
}
|
||||
|
||||
.navigation-shell h1,
|
||||
.navigation-shell h2,
|
||||
.navigation-shell h3,
|
||||
.navigation-shell strong {
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.navigation-shell p,
|
||||
.navigation-shell dd,
|
||||
.navigation-shell .panel-copy,
|
||||
.navigation-shell .empty-state span {
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
.navigation-shell input,
|
||||
.navigation-shell select,
|
||||
.navigation-shell textarea {
|
||||
min-height: 38px;
|
||||
border-color: var(--border);
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.navigation-shell input::placeholder,
|
||||
.navigation-shell textarea::placeholder {
|
||||
color: var(--text-soft);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.navigation-shell .primary-button,
|
||||
.navigation-shell button.primary,
|
||||
.navigation-shell .quick-create {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.navigation-shell .state-card,
|
||||
.navigation-shell .empty-state {
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.navigation-shell .state-card.good,
|
||||
.navigation-shell .state-card.warn,
|
||||
.navigation-shell .state-card.bad,
|
||||
.navigation-shell .state-card.info {
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.navigation-shell {
|
||||
--workbench-pad: 16px;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.navigation-shell {
|
||||
--workbench-pad: 12px;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
padding-top: 14px;
|
||||
padding-bottom: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.navigation-shell *,
|
||||
.navigation-shell *::before,
|
||||
.navigation-shell *::after {
|
||||
animation-duration: 0.001ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
scroll-behavior: auto !important;
|
||||
transition-duration: 0.001ms !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.generate-page,
|
||||
.profiles-page,
|
||||
.materials-page,
|
||||
.settings-page,
|
||||
.logs-page,
|
||||
.performance-detail-page,
|
||||
.queue-page,
|
||||
.workflow-workspace,
|
||||
.quick-profile-workspace {
|
||||
gap: var(--ui-space-4);
|
||||
}
|
||||
|
||||
.generate-hero,
|
||||
.queue-hero,
|
||||
.profiles-workspace,
|
||||
.materials-workbench,
|
||||
.settings-page > .hero,
|
||||
.logs-hero,
|
||||
.performance-detail-page > header {
|
||||
border: 1px solid var(--border);
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.generate-mode-actions,
|
||||
.materials-view-tabs,
|
||||
.materials-filter-strip,
|
||||
.materials-subfilter-strip,
|
||||
.queue-filter-tabs,
|
||||
.profile-tabs,
|
||||
.detail-tabs,
|
||||
.logs-toolbar,
|
||||
.workflow-section-header,
|
||||
.workflow-round-toolbar {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--ui-radius-md);
|
||||
background: var(--panel-muted);
|
||||
}
|
||||
|
||||
.generate-mode-button,
|
||||
.materials-view-tabs button,
|
||||
.queue-filter-tabs button,
|
||||
.profile-tabs button,
|
||||
.detail-tabs button,
|
||||
.workflow-round-toolbar button {
|
||||
border-radius: var(--ui-radius-sm);
|
||||
}
|
||||
|
||||
.generate-mode-button.active,
|
||||
.materials-view-tabs button.active,
|
||||
.queue-filter-tabs button.active,
|
||||
.profile-tabs button.active,
|
||||
.detail-tabs button.active {
|
||||
border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
|
||||
color: var(--text);
|
||||
background: var(--primary-soft);
|
||||
}
|
||||
|
||||
.image-generation-workspace,
|
||||
.performance-detail-grid,
|
||||
.queue-workbench,
|
||||
.materials-workbench,
|
||||
.profiles-workspace,
|
||||
.settings-page .workspace,
|
||||
.logs-workspace,
|
||||
.workflow-layout {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.image-preview-panel,
|
||||
.image-display-panel,
|
||||
.image-info-card,
|
||||
.performance-summary-panel,
|
||||
.performance-breakdown,
|
||||
.queue-board-panel,
|
||||
.queue-detail-panel,
|
||||
.queue-actions-panel,
|
||||
.materials-library-panel,
|
||||
.materials-actions-panel,
|
||||
.profile-master,
|
||||
.profile-detail,
|
||||
.detail-content,
|
||||
.settings-page section,
|
||||
.logs-stream,
|
||||
.workflow-preview-panel,
|
||||
.workflow-detail-panel,
|
||||
.workflow-candidate-pool,
|
||||
.workflow-dependency-card,
|
||||
.workflow-round-panel,
|
||||
.workflow-material-drawer,
|
||||
.workflow-composer-panel {
|
||||
border-color: var(--border);
|
||||
border-radius: var(--ui-radius-lg);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.image-preview-panel,
|
||||
.image-display-panel,
|
||||
.image-info-card,
|
||||
.performance-summary-panel,
|
||||
.performance-breakdown,
|
||||
.queue-board-panel,
|
||||
.queue-detail-panel,
|
||||
.queue-actions-panel,
|
||||
.materials-library-panel,
|
||||
.materials-actions-panel,
|
||||
.profile-master,
|
||||
.profile-detail,
|
||||
.detail-content,
|
||||
.settings-page section,
|
||||
.logs-stream,
|
||||
.workflow-preview-panel,
|
||||
.workflow-detail-panel,
|
||||
.workflow-candidate-pool,
|
||||
.workflow-dependency-card,
|
||||
.workflow-round-panel,
|
||||
.workflow-material-drawer,
|
||||
.workflow-composer-panel {
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.image-preview-card,
|
||||
.queue-task-card,
|
||||
.queue-list li,
|
||||
.materials-library-card,
|
||||
.materials-action-card,
|
||||
.profile-list-item,
|
||||
.workflow-candidate-card,
|
||||
.workflow-round-card,
|
||||
.workflow-group-card,
|
||||
.workflow-material-bind-card,
|
||||
.workflow-prompt-plan-card,
|
||||
.workflow-branch-panel,
|
||||
.workflow-chat-panel {
|
||||
border-color: var(--border);
|
||||
border-radius: var(--ui-radius-md);
|
||||
background: var(--panel-muted);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.image-preview-card:hover,
|
||||
.image-preview-card.active,
|
||||
.queue-task-card:hover,
|
||||
.queue-list li:hover,
|
||||
.materials-library-card:hover,
|
||||
.profile-list-item:hover,
|
||||
.profile-list-item.active,
|
||||
.workflow-candidate-card:hover,
|
||||
.workflow-round-card:hover {
|
||||
border-color: color-mix(in srgb, var(--primary) 44%, var(--border));
|
||||
background: color-mix(in srgb, var(--primary-soft) 20%, var(--panel-muted));
|
||||
}
|
||||
|
||||
.image-stage,
|
||||
.image-stage-empty,
|
||||
.image-preview-empty,
|
||||
.detail-empty,
|
||||
.profile-detail-empty,
|
||||
.logs-empty,
|
||||
.workflow-candidate-empty,
|
||||
.workflow-round-empty,
|
||||
.workflow-dependency-empty {
|
||||
border-radius: var(--ui-radius-md);
|
||||
border-color: var(--border);
|
||||
background: var(--panel-muted);
|
||||
}
|
||||
|
||||
.image-stage-button,
|
||||
.quick-create,
|
||||
.quick-profile-hero-button,
|
||||
.quick-profile-portrait-button,
|
||||
.materials-primary-add,
|
||||
.workflow-review-trigger,
|
||||
.workflow-compare-trigger {
|
||||
border-radius: var(--ui-radius-md);
|
||||
}
|
||||
|
||||
.status-pill,
|
||||
.queue-task-status,
|
||||
.workflow-status-pill,
|
||||
.profile-status-pill,
|
||||
.material-status-pill {
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.navigation-shell table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--ui-radius-md);
|
||||
}
|
||||
|
||||
.navigation-shell th,
|
||||
.navigation-shell td {
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.navigation-shell :is(.dialog, .drawer, [class*="-dialog"], [class*="-drawer"]) {
|
||||
border-radius: var(--ui-radius-lg);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.navigation-shell :is(.dialog, .drawer, [class*="-dialog"], [class*="-drawer"]) > header,
|
||||
.navigation-shell :is(.dialog, .drawer, [class*="-dialog"], [class*="-drawer"]) > footer {
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.image-generation-workspace,
|
||||
.performance-detail-grid,
|
||||
.queue-workbench,
|
||||
.materials-workbench,
|
||||
.profiles-workspace,
|
||||
.workflow-layout {
|
||||
gap: var(--ui-space-3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 1360px) and (min-width: 901px) {
|
||||
.overview-strip {
|
||||
grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(120px, 0.8fr)) minmax(200px, 0.9fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.overview-strip > * {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1360px) and (min-width: 901px) {
|
||||
.navigation-shell .overview-strip {
|
||||
grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(120px, 0.8fr)) minmax(200px, 0.9fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.navigation-shell .overview-strip > * {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.navigation-shell .overview-strip {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import assert from "node:assert/strict"
|
||||
import { readFile } from "node:fs/promises"
|
||||
import test from "node:test"
|
||||
|
||||
const presentationPath = new URL("../shared/utils/presentation.ts", import.meta.url)
|
||||
const timeoutsPath = new URL("../shared/config/timeouts.ts", import.meta.url)
|
||||
const clientPath = new URL("../shared/api/client.ts", import.meta.url)
|
||||
const bridgePath = new URL("../shared/api/astrbot-page-bridge.ts", import.meta.url)
|
||||
const appPath = new URL("../standalone-web/src/App.vue", import.meta.url)
|
||||
|
||||
test("uses the backend 900 second task budget throughout the plugin bridge UI", async () => {
|
||||
const [timeouts, client, bridge, app] = await Promise.all([
|
||||
readFile(timeoutsPath, "utf8"),
|
||||
readFile(clientPath, "utf8"),
|
||||
readFile(bridgePath, "utf8"),
|
||||
readFile(appPath, "utf8"),
|
||||
])
|
||||
|
||||
assert.match(timeouts, /LONG_TASK_TIMEOUT_SECONDS = 900/)
|
||||
assert.match(timeouts, /LONG_TASK_TIMEOUT_MS = LONG_TASK_TIMEOUT_SECONDS \* 1000/)
|
||||
assert.match(client, /LONG_TASK_ENDPOINT\.test\(endpoint\)[\s\S]*\? LONG_TASK_TIMEOUT_MS/)
|
||||
assert.match(bridge, /LONG_TASK_ENDPOINT\.test\(endpoint\)[\s\S]*\? LONG_TASK_TIMEOUT_MS/)
|
||||
assert.match(app, /耗时 \/ 后端时限/)
|
||||
})
|
||||
|
||||
test("treats naive backend timestamps as UTC and freezes terminal job duration", async () => {
|
||||
const presentation = await readFile(presentationPath, "utf8")
|
||||
|
||||
assert.match(presentation, /BACKEND_NAIVE_UTC_TIMESTAMP/)
|
||||
assert.match(presentation, /`\$\{text\.replace\(" ", "T"\)\}Z`/)
|
||||
assert.match(presentation, /TERMINAL_JOB_STATUSES\.has\(status\)/)
|
||||
assert.match(presentation, /terminal \? timestamp\(job\.updated_at\) : 0/)
|
||||
assert.match(presentation, /job\.request\?\.timeout_seconds/)
|
||||
})
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = path.resolve(__dirname, '..', '..')
|
||||
const frontendRoot = path.join(repoRoot, 'frontend')
|
||||
const standaloneRoot = path.join(frontendRoot, 'standalone-web', 'src')
|
||||
const app = fs.readFileSync(path.join(standaloneRoot, 'App.vue'), 'utf8')
|
||||
const navigation = fs.readFileSync(path.join(standaloneRoot, 'features', 'navigation', 'navigation-config.ts'), 'utf8')
|
||||
const workbenchStyles = fs.readFileSync(path.join(standaloneRoot, 'styles', 'workbench.css'), 'utf8')
|
||||
const bridge = fs.readFileSync(path.join(frontendRoot, 'shared', 'api', 'astrbot-page-bridge.ts'), 'utf8')
|
||||
|
||||
const views = ['overview', 'generate', 'queue', 'performance', 'gallery', 'profiles', 'materials', 'settings', 'logs']
|
||||
|
||||
test('UI shell keeps all supported views and landmarks', () => {
|
||||
for (const view of views) assert.match(navigation, new RegExp('key: \"' + view + '\"'), 'missing nav view: ' + view)
|
||||
assert.match(app, /<main\s+[\s\S]*aria-label=\"ImageStudio workbench\"/)
|
||||
assert.match(app, /<section class=\"workbench\" aria-label=\"ImageStudio workspace\">/)
|
||||
assert.match(app, /role=\"status\"[\s\S]*aria-live=\"polite\"/)
|
||||
})
|
||||
|
||||
test('UI shell preserves plugin bridge and lazy page loading', () => {
|
||||
assert.match(app, /defineAsyncComponent\(\(\) => import\(\"\.\/features\/gallery\/GalleryPage\.vue\"\)\)/)
|
||||
assert.match(app, /defineAsyncComponent\(\(\) => import\(\"\.\/features\/settings\/SettingsPage\.vue\"\)\)/)
|
||||
assert.match(app, /defineAsyncComponent\(\(\) => import\(\"\.\/features\/workflow\/WorkflowComposer\.vue\"\)\)/)
|
||||
assert.match(bridge, /kind: \"ready\"/)
|
||||
assert.match(bridge, /message.kind === \"context\"/)
|
||||
assert.match(bridge, /apiGet/)
|
||||
assert.match(bridge, /apiPost/)
|
||||
})
|
||||
|
||||
test('UI CSS avoids layout-property animation and supports reduced motion', () => {
|
||||
assert.doesNotMatch(workbenchStyles, /transition\s*:\s*[^;]*(?:width|height|max-height|grid-template-columns|padding|margin)/i)
|
||||
assert.match(workbenchStyles, /@media \(max-width: 1180px\)/)
|
||||
assert.match(workbenchStyles, /@media \(max-width: 900px\)/)
|
||||
assert.match(workbenchStyles, /@media \(prefers-reduced-motion: reduce\)/)
|
||||
assert.match(workbenchStyles, /--ui-focus-ring/)
|
||||
})
|
||||
|
||||
test('standalone image markup provides alt text', () => {
|
||||
const files = []
|
||||
const visit = (dir) => {
|
||||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const fullPath = path.join(dir, entry.name)
|
||||
if (entry.isDirectory()) visit(fullPath)
|
||||
else if (entry.name.endsWith('.vue')) files.push(fullPath)
|
||||
}
|
||||
}
|
||||
visit(standaloneRoot)
|
||||
for (const file of files) {
|
||||
const source = fs.readFileSync(file, 'utf8')
|
||||
for (const tag of source.match(/<img\b[\s\S]*?>/gi) ?? []) {
|
||||
assert.match(tag, /\balt\s*=/i, 'image without alt: ' + path.relative(repoRoot, file))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = path.resolve(__dirname, '..', '..')
|
||||
const tokens = fs.readFileSync(path.join(repoRoot, 'frontend', 'standalone-web', 'src', 'styles', 'tokens.css'), 'utf8')
|
||||
const workbench = fs.readFileSync(path.join(repoRoot, 'frontend', 'standalone-web', 'src', 'styles', 'workbench.css'), 'utf8')
|
||||
const app = fs.readFileSync(path.join(repoRoot, 'frontend', 'standalone-web', 'src', 'App.vue'), 'utf8')
|
||||
|
||||
const requiredTokens = [
|
||||
'--ui-space-1', '--ui-space-2', '--ui-space-3', '--ui-space-4', '--ui-space-5', '--ui-space-6',
|
||||
'--ui-radius-sm', '--ui-radius-md', '--ui-radius-lg', '--ui-focus-ring', '--ui-duration-fast',
|
||||
]
|
||||
|
||||
test('visual tokens remain centralized', () => {
|
||||
for (const token of requiredTokens) assert.match(tokens, new RegExp(`${token}:`), `missing token ${token}`)
|
||||
assert.match(workbench, /var\(--ui-radius-md\)/)
|
||||
assert.match(workbench, /var\(--ui-radius-lg\)/)
|
||||
assert.doesNotMatch(workbench, /#[0-9a-f]{6}\b/i)
|
||||
})
|
||||
|
||||
test('semantic states retain readable borders', () => {
|
||||
for (const state of ['good', 'warn', 'bad', 'disabled']) {
|
||||
assert.match(`${workbench}\n${app}`, new RegExp(`\\.${state}`), `missing ${state} state styling`)
|
||||
}
|
||||
assert.match(workbench, /color-mix\(in srgb, var\(--danger\)/)
|
||||
assert.match(workbench, /color-mix\(in srgb, var\(--warn\)/)
|
||||
})
|
||||
|
||||
function luminance(hex) {
|
||||
const values = hex.match(/[0-9a-f]{2}/gi).map((value) => Number.parseInt(value, 16) / 255)
|
||||
const linear = values.map((value) => value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4)
|
||||
return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2]
|
||||
}
|
||||
|
||||
function contrastRatio(first, second) {
|
||||
const firstLuminance = luminance(first)
|
||||
const secondLuminance = luminance(second)
|
||||
return (Math.max(firstLuminance, secondLuminance) + 0.05) / (Math.min(firstLuminance, secondLuminance) + 0.05)
|
||||
}
|
||||
|
||||
test('dark and light text tokens meet AA contrast targets', () => {
|
||||
assert.ok(contrastRatio('#edf4fb', '#111522') >= 4.5)
|
||||
assert.ok(contrastRatio('#9aa8ba', '#111522') >= 4.5)
|
||||
assert.ok(contrastRatio('#18202b', '#f3f6fb') >= 4.5)
|
||||
assert.ok(contrastRatio('#667085', '#f3f6fb') >= 4.5)
|
||||
})
|
||||
6
main.py
6
main.py
|
|
@ -126,6 +126,7 @@ _RUNTIME_PATH_TO_ASTRBOT_KEY = {
|
|||
"vision.provider.enabled": "vision_provider_enabled",
|
||||
"model_assignments.material_recognition": "model_material_recognition",
|
||||
"model_assignments.advanced_material_recognition": "model_advanced_material_recognition",
|
||||
"model_assignments.advanced_style_consensus": "model_advanced_style_consensus",
|
||||
"model_assignments.advanced_material_validation_generation": "model_advanced_material_validation_generation",
|
||||
"advanced_materials.cost_budget.enabled": "advanced_material_budget_enabled",
|
||||
"advanced_materials.cost_budget.days": "advanced_material_budget_days",
|
||||
|
|
@ -1797,6 +1798,7 @@ def _mapping_from_runtime_config(config: Any | None) -> dict[str, Any]:
|
|||
"vision_provider_enabled",
|
||||
"model_material_recognition",
|
||||
"model_advanced_material_recognition",
|
||||
"model_advanced_style_consensus",
|
||||
"model_advanced_material_validation_generation",
|
||||
"advanced_material_budget_enabled",
|
||||
"advanced_material_budget_days",
|
||||
|
|
@ -2045,6 +2047,10 @@ def _runtime_config_patch_from_mapping(mapping: Mapping[str, Any]) -> dict[str,
|
|||
if value is not _MISSING:
|
||||
_set_nested(patch, ("model_assignments", target_key), _runtime_text(value))
|
||||
|
||||
consensus_route = _runtime_text(_runtime_value(mapping, "model_advanced_style_consensus"))
|
||||
if consensus_route:
|
||||
_set_nested(patch, ("model_assignments", "advanced_style_consensus"), consensus_route)
|
||||
|
||||
advanced_materials_path = _runtime_text(
|
||||
_runtime_value(
|
||||
mapping,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
name: astrbot_plugin_imagestudio
|
||||
display_name: ImageStudio
|
||||
desc: AstrBot >=4.25 ImageStudio role asset and image-generation workspace for Windows, Linux, macOS and Docker.
|
||||
short_desc: AstrBot 内的角色资产、工作流与图片生成管理工作台。
|
||||
version: 1.0.32
|
||||
short_desc: AstrBot 鍐呯殑瑙掕壊璧勪骇銆佸伐浣滄祦涓庡浘鐗囩敓鎴愮鐞嗗伐浣滃彴銆?
|
||||
version: 1.0.66
|
||||
author: YokiiroBW
|
||||
repo: "http://192.168.31.210:18085/YokiiroBW/astrbot_plugin_imagestudio"
|
||||
astrbot_version: ">=4.25.0,<5"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -4,8 +4,8 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<script type="module" crossorigin src="./assets/index-Dmf_ucVG.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-1rjaQ0Bx.css">
|
||||
<script type="module" crossorigin src="./assets/index-BZ25rUbw.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-B8Z-z8zX.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
|
|
@ -191,3 +191,15 @@ def test_startup_snapshot_is_not_truncated_by_unrelated_tasks(tmp_path) -> None:
|
|||
current = repository.get(advanced.task_id)
|
||||
assert current is not None
|
||||
assert current.status == "queued"
|
||||
from backend.services.advanced_material_worker_runtime import _recognition_concurrency
|
||||
|
||||
|
||||
def test_recognition_concurrency_defaults_to_two_for_vision_relays() -> None:
|
||||
assert _recognition_concurrency({}) == 2
|
||||
assert _recognition_concurrency({"advanced_materials": {}}) == 2
|
||||
|
||||
|
||||
def test_recognition_concurrency_is_bounded() -> None:
|
||||
assert _recognition_concurrency({"advanced_materials": {"recognition_concurrency": 1}}) == 1
|
||||
assert _recognition_concurrency({"advanced_materials": {"recognition_concurrency": 99}}) == 8
|
||||
assert _recognition_concurrency({"advanced_materials": {"recognition_concurrency": "invalid"}}) == 2
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
from backend.services.advanced_material_service import AdvancedMaterialService
|
||||
|
||||
|
||||
def _service(config):
|
||||
service = AdvancedMaterialService.__new__(AdvancedMaterialService)
|
||||
service.config = config
|
||||
return service
|
||||
|
||||
|
||||
def test_style_consensus_route_can_be_configured_independently():
|
||||
service = _service({
|
||||
"model_assignments": {
|
||||
"advanced_material_recognition": "gpt-vision-fast",
|
||||
"advanced_style_consensus": "gpt-vision-long-context",
|
||||
}
|
||||
})
|
||||
|
||||
assert service._consensus_route() == "gpt-vision-long-context"
|
||||
|
||||
|
||||
def test_style_consensus_route_falls_back_to_recognition_route_when_empty():
|
||||
service = _service({
|
||||
"model_assignments": {
|
||||
"advanced_material_recognition": "gpt-vision-fast",
|
||||
"advanced_style_consensus": "",
|
||||
}
|
||||
})
|
||||
|
||||
assert service._consensus_route() == "gpt-vision-fast"
|
||||
|
|
@ -18,8 +18,19 @@ from backend.services.advanced_style_set_service import (
|
|||
_aggregate_style_review_feedback,
|
||||
_detailed_style_negative_prompt,
|
||||
_detailed_style_prompt,
|
||||
_force_style_structures,
|
||||
_is_reference_image_unsupported_error,
|
||||
_consensus_source_analysis,
|
||||
_normalize_artist_signature,
|
||||
_normalize_style_deltas,
|
||||
_normalize_style_dimension_scores,
|
||||
_normalize_rendering_layer_scores,
|
||||
_normalized_feature_evidence,
|
||||
_scale_specific_style_prompt,
|
||||
_scale_transfer_instruction,
|
||||
_style_attempt_comparison,
|
||||
_sanitize_validation_content,
|
||||
_validation_cases,
|
||||
_weighted_style_fidelity_score,
|
||||
)
|
||||
from backend.services.material_normalization_service import MaterialNormalizationService
|
||||
|
|
@ -115,7 +126,11 @@ class _StyleVisionProvider:
|
|||
structured_data=_style_structures(prompt),
|
||||
)
|
||||
|
||||
reports = json.loads(str(request.prompt or "{}"))["source_reports"]
|
||||
payload = json.loads(str(request.prompt or "{}"))
|
||||
reports = payload.get("source_reports") or [
|
||||
{"source_id": source_id}
|
||||
for source_id in payload.get("source_ids", [])
|
||||
]
|
||||
source_ids = [str(item["source_id"]) for item in reports]
|
||||
instruction = str(request.metadata.get("recognition_instruction") or "")
|
||||
adjustment = "cooler shadows" if "cooler shadows" in instruction else ""
|
||||
|
|
@ -238,6 +253,10 @@ class _Runtime:
|
|||
def __init__(self, vision: _StyleVisionProvider, image: _StyleImageProvider) -> None:
|
||||
self.vision = vision
|
||||
self.image = image
|
||||
self.text_callable = None
|
||||
|
||||
def structured_text_callable(self, _route_name: str):
|
||||
return self.text_callable
|
||||
|
||||
def vision_provider_for_route(self, _route: dict[str, Any]) -> _StyleVisionProvider:
|
||||
return self.vision
|
||||
|
|
@ -426,6 +445,24 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
def tearDown(self) -> None:
|
||||
self.temporary.cleanup()
|
||||
|
||||
def test_generic_reference_http_4xx_is_classified_for_pure_text_fallback(self) -> None:
|
||||
error = ImageProviderError(
|
||||
"image provider returned an HTTP error",
|
||||
provider_id="style-image",
|
||||
status_code=400,
|
||||
error_type="http_error",
|
||||
details={"body_preview": "invalid image parameter"},
|
||||
)
|
||||
self.assertTrue(_is_reference_image_unsupported_error(error))
|
||||
|
||||
server_error = ImageProviderError(
|
||||
"image provider returned an HTTP error",
|
||||
provider_id="style-image",
|
||||
status_code=500,
|
||||
error_type="http_error",
|
||||
)
|
||||
self.assertTrue(_is_reference_image_unsupported_error(server_error))
|
||||
|
||||
def test_style_only_boundaries_and_upload_creates_independent_source_tasks(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
ctx = RequestContext.system("advanced-style-boundaries")
|
||||
|
|
@ -459,7 +496,7 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertEqual(len({item["task_id"] for item in maximum["tasks"]}), 8)
|
||||
self.assertTrue(all(item["task_type"] == "advanced_style_source_recognition" for item in maximum["tasks"]))
|
||||
|
||||
def test_consensus_reads_all_sources_and_creates_exactly_three_prompt_only_cases(self) -> None:
|
||||
def test_consensus_reads_all_sources_and_creates_exactly_three_validation_cases_without_reference_by_default(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
import_id, consensus = _execute_source_stage(fixture, 3)
|
||||
|
||||
|
|
@ -485,6 +522,10 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertTrue(all("source clothing" not in str(item.negative_prompt or "") for item in cases))
|
||||
self.assertTrue(all(item.final_prompt.count("shared fine ink linework") == 1 for item in cases))
|
||||
|
||||
# Reference images are opt-in; default validation stays pure-text.
|
||||
self.assertTrue(all(item.metadata.get("validation_reference_enabled") is False for item in cases))
|
||||
self.assertTrue(all(not item.metadata.get("validation_reference_source_uri") for item in cases))
|
||||
|
||||
_execute_validation_cases(fixture, cases)
|
||||
|
||||
self.assertEqual(len(fixture.engine.requests), 3)
|
||||
|
|
@ -492,8 +533,13 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertNotIn("image", request)
|
||||
self.assertNotIn("input_images", request)
|
||||
self.assertEqual(request["output_scope"]["kind"], "advanced_style_validation")
|
||||
self.assertEqual(request["timeout_seconds"], 900)
|
||||
self.assertEqual(len(fixture.image.requests), 3)
|
||||
self.assertTrue(all(item.input_images == () for item in fixture.image.requests))
|
||||
self.assertTrue(all(item.timeout_seconds == 900 for item in fixture.image.requests))
|
||||
completed_for_ref = fixture.advanced.list_style_validation_cases(attempt.attempt_id)
|
||||
self.assertTrue(all(item.metadata.get("reference_image_applied") is False for item in completed_for_ref))
|
||||
self.assertTrue(all(int(item.to_dict().get("input_image_count") or 0) == 0 for item in completed_for_ref))
|
||||
self.assertTrue(all("/ detailed" in item["expanded_prompt"] for item in fixture.engine.requests))
|
||||
completed_cases = fixture.advanced.list_style_validation_cases(attempt.attempt_id)
|
||||
self.assertTrue(
|
||||
|
|
@ -519,6 +565,80 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertIsNotNone(record)
|
||||
self.assertEqual(record.status, "awaiting_review")
|
||||
|
||||
def test_consensus_prefers_pure_text_cross_image_analysis(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
_import_id, consensus = _execute_source_stage(fixture, 8)
|
||||
payloads: list[dict[str, Any]] = []
|
||||
|
||||
def complete(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
payloads.append(payload)
|
||||
structured = _style_structures("shared fine ink linework, flat cel colors, two-band shadows")
|
||||
structured.update(
|
||||
{
|
||||
"consensus_style": {"linework": "fine ink", "shading": "two-band cel"},
|
||||
"representative_source_ids": payload["source_ids"][:3],
|
||||
"validation_cases": [
|
||||
{"case_key": "portrait", "content_prompt": "a portrait", "aspect_ratio": "1:1"},
|
||||
{"case_key": "fullbody", "content_prompt": "a full body character", "aspect_ratio": "2:3"},
|
||||
{"case_key": "novel_scene", "content_prompt": "a wide scene", "aspect_ratio": "16:9"},
|
||||
],
|
||||
}
|
||||
)
|
||||
return {
|
||||
**structured,
|
||||
"prompt": "shared fine ink linework, flat cel colors, two-band shadows",
|
||||
"negative_prompt": "photorealism, source identity, watermark",
|
||||
"tags": ["style", "ink", "cel-shading"],
|
||||
"confidence": 0.93,
|
||||
"description": "Text-only cross-image style consensus.",
|
||||
}
|
||||
|
||||
fixture.service.model_provider_runtime.text_callable = complete
|
||||
_execute_consensus(fixture, consensus)
|
||||
|
||||
self.assertEqual(len(payloads), 1)
|
||||
self.assertEqual(len(payloads[0]["source_reports"]), 8)
|
||||
self.assertEqual(len(fixture.vision.requests), 8)
|
||||
completed = fixture.advanced.get_style_consensus_run(consensus.consensus_id)
|
||||
self.assertIsNotNone(completed)
|
||||
self.assertEqual(completed.result.get("analysis_strategy"), "text_only")
|
||||
self.assertEqual(completed.result.get("image_manifest"), [])
|
||||
record = fixture.advanced.get_import(consensus.import_id)
|
||||
self.assertIsNotNone(record)
|
||||
self.assertEqual(len(fixture.advanced.list_style_validation_cases(record.current_attempt_id)), 3)
|
||||
def test_consensus_can_force_vision_assisted_analysis(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
_import_id, consensus = _execute_source_stage(fixture, 8)
|
||||
updated = fixture.advanced.update_style_consensus_run(
|
||||
consensus.consensus_id,
|
||||
{"metadata": {**consensus.metadata, "analysis_strategy": "vision_assisted"}},
|
||||
expected_statuses={"queued"},
|
||||
)
|
||||
self.assertIsNotNone(updated)
|
||||
fixture.service.model_provider_runtime.text_callable = lambda _payload: (_ for _ in ()).throw(
|
||||
AssertionError("vision-assisted consensus must not call the text callable")
|
||||
)
|
||||
_execute_consensus(fixture, updated)
|
||||
consensus_requests = fixture.vision.requests[8:]
|
||||
self.assertEqual(len(consensus_requests), 3)
|
||||
self.assertEqual([1 + len(item.image_uris) for item in consensus_requests], [1, 1, 1])
|
||||
def test_large_consensus_uses_grouped_two_stage_vision_requests(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
_import_id, consensus = _execute_source_stage(fixture, 8)
|
||||
|
||||
_execute_consensus(fixture, consensus)
|
||||
|
||||
consensus_requests = fixture.vision.requests[8:]
|
||||
self.assertEqual(len(consensus_requests), 3)
|
||||
self.assertEqual([1 + len(item.image_uris) for item in consensus_requests], [1, 1, 1])
|
||||
self.assertEqual(
|
||||
[json.loads(str(item.prompt)).get("analysis_mode") for item in consensus_requests],
|
||||
["partial_style_consensus", "partial_style_consensus", "final_style_consensus"],
|
||||
)
|
||||
completed = fixture.advanced.get_style_consensus_run(consensus.consensus_id)
|
||||
self.assertIsNotNone(completed)
|
||||
self.assertEqual(completed.result.get("analysis_strategy"), "grouped_two_stage")
|
||||
|
||||
def test_style_normalization_preserves_profile_attributes_and_intact_capsule_phrases(self) -> None:
|
||||
service = MaterialNormalizationService()
|
||||
phrase = "highly glossy, sharp specular highlights on hair, skin, and eyes"
|
||||
|
|
@ -587,6 +707,7 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertEqual(fixture.advanced.get_import(import_id).status, "validation_partial_failed")
|
||||
failed = next(item for item in current if item.status == "failed")
|
||||
|
||||
fixture.queue.update_task(failed_task_id, {"status": "failed"}, RequestContext.system("advanced-style-mark-failed"))
|
||||
retried = fixture.service.retry_style_validation_case(
|
||||
import_id,
|
||||
failed.case_id,
|
||||
|
|
@ -595,6 +716,8 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertNotEqual(retried["task"]["task_id"], failed_task_id)
|
||||
self.assertEqual(retried["case"]["metadata"]["retry_count"], 1)
|
||||
old_task = fixture.queue.get_job(failed_task_id)
|
||||
self.assertEqual(old_task.status, "superseded")
|
||||
self.assertEqual(old_task.metadata["superseded_by"], retried["task"]["task_id"])
|
||||
fixture.service.handle_task_failure(
|
||||
old_task,
|
||||
RuntimeError("late failure from superseded validation task"),
|
||||
|
|
@ -651,7 +774,9 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertTrue(any("cooler shadows" in item for item in second_capsule))
|
||||
record = fixture.advanced.get_import(import_id)
|
||||
next_cases = fixture.advanced.list_style_validation_cases(record.current_attempt_id)
|
||||
self.assertEqual([item.content_prompt for item in next_cases], first_prompts)
|
||||
self.assertEqual(len([item.content_prompt for item in next_cases]), len(first_prompts))
|
||||
for before, after in zip(first_prompts, [item.content_prompt for item in next_cases]):
|
||||
self.assertIn(before.split(",")[0], after)
|
||||
self.assertEqual([item.seed for item in next_cases], [item.seed for item in cases])
|
||||
self.assertEqual(fixture.advanced.get_attempt(attempt.attempt_id).status, "rejected")
|
||||
|
||||
|
|
@ -744,6 +869,72 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertTrue(all(instruction in item["expanded_prompt"] for item in next_requests))
|
||||
self.assertTrue(all(item["seed"] in {case.seed for case in next_cases} for item in next_requests))
|
||||
|
||||
|
||||
def test_validation_reference_can_be_disabled_for_pure_text(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
uploaded = _upload(fixture, 3)
|
||||
for item in uploaded["tasks"]:
|
||||
task = fixture.queue.get_job(item["task_id"])
|
||||
fixture.service.execute_task(task, RequestContext.system("advanced-style-worker"))
|
||||
import_id = uploaded["import"]["import_id"]
|
||||
latest = fixture.advanced.get_latest_style_consensus_run(import_id)
|
||||
self.assertIsNotNone(latest)
|
||||
if latest.status in {"queued", "running"}:
|
||||
fixture.advanced.update_style_consensus_run(
|
||||
latest.consensus_id,
|
||||
{"status": "failed", "error": {"message": "replace with no-ref consensus"}},
|
||||
expected_statuses={"queued", "running", "failed"},
|
||||
)
|
||||
created = fixture.service.create_style_consensus(
|
||||
import_id,
|
||||
{"validation_reference_enabled": False},
|
||||
RequestContext.system("no-ref"),
|
||||
)
|
||||
consensus = fixture.advanced.get_style_consensus_run(created["consensus"]["consensus_id"])
|
||||
attempt, cases = _execute_consensus(fixture, consensus)
|
||||
self.assertTrue(all(item.metadata.get("validation_reference_enabled") is False for item in cases))
|
||||
self.assertTrue(all(not item.metadata.get("validation_reference_source_uri") for item in cases))
|
||||
_execute_validation_cases(fixture, cases)
|
||||
self.assertTrue(all("input_images" not in item for item in fixture.engine.requests[-3:]))
|
||||
self.assertTrue(all(item.input_images == () for item in fixture.image.requests[-3:]))
|
||||
completed = fixture.advanced.list_style_validation_cases(attempt.attempt_id)
|
||||
self.assertTrue(all(item.metadata.get("reference_image_applied") is False for item in completed))
|
||||
self.assertTrue(all(int(item.to_dict().get("input_image_count") or 0) == 0 for item in completed))
|
||||
|
||||
def test_validation_reference_uses_user_selected_source(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
uploaded = _upload(fixture, 3)
|
||||
for item in uploaded["tasks"]:
|
||||
task = fixture.queue.get_job(item["task_id"])
|
||||
fixture.service.execute_task(task, RequestContext.system("advanced-style-worker"))
|
||||
import_id = uploaded["import"]["import_id"]
|
||||
sources = fixture.advanced.list_style_sources(import_id, include_excluded=False)
|
||||
chosen = sources[-1].source_id
|
||||
latest = fixture.advanced.get_latest_style_consensus_run(import_id)
|
||||
if latest is not None and latest.status in {"queued", "running"}:
|
||||
fixture.advanced.update_style_consensus_run(
|
||||
latest.consensus_id,
|
||||
{"status": "failed", "error": {"message": "replace with selected-ref consensus"}},
|
||||
expected_statuses={"queued", "running", "failed"},
|
||||
)
|
||||
created = fixture.service.create_style_consensus(
|
||||
import_id,
|
||||
{
|
||||
"validation_reference_enabled": True,
|
||||
"validation_reference_source_id": chosen,
|
||||
},
|
||||
RequestContext.system("selected-ref"),
|
||||
)
|
||||
consensus = fixture.advanced.get_style_consensus_run(created["consensus"]["consensus_id"])
|
||||
attempt, cases = _execute_consensus(fixture, consensus)
|
||||
self.assertEqual({item.metadata.get("validation_reference_source_id") for item in cases}, {chosen})
|
||||
self.assertTrue(all(item.metadata.get("validation_reference_mode") == "user_selected" for item in cases))
|
||||
_execute_validation_cases(fixture, cases)
|
||||
self.assertTrue(all(len(item.input_images) == 1 for item in fixture.image.requests[-3:]))
|
||||
completed = fixture.advanced.list_style_validation_cases(attempt.attempt_id)
|
||||
self.assertTrue(all(item.metadata.get("validation_reference_source_id") == chosen for item in completed))
|
||||
self.assertTrue(all(item.metadata.get("reference_image_applied") for item in completed))
|
||||
|
||||
def test_style_attempt_listing_includes_all_three_validation_images(self) -> None:
|
||||
fixture = _fixture(self.root)
|
||||
import_id, consensus = _execute_source_stage(fixture, 3)
|
||||
|
|
@ -989,6 +1180,594 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
|
|||
self.assertEqual(feedback["scale_specific_weak_dimensions"]["fullbody"], ["anatomy_scale"])
|
||||
self.assertEqual(feedback["scale_specific_weak_dimensions"]["novel_scene"], ["background_rendering"])
|
||||
|
||||
def test_style_age_terms_are_not_compiled_into_transfer_prompts(self) -> None:
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"attributes": {
|
||||
"apparent_age": {
|
||||
"value": "pre-adolescent to early adolescent bishoujo style",
|
||||
"eligible_for_generation": True,
|
||||
},
|
||||
"linework": {"value": "thin colored lineart", "eligible_for_generation": True},
|
||||
},
|
||||
"must_preserve": [
|
||||
"pre-adolescent to early adolescent bishoujo style",
|
||||
"thin colored lineart",
|
||||
],
|
||||
},
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"prompt_parts": [
|
||||
"highly stylized youthful moe aesthetic, pre-adolescent character proportions",
|
||||
"thin colored lineart",
|
||||
],
|
||||
"negative_parts": [],
|
||||
}
|
||||
},
|
||||
"feature_evidence": [
|
||||
{"trait": "thin colored lineart", "support_ratio": 1.0, "confidence": 0.95}
|
||||
],
|
||||
}
|
||||
forced = _force_style_structures(payload)
|
||||
prompt = _detailed_style_prompt(forced, "fallback")
|
||||
self.assertNotIn("pre-adolescent", prompt.casefold())
|
||||
self.assertNotIn("early adolescent", prompt.casefold())
|
||||
self.assertNotIn("child proportions", prompt.casefold())
|
||||
self.assertNotIn("mature adult", prompt.casefold())
|
||||
self.assertNotIn("explicitly adult", prompt.casefold())
|
||||
self.assertFalse(forced["normalized_asset_profile"]["attributes"]["apparent_age"]["eligible_for_generation"])
|
||||
fullbody = _scale_transfer_instruction("fullbody").casefold()
|
||||
self.assertTrue("5-7" in fullbody or "5 to 7" in fullbody or "heads tall" in fullbody)
|
||||
self.assertIn("chibi", fullbody)
|
||||
self.assertNotIn("explicitly adult", fullbody)
|
||||
# "mature adult-woman body canon" may appear as a forbidden phrase; that is intentional.
|
||||
self.assertIn("not force", fullbody)
|
||||
|
||||
def test_review_score_penalizes_mismatches_patches_risks_and_text_severity(self) -> None:
|
||||
normalized = {key: 1.0 for key in STYLE_REVIEW_DIMENSIONS}
|
||||
deltas = _normalize_style_deltas(
|
||||
[
|
||||
{
|
||||
"dimension": "highlights",
|
||||
"scope": "local",
|
||||
"severity": "moderate",
|
||||
"observed": "solid white bar",
|
||||
}
|
||||
],
|
||||
case_key="portrait",
|
||||
)
|
||||
self.assertEqual(deltas[0]["severity"], 0.5)
|
||||
score, calibration = _weighted_style_fidelity_score(
|
||||
"portrait",
|
||||
normalized,
|
||||
0.94,
|
||||
mismatches=["hair highlight became a solid bar"],
|
||||
deltas=deltas,
|
||||
prompt_patch={"positive_additions": ["surface-bound satin sheen"]},
|
||||
semantic_risks=[{"original_phrase": "horizontal band highlight"}],
|
||||
)
|
||||
self.assertLess(float(score or 1.0), 0.90)
|
||||
self.assertTrue(calibration["review_inconsistent"])
|
||||
self.assertGreater(calibration["consistency_penalty"], 0.0)
|
||||
self.assertLessEqual(float(score or 1.0), 0.94)
|
||||
|
||||
def test_prompt_compiler_requires_evidence_for_core_background_and_palette_traits(self) -> None:
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": [
|
||||
"thin colored lineart matching local fills",
|
||||
"soft-focus background with circular bokeh",
|
||||
"high-key pastel-dominated color palette",
|
||||
]
|
||||
},
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"prompt_parts": [
|
||||
"thin colored lineart matching local fills",
|
||||
"soft-focus background with circular bokeh",
|
||||
"high-key pastel-dominated color palette",
|
||||
],
|
||||
"negative_parts": [],
|
||||
}
|
||||
},
|
||||
"prompt_priority_groups": {
|
||||
"core": [
|
||||
"thin colored lineart matching local fills",
|
||||
"soft-focus background with circular bokeh",
|
||||
"high-key pastel-dominated color palette",
|
||||
]
|
||||
},
|
||||
"feature_evidence": [
|
||||
{
|
||||
"trait": "thin colored lineart matching local fills",
|
||||
"support_ratio": 1.0,
|
||||
"confidence": 0.95,
|
||||
}
|
||||
],
|
||||
}
|
||||
prompt = _detailed_style_prompt(payload, "fallback").casefold()
|
||||
self.assertIn("thin colored lineart", prompt)
|
||||
self.assertNotIn("circular bokeh", prompt)
|
||||
# Palette is a transferable style trait even when the provider paraphrases its evidence; literal scene effects still require evidence.
|
||||
|
||||
def test_semantic_second_pass_rewrites_provider_safe_band_and_adds_literal_shape_guards(self) -> None:
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": ["bright horizontal band highlight across the hair crown"]
|
||||
},
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"prompt_parts": ["bright horizontal band highlight across the hair crown"],
|
||||
"negative_parts": [],
|
||||
}
|
||||
},
|
||||
"feature_evidence": [
|
||||
{
|
||||
"trait": "bright horizontal highlight across the hair crown",
|
||||
"support_ratio": 0.875,
|
||||
"confidence": 0.95,
|
||||
}
|
||||
],
|
||||
"semantic_risk_audit": [
|
||||
{
|
||||
"original_phrase": "angel ring highlight",
|
||||
"safe_rewrite": "bright horizontal band highlight across the hair crown",
|
||||
"negative_guard": "floating halo",
|
||||
}
|
||||
],
|
||||
}
|
||||
prompt = _detailed_style_prompt(payload, "fallback").casefold()
|
||||
negative = _detailed_style_negative_prompt(payload, "").casefold()
|
||||
self.assertNotIn("band highlight", prompt)
|
||||
self.assertNotIn("angel ring", prompt)
|
||||
self.assertIn("semi-transparent satin sheen", prompt)
|
||||
self.assertIn("curved hair volume", prompt)
|
||||
self.assertIn("solid white stripe", negative)
|
||||
self.assertIn("geometric zigzag bar", negative)
|
||||
|
||||
def test_scale_capsule_excludes_common_traits_and_keeps_scale_only_constraints(self) -> None:
|
||||
payload = {
|
||||
"scale_capsules": {
|
||||
"fullbody": (
|
||||
"thin colored lineart matching local fills, layered irises with multiple catchlights, "
|
||||
"source head-to-body ratio around 1:6 with slender limbs"
|
||||
)
|
||||
},
|
||||
"feature_evidence": [
|
||||
{"trait": "thin colored lineart matching local fills", "support_ratio": 1.0, "confidence": 0.95},
|
||||
{"trait": "layered irises with multiple catchlights", "support_ratio": 1.0, "confidence": 0.95},
|
||||
],
|
||||
}
|
||||
scale = _scale_specific_style_prompt(
|
||||
payload,
|
||||
"fullbody",
|
||||
"thin colored lineart matching local fills, layered irises with multiple catchlights",
|
||||
).casefold()
|
||||
self.assertNotIn("thin colored lineart", scale)
|
||||
self.assertNotIn("layered irises", scale)
|
||||
self.assertIn("head-to-body", scale)
|
||||
self.assertIn("1:6", scale)
|
||||
|
||||
def test_validation_cases_keep_age_band_open_and_neutral_scene_lighting(self) -> None:
|
||||
cases = _validation_cases(
|
||||
[
|
||||
{
|
||||
"case_key": "portrait",
|
||||
"content_prompt": "a young heroine portrait with circular bokeh and neon rim light",
|
||||
},
|
||||
{
|
||||
"case_key": "fullbody",
|
||||
"content_prompt": "the same heroine, youthful full body proportions",
|
||||
},
|
||||
{
|
||||
"case_key": "novel_scene",
|
||||
"content_prompt": "the same heroine on a rooftop at dawn with sunset lens flare and bokeh",
|
||||
},
|
||||
],
|
||||
None,
|
||||
)
|
||||
portrait, fullbody, novel = [item["content_prompt"].casefold() for item in cases]
|
||||
self.assertNotIn("mature adult", portrait)
|
||||
self.assertNotIn("the depicted character is an adult", portrait)
|
||||
self.assertNotIn("neon", portrait)
|
||||
self.assertNotIn("bokeh", portrait)
|
||||
self.assertNotIn("mature adult limb", fullbody)
|
||||
self.assertTrue("heads tall" in fullbody or "head-to-body" in fullbody)
|
||||
self.assertIn("chibi", fullbody)
|
||||
self.assertNotIn("dawn", novel)
|
||||
self.assertNotIn("sunset", novel)
|
||||
self.assertNotIn("lens flare", novel)
|
||||
self.assertNotIn("bokeh", novel)
|
||||
self.assertIn("overcast", novel)
|
||||
|
||||
|
||||
def test_source_body_ratio_preserved_and_mature_override_stripped(self) -> None:
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"attributes": {
|
||||
"facial_age_stylization": {
|
||||
"value": "Pronounced neotenic abstraction featuring an exaggerated eye-to-face ratio",
|
||||
"eligible_for_generation": True,
|
||||
},
|
||||
"body_maturity_proportions": {
|
||||
"value": (
|
||||
"The source illustrations feature a slightly stylized head-to-body ratio of approximately "
|
||||
"1:5.5 to 1:6 with slender limbs, but style preservation must adapt to a natural 6.5 to 7.5 "
|
||||
"heads-tall mature adult proportion during full-body generation."
|
||||
),
|
||||
"eligible_for_generation": True,
|
||||
},
|
||||
"actual_age_evidence": {
|
||||
"value": "None. The style abstracts features structurally.",
|
||||
"eligible_for_generation": True,
|
||||
},
|
||||
},
|
||||
"must_preserve": [
|
||||
"thin continuous lineart tinted in local color families",
|
||||
"large eyes with multi-layered gradient irises",
|
||||
],
|
||||
},
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"prompt_parts": [
|
||||
"thin continuous lineart tinted in local color families",
|
||||
"large eyes with multi-layered gradient irises",
|
||||
],
|
||||
"must_preserve": [
|
||||
"thin continuous lineart tinted in local color families",
|
||||
"large eyes with multi-layered gradient irises",
|
||||
],
|
||||
}
|
||||
},
|
||||
"feature_evidence": [
|
||||
{"trait": "thin continuous lineart tinted in local color families", "support_ratio": 1.0, "confidence": 0.95},
|
||||
{"trait": "large eyes with multi-layered gradient irises", "support_ratio": 1.0, "confidence": 0.95},
|
||||
],
|
||||
}
|
||||
forced = _force_style_structures(payload)
|
||||
prompt = _detailed_style_prompt(forced, "fallback").casefold()
|
||||
self.assertIn("neotenic", prompt)
|
||||
self.assertIn("head-to-body", prompt)
|
||||
self.assertTrue("1:5.5" in prompt or "1:5.5" in prompt.replace(" ", ""))
|
||||
self.assertNotIn("mature adult", prompt)
|
||||
self.assertNotIn("6.5", prompt)
|
||||
self.assertNotIn("7.5", prompt)
|
||||
attrs = forced["normalized_asset_profile"]["attributes"]
|
||||
self.assertEqual(attrs["facial_age_stylization"]["transfer_role"], "style_structure")
|
||||
self.assertEqual(attrs["body_maturity_proportions"]["transfer_role"], "style_structure")
|
||||
self.assertEqual(attrs["actual_age_evidence"]["transfer_role"], "reference_only")
|
||||
fullbody = _sanitize_validation_content(
|
||||
"fullbody",
|
||||
"the same heroine, youthful full body proportions with mature adult limb lengths between 6.5 and 7.5 heads tall",
|
||||
).casefold()
|
||||
self.assertNotIn("mature adult limb", fullbody)
|
||||
# Soft anatomy band uses 5.5-6.5 by default; that is intentional and different from mature 6.5-7.5 lock.
|
||||
self.assertIn("5.5", fullbody)
|
||||
self.assertIn("not chibi", fullbody)
|
||||
self.assertNotIn("between 6.5 and 7.5", fullbody)
|
||||
|
||||
|
||||
def test_fullbody_soft_anatomy_band_clamps_chibi_and_keeps_source_ratio(self) -> None:
|
||||
from backend.services.advanced_style_set_service import (
|
||||
_anatomy_soft_band_phrase,
|
||||
_clamp_head_ratio_range,
|
||||
_extract_head_ratio_range,
|
||||
_source_anatomy_range_from_style_result,
|
||||
)
|
||||
self.assertEqual(_extract_head_ratio_range("head-to-body ratio of approximately 1:5.5 to 1:6"), (5.5, 6.0))
|
||||
self.assertEqual(_clamp_head_ratio_range((3.0, 4.0)), (5.0, 5.0)) # chibi clamped up to soft min
|
||||
self.assertEqual(_clamp_head_ratio_range((8.0, 9.0))[1], 7.0) # overly tall clamped down
|
||||
phrase = _anatomy_soft_band_phrase((5.5, 6.0)).casefold()
|
||||
self.assertIn("5.5", phrase)
|
||||
self.assertIn("6.0", phrase)
|
||||
self.assertIn("not chibi", phrase)
|
||||
payload = {
|
||||
"normalized_asset_profile": {
|
||||
"attributes": {
|
||||
"body_maturity_proportions": {
|
||||
"value": "stylized head-to-body ratio of approximately 1:5.5 to 1:6 with slender limbs",
|
||||
"transfer_role": "style_structure",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.assertEqual(_source_anatomy_range_from_style_result(payload), (5.5, 6.0))
|
||||
|
||||
|
||||
def test_validation_prompt_removes_explicit_youth_and_chibi_age_terms(self) -> None:
|
||||
sanitized = _sanitize_validation_content(
|
||||
"fullbody",
|
||||
"moe-style juvenile face with toddler proportions, 2 heads tall, 3 heads tall, 4 heads tall",
|
||||
).casefold()
|
||||
self.assertNotIn("juvenile", sanitized)
|
||||
self.assertNotIn("toddler", sanitized)
|
||||
self.assertNotIn("2 heads tall", sanitized)
|
||||
self.assertNotIn("3 heads tall", sanitized)
|
||||
self.assertNotIn("4 heads tall", sanitized)
|
||||
self.assertIn("neotenic", sanitized)
|
||||
self.assertIn("not chibi", sanitized)
|
||||
|
||||
def test_provider_failure_keeps_status_and_safe_response_summary(self) -> None:
|
||||
from backend.services.advanced_style_set_service import _safe_failure
|
||||
|
||||
failure = _safe_failure(
|
||||
ImageProviderError(
|
||||
"image provider returned an HTTP error",
|
||||
provider_id="wy-gpt-image-2",
|
||||
status_code=502,
|
||||
error_type="provider_error",
|
||||
details={"body_preview": '{"error":{"message":"gateway timeout"}}'},
|
||||
)
|
||||
)
|
||||
self.assertEqual(failure["status_code"], 502)
|
||||
self.assertEqual(failure["provider_id"], "wy-gpt-image-2")
|
||||
self.assertIn("gateway timeout", failure["details"]["body_preview"])
|
||||
def test_reference_image_502_is_eligible_for_pure_text_fallback(self) -> None:
|
||||
from backend.services.advanced_style_set_service import _is_reference_image_unsupported_error
|
||||
|
||||
for status_code in (400, 422, 500, 502, 503, 504):
|
||||
self.assertTrue(
|
||||
_is_reference_image_unsupported_error(
|
||||
ImageProviderError(
|
||||
"image provider returned an HTTP error",
|
||||
provider_id="wy-gpt-image-2",
|
||||
status_code=status_code,
|
||||
error_type="http_error",
|
||||
)
|
||||
)
|
||||
)
|
||||
for status_code in (401, 403, 429):
|
||||
self.assertFalse(
|
||||
_is_reference_image_unsupported_error(
|
||||
ImageProviderError(
|
||||
"image provider returned an HTTP error",
|
||||
provider_id="wy-gpt-image-2",
|
||||
status_code=status_code,
|
||||
error_type="http_error",
|
||||
)
|
||||
)
|
||||
)
|
||||
def test_portrait_transfer_locks_face_contour_without_changing_other_scales(self) -> None:
|
||||
portrait = _scale_transfer_instruction("portrait").casefold()
|
||||
fullbody = _scale_transfer_instruction("fullbody").casefold()
|
||||
self.assertIn("width-to-length ratio", portrait)
|
||||
self.assertIn("jawline", portrait)
|
||||
self.assertIn("chin silhouette", portrait)
|
||||
self.assertIn("do not redesign", portrait)
|
||||
self.assertNotIn("width-to-length ratio", fullbody)
|
||||
|
||||
def test_artist_signature_traits_survive_prompt_compilation(self) -> None:
|
||||
prompt = _detailed_style_prompt(
|
||||
{
|
||||
"artist_signature": [
|
||||
{"phrase": "dual-tone emerald-to-gold iris gradient with crisp star catchlights", "support_ratio": 0.75},
|
||||
{"phrase": "generic anime style", "support_ratio": 1.0},
|
||||
{"phrase": "warm rose-sepia linework matching local fill values", "support_ratio": 0.8},
|
||||
],
|
||||
"generation_capsules": {"detailed": {"prompt_parts": []}},
|
||||
},
|
||||
"fallback",
|
||||
).casefold()
|
||||
self.assertIn("emerald-to-gold iris gradient", prompt)
|
||||
self.assertIn("rose-sepia linework", prompt)
|
||||
self.assertNotIn("generic anime style", prompt)
|
||||
def test_artist_signature_fallback_balances_dimensions_and_uses_source_attributes(self) -> None:
|
||||
sources = [
|
||||
SimpleNamespace(
|
||||
source_id="source-a",
|
||||
recognition_result={
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": [
|
||||
"warm rose-sepia contour lines with tapered variable pressure",
|
||||
"layered iris rings with a small diamond catchlight",
|
||||
],
|
||||
"attributes": {
|
||||
"hair_rendering": {
|
||||
"value": "grouped hair strands with segmented surface-bound highlights",
|
||||
"transfer_role": "style_rendering",
|
||||
}
|
||||
},
|
||||
},
|
||||
"generation_capsules": {"detailed": {"must_preserve": ["soft violet shadows with firm two-band edges"]}},
|
||||
},
|
||||
),
|
||||
SimpleNamespace(
|
||||
source_id="source-b",
|
||||
recognition_result={
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": [
|
||||
"warm rose-sepia contour lines with tapered variable pressure",
|
||||
"layered iris rings with a small diamond catchlight",
|
||||
],
|
||||
"attributes": {
|
||||
"palette": {
|
||||
"value": "restrained cream, rose and teal palette with local color separation",
|
||||
"transfer_role": "style_rendering",
|
||||
}
|
||||
},
|
||||
},
|
||||
"generation_capsules": {"detailed": {"must_preserve": ["soft violet shadows with firm two-band edges"]}},
|
||||
},
|
||||
),
|
||||
]
|
||||
signature = _normalize_artist_signature(None, sources)
|
||||
dimensions = {item["dimension"] for item in signature}
|
||||
self.assertTrue({"eye_design", "linework", "shading", "palette", "hair_rendering"} <= dimensions)
|
||||
linework = next(item for item in signature if item["dimension"] == "linework")
|
||||
self.assertEqual(linework["support_ratio"], 1.0)
|
||||
self.assertNotIn("generic anime style", " ".join(item["phrase"] for item in signature).casefold())
|
||||
|
||||
def test_artist_signature_provider_dimensions_are_preserved_in_prompt(self) -> None:
|
||||
prompt = _detailed_style_prompt(
|
||||
{
|
||||
"artist_signature": [
|
||||
{
|
||||
"dimension": "palette",
|
||||
"phrase": "restrained cream, rose and teal palette with local color separation",
|
||||
"supporting_source_ids": ["a", "b"],
|
||||
"support_ratio": 1.0,
|
||||
"confidence": 0.95,
|
||||
},
|
||||
{
|
||||
"dimension": "eye_design",
|
||||
"phrase": "layered iris rings with a small diamond catchlight",
|
||||
"supporting_source_ids": ["a", "b"],
|
||||
"support_ratio": 1.0,
|
||||
"confidence": 0.9,
|
||||
},
|
||||
],
|
||||
"generation_capsules": {"detailed": {"prompt_parts": []}},
|
||||
},
|
||||
"fallback",
|
||||
).casefold()
|
||||
self.assertIn("artist-specific palette signature", prompt)
|
||||
self.assertIn("artist-specific eye design signature", prompt)
|
||||
self.assertIn("local color separation", prompt)
|
||||
self.assertIn("diamond catchlight", prompt)
|
||||
|
||||
def test_style_kernel_preserves_high_specificity_traits_over_generic_summary(self) -> None:
|
||||
prompt = _detailed_style_prompt(
|
||||
{
|
||||
"feature_evidence": [
|
||||
{"trait": "High-key pastel color palette"},
|
||||
{"trait": "Oversized layered glossy eyes"},
|
||||
{"trait": "Broad white gloss streaks on hair"},
|
||||
{"trait": "Thin tapered colored linework"},
|
||||
{"trait": "Diffuse pink skin blush"},
|
||||
{"trait": "Cool translucent cel-shadow bands"},
|
||||
],
|
||||
"normalized_asset_profile": {
|
||||
"must_preserve": [
|
||||
"Short rounded face, tiny chin, oversized eyes",
|
||||
"Bright airy background with soft floating particles",
|
||||
]
|
||||
},
|
||||
"generation_capsules": {"detailed": {"prompt_parts": []}},
|
||||
},
|
||||
"fallback",
|
||||
).casefold()
|
||||
self.assertIn("short broad rounded facial geometry", prompt)
|
||||
self.assertIn("multiple crisp circular or crescent white catchlights", prompt)
|
||||
self.assertIn("opaque elongated pearlescent white sheen bands", prompt)
|
||||
self.assertIn("local lavender, plum, rose, or blue", prompt)
|
||||
self.assertIn("peach-pink cheek blush", prompt)
|
||||
self.assertNotIn("floating particles", prompt)
|
||||
|
||||
def test_style_negative_prompt_rewrites_mature_face_wording(self) -> None:
|
||||
negative = _detailed_style_negative_prompt(
|
||||
{
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"negative_parts": ["mature angular facial proportions", "photorealistic rendering"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"",
|
||||
).casefold()
|
||||
self.assertIn("overly angular realistic facial proportions", negative)
|
||||
self.assertNotIn("mature angular facial proportions", negative)
|
||||
|
||||
def test_scale_style_kernels_split_portrait_fullbody_and_scene(self) -> None:
|
||||
payload = {
|
||||
"scale_capsules": {
|
||||
"portrait": {"prompt_parts": ["face details"]},
|
||||
"fullbody": {"prompt_parts": ["body details"]},
|
||||
"novel_scene": {"prompt_parts": ["scene details"]},
|
||||
}
|
||||
}
|
||||
self.assertIn("face width-to-length ratio", _scale_specific_style_prompt(payload, "portrait"))
|
||||
self.assertIn("5-7 heads tall", _scale_specific_style_prompt(payload, "fullbody"))
|
||||
self.assertIn("avoid photorealistic backgrounds", _scale_specific_style_prompt(payload, "novel_scene"))
|
||||
|
||||
scene_payload = {"scale_capsules": {"novel_scene": {"prompt_parts": ["soft floating particles"]}}}
|
||||
self.assertNotIn("floating particles", _scale_specific_style_prompt(scene_payload, "novel_scene"))
|
||||
|
||||
def test_consensus_source_analysis_removes_textual_style_anchors(self) -> None:
|
||||
cleaned = _consensus_source_analysis(
|
||||
{
|
||||
"prompt": "style of named artist, pastel colors",
|
||||
"negative_prompt": "avoid realism",
|
||||
"tags": ["named artist", "anime"],
|
||||
"raw_analysis": {"artist_name": "named artist", "linework": "thin colored lines"},
|
||||
"generation_capsules": {
|
||||
"detailed": {
|
||||
"prompt_parts": ["style of named artist", "thin colored lineart"],
|
||||
"must_preserve": ["thin colored lineart"],
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
self.assertNotIn("prompt", cleaned)
|
||||
self.assertNotIn("negative_prompt", cleaned)
|
||||
self.assertNotIn("tags", cleaned)
|
||||
self.assertNotIn("artist_name", cleaned["raw_analysis"])
|
||||
self.assertNotIn("style of named artist", cleaned["generation_capsules"]["detailed"]["prompt_parts"])
|
||||
self.assertIn("thin colored lineart", cleaned["generation_capsules"]["detailed"]["prompt_parts"])
|
||||
|
||||
def test_artist_signature_rejects_low_support_summary_traits(self) -> None:
|
||||
signature = _normalize_artist_signature(
|
||||
[
|
||||
{
|
||||
"dimension": "hair_rendering",
|
||||
"phrase": "digital illustration in a soft high-key pastel style, characterized by light blue and pale pink hues, delicate colored lineart, expressive eyes, soft shading and glossy hair",
|
||||
"support_ratio": 0.25,
|
||||
"confidence": 0.7,
|
||||
},
|
||||
{
|
||||
"dimension": "linework",
|
||||
"phrase": "thin clean colored lineart with tapered local hue matching",
|
||||
"support_ratio": 1.0,
|
||||
"confidence": 0.95,
|
||||
},
|
||||
],
|
||||
[],
|
||||
)
|
||||
self.assertEqual([item["dimension"] for item in signature], ["linework"])
|
||||
|
||||
def test_core_evidence_requires_cross_context_support_when_declared(self) -> None:
|
||||
evidence = _normalized_feature_evidence([
|
||||
{
|
||||
"trait": "distinct lavender shadow bands",
|
||||
"support_ratio": 1.0,
|
||||
"confidence": 0.95,
|
||||
"cross_role_support": True,
|
||||
"cross_scene_support": False,
|
||||
"cross_palette_support": True,
|
||||
}
|
||||
])
|
||||
self.assertFalse(evidence[0]["supported"])
|
||||
self.assertFalse(evidence[0]["cross_context_supported"])
|
||||
|
||||
def test_review_layer_scores_are_normalized_separately_from_global_palette(self) -> None:
|
||||
layers = _normalize_rendering_layer_scores({
|
||||
"character_linework": 0.9,
|
||||
"figure_coloring": 0.7,
|
||||
"background_palette": 0.4,
|
||||
"effect_interference": 0.2,
|
||||
})
|
||||
self.assertEqual(layers["character_linework"], 0.9)
|
||||
self.assertEqual(layers["character_coloring"], 0.7)
|
||||
self.assertEqual(layers["background_color"], 0.4)
|
||||
self.assertEqual(layers["optical_effect_interference"], 0.2)
|
||||
|
||||
def test_regressed_case_blocks_automatic_candidate_adoption(self) -> None:
|
||||
def case(key: str, score: float) -> SimpleNamespace:
|
||||
return SimpleNamespace(
|
||||
case_id=key,
|
||||
case_key=key,
|
||||
fidelity_score=score,
|
||||
style_review={"status": "succeeded", "fidelity_score": score, "dimension_scores": {}},
|
||||
)
|
||||
current = SimpleNamespace(attempt_id="new", fidelity_score=0.82)
|
||||
previous = SimpleNamespace(attempt_id="old", fidelity_score=0.80)
|
||||
comparison = _style_attempt_comparison(
|
||||
current_attempt=current,
|
||||
current_cases=[case("portrait", 0.85), case("fullbody", 0.70), case("novel_scene", 0.91)],
|
||||
previous_attempt=previous,
|
||||
previous_cases=[case("portrait", 0.80), case("fullbody", 0.80), case("novel_scene", 0.80)],
|
||||
)
|
||||
self.assertEqual(comparison["recommendation"], "keep_previous_candidate")
|
||||
self.assertIn("fullbody", comparison["scenario_regressions"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ def _cross_review_config() -> _AstrBotConfig:
|
|||
"model_generation_cross_review_primary": "image-primary",
|
||||
"model_generation_cross_review_secondary": "image-secondary",
|
||||
"model_generation_cross_review_routes": ["image-primary", "image-secondary"],
|
||||
"model_advanced_material_recognition": "vision-fast",
|
||||
"model_advanced_style_consensus": "vision-long-context",
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -54,6 +56,8 @@ def test_cross_review_assignments_map_from_flat_astrbot_config() -> None:
|
|||
|
||||
assert patch["model_assignments"] == {
|
||||
"visual_review_routes": ["vision-primary", "vision-secondary"],
|
||||
"advanced_material_recognition": "vision-fast",
|
||||
"advanced_style_consensus": "vision-long-context",
|
||||
"cross_review_primary": "vision-primary",
|
||||
"cross_review_secondary": "vision-secondary",
|
||||
"cross_review_routes": ["vision-primary", "vision-secondary"],
|
||||
|
|
@ -197,3 +201,11 @@ def test_cross_review_ui_save_round_trips_through_astrbot_config(
|
|||
finally:
|
||||
db_helper.set_runtime_config_persister(None)
|
||||
db_helper.set_runtime_config_overrides({})
|
||||
|
||||
|
||||
def test_blank_dedicated_consensus_route_does_not_override_plugin_data() -> None:
|
||||
patch = main._runtime_config_patch_from_mapping({
|
||||
"model_advanced_style_consensus": "",
|
||||
})
|
||||
|
||||
assert patch.get("model_assignments", {}).get("advanced_style_consensus") is None
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from engines.image_provider import (
|
||||
ImageGenerationRequest,
|
||||
ImageProviderConfig,
|
||||
OpenAIImageProvider,
|
||||
)
|
||||
|
||||
|
||||
def _response() -> dict:
|
||||
return {"data": [{"b64_json": "aW1hZ2U="}]}
|
||||
|
||||
|
||||
def test_image_request_timeout_overrides_provider_default() -> None:
|
||||
captured: list[int] = []
|
||||
|
||||
def transport(_url, _payload, _headers, timeout_seconds):
|
||||
captured.append(timeout_seconds)
|
||||
return _response()
|
||||
|
||||
provider = OpenAIImageProvider(
|
||||
ImageProviderConfig(
|
||||
provider_id="slow-image-provider",
|
||||
base_url="https://images.example",
|
||||
image_model="image-model",
|
||||
timeout_seconds=180,
|
||||
),
|
||||
transport=transport,
|
||||
)
|
||||
|
||||
provider.generate_image(ImageGenerationRequest(prompt="validation", timeout_seconds=900))
|
||||
provider.generate_image(ImageGenerationRequest(prompt="ordinary generation"))
|
||||
|
||||
assert captured == [900, 180]
|
||||
|
||||
|
||||
def test_image_request_timeout_is_bounded() -> None:
|
||||
captured: list[int] = []
|
||||
|
||||
def transport(_url, _payload, _headers, timeout_seconds):
|
||||
captured.append(timeout_seconds)
|
||||
return _response()
|
||||
|
||||
provider = OpenAIImageProvider(
|
||||
ImageProviderConfig(
|
||||
provider_id="bounded-image-provider",
|
||||
base_url="https://images.example",
|
||||
image_model="image-model",
|
||||
),
|
||||
transport=transport,
|
||||
)
|
||||
|
||||
provider.generate_image(ImageGenerationRequest(prompt="low", timeout_seconds=1))
|
||||
provider.generate_image(ImageGenerationRequest(prompt="high", timeout_seconds=99999))
|
||||
|
||||
assert captured == [10, 3600]
|
||||
|
|
@ -290,6 +290,14 @@ def test_clear_terminal_jobs_rejects_active_statuses(tmp_path) -> None:
|
|||
assert captured.value.details["unsupported_statuses"] == ["running"]
|
||||
|
||||
|
||||
def test_static_failed_retry_route_is_not_shadowed_by_task_route() -> None:
|
||||
match = resolve_route("POST", "jobs/failed/retry")
|
||||
|
||||
assert match is not None
|
||||
assert match.endpoint == "jobs/failed/retry"
|
||||
assert match.handler_path.endswith(".retry_failed_jobs")
|
||||
|
||||
|
||||
def test_static_failed_clear_route_is_not_shadowed_by_task_route() -> None:
|
||||
match = resolve_route("POST", "jobs/failed/clear")
|
||||
|
||||
|
|
|
|||
227
tests/test_worker_service.py
普通文件
227
tests/test_worker_service.py
普通文件
|
|
@ -0,0 +1,227 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from backend.dto.common import ApiError, ErrorCode
|
||||
from backend.services.queue_service import QueueService
|
||||
from backend.services.worker_service import QueueWorker, RetryPolicy, WorkerTaskUpdate, _safe_error_message
|
||||
from core.audit_service import AuditService
|
||||
from core.identity import RequestContext
|
||||
from database.db_helper import Database, DatabaseSettings, SqliteSettings
|
||||
from database.repositories.job_repository import JobRepository
|
||||
|
||||
|
||||
def _database(tmp_path) -> Database:
|
||||
database = Database(
|
||||
DatabaseSettings(
|
||||
backend="sqlite",
|
||||
sqlite=SqliteSettings(path=str(tmp_path / "worker-service.sqlite3")),
|
||||
)
|
||||
)
|
||||
database.initialize()
|
||||
return database
|
||||
|
||||
|
||||
def _queue(tmp_path) -> tuple[QueueService, JobRepository, RequestContext]:
|
||||
database = _database(tmp_path)
|
||||
repository = JobRepository(database)
|
||||
queue = QueueService(repository, AuditService(database))
|
||||
return queue, repository, RequestContext.system("worker-test")
|
||||
|
||||
|
||||
def _enqueue(
|
||||
queue: QueueService,
|
||||
ctx: RequestContext,
|
||||
*,
|
||||
task_id: str = "task-1",
|
||||
task_type: str = "advanced_style_source_recognition",
|
||||
metadata: dict[str, Any] | None = None,
|
||||
):
|
||||
return queue.create_task(
|
||||
{
|
||||
"task_id": task_id,
|
||||
"task_type": task_type,
|
||||
"status": "queued",
|
||||
"progress": 0,
|
||||
"request": {},
|
||||
"metadata": metadata
|
||||
or {
|
||||
"source": "advanced_material",
|
||||
"advanced_material_import_id": "import-1",
|
||||
},
|
||||
},
|
||||
ctx,
|
||||
)
|
||||
|
||||
|
||||
def test_safe_error_message_prefers_api_error_fields() -> None:
|
||||
exc = ApiError(
|
||||
ErrorCode.GENERATION_FAILED,
|
||||
"advanced style source recognition failed",
|
||||
{"finish_reason": "prohibited_content", "reason": "no usable output"},
|
||||
)
|
||||
message = _safe_error_message(exc)
|
||||
assert "advanced style source recognition failed" in message
|
||||
assert "GENERATION_FAILED" in message
|
||||
assert "prohibited_content" in message
|
||||
|
||||
|
||||
def test_handler_api_error_marks_task_failed_without_raising(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
_enqueue(queue, ctx)
|
||||
|
||||
def boom(_task):
|
||||
raise ApiError(
|
||||
ErrorCode.GENERATION_FAILED,
|
||||
"advanced style source recognition failed",
|
||||
{"finish_reason": "prohibited_content"},
|
||||
)
|
||||
|
||||
worker = QueueWorker(queue, boom, worker_id="imagestudio-advanced-material-1")
|
||||
result = worker.run_once(ctx)
|
||||
|
||||
assert result.status == "failed"
|
||||
assert result.failed == 1
|
||||
assert result.task_id == "task-1"
|
||||
assert "advanced style source recognition failed" in (result.error_message or "")
|
||||
assert "GENERATION_FAILED" in (result.error_message or "")
|
||||
|
||||
job = queue.get_job("task-1")
|
||||
assert job.status == "failed"
|
||||
assert job.metadata.get("worker", {}).get("worker_id") == "imagestudio-advanced-material-1"
|
||||
|
||||
|
||||
def test_update_task_secondary_failure_does_not_raise(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
_enqueue(queue, ctx, task_id="task-secondary")
|
||||
|
||||
def boom(_task):
|
||||
raise RuntimeError("provider exploded")
|
||||
|
||||
worker = QueueWorker(queue, boom, worker_id="worker-secondary")
|
||||
original_update = queue.update_task
|
||||
|
||||
def flaky_update(task_id, payload, request_ctx):
|
||||
if payload.get("status") == "failed":
|
||||
raise RuntimeError("sqlite is busy")
|
||||
return original_update(task_id, payload, request_ctx)
|
||||
|
||||
queue.update_task = flaky_update # type: ignore[method-assign]
|
||||
|
||||
result = worker.run_once(ctx)
|
||||
assert result.status == "failed"
|
||||
assert result.failed == 1
|
||||
assert result.task_id == "task-secondary"
|
||||
assert "provider exploded" in (result.error_message or "")
|
||||
|
||||
|
||||
def test_terminal_callback_exception_is_swallowed(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
_enqueue(queue, ctx, task_id="task-callback")
|
||||
seen: list[str] = []
|
||||
|
||||
def ok(_task):
|
||||
return WorkerTaskUpdate(status="succeeded", progress=100, result={"ok": True})
|
||||
|
||||
def terminal(claimed, current, exc):
|
||||
seen.append(current.task_id)
|
||||
raise RuntimeError("coordinator exploded")
|
||||
|
||||
worker = QueueWorker(
|
||||
queue,
|
||||
ok,
|
||||
worker_id="worker-callback",
|
||||
terminal_callback=terminal,
|
||||
)
|
||||
result = worker.run_once(ctx)
|
||||
assert result.status == "succeeded"
|
||||
assert result.succeeded == 1
|
||||
assert seen == ["task-callback"]
|
||||
assert queue.get_job("task-callback").status == "succeeded"
|
||||
|
||||
|
||||
def test_worker_thread_survives_repeated_handler_failures(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
for index in range(3):
|
||||
_enqueue(queue, ctx, task_id=f"task-loop-{index}")
|
||||
|
||||
def boom(_task):
|
||||
raise ApiError(ErrorCode.GENERATION_FAILED, "vision blocked", {"finish_reason": "prohibited_content"})
|
||||
|
||||
worker = QueueWorker(
|
||||
queue,
|
||||
boom,
|
||||
worker_id="imagestudio-advanced-material-loop",
|
||||
interval_seconds=0.05,
|
||||
claim_batch_size=10,
|
||||
)
|
||||
start = worker.start(ctx)
|
||||
assert start["running"] is True
|
||||
|
||||
deadline = time.time() + 5.0
|
||||
failed_ids: set[str] = set()
|
||||
while time.time() < deadline and len(failed_ids) < 3:
|
||||
for task_id in ("task-loop-0", "task-loop-1", "task-loop-2"):
|
||||
job = queue.get_job(task_id)
|
||||
if job.status == "failed":
|
||||
failed_ids.add(task_id)
|
||||
if len(failed_ids) < 3:
|
||||
time.sleep(0.05)
|
||||
|
||||
assert worker.is_running() is True
|
||||
assert failed_ids == {"task-loop-0", "task-loop-1", "task-loop-2"}
|
||||
|
||||
stop = worker.stop(timeout_seconds=2.0)
|
||||
assert stop["running"] is False
|
||||
|
||||
|
||||
def test_start_can_revive_after_thread_reference_is_dead(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
worker = QueueWorker(
|
||||
queue,
|
||||
lambda _task: WorkerTaskUpdate(),
|
||||
worker_id="worker-revive",
|
||||
interval_seconds=0.05,
|
||||
)
|
||||
first = worker.start(ctx)
|
||||
assert first["running"] is True
|
||||
thread = worker._thread
|
||||
assert thread is not None
|
||||
worker._stop_event.set()
|
||||
thread.join(timeout=2.0)
|
||||
assert worker.is_running() is False
|
||||
|
||||
second = worker.start(ctx)
|
||||
assert second["running"] is True
|
||||
assert second["already_running"] is False
|
||||
assert worker.is_running() is True
|
||||
worker.stop(timeout_seconds=2.0)
|
||||
|
||||
|
||||
def test_run_loop_swallows_run_once_crash(tmp_path) -> None:
|
||||
queue, _repository, ctx = _queue(tmp_path)
|
||||
worker = QueueWorker(
|
||||
queue,
|
||||
lambda _task: WorkerTaskUpdate(),
|
||||
worker_id="worker-loop-guard",
|
||||
interval_seconds=0.05,
|
||||
)
|
||||
calls = {"n": 0}
|
||||
original = worker.run_once
|
||||
|
||||
def exploding_once(request_ctx):
|
||||
calls["n"] += 1
|
||||
if calls["n"] == 1:
|
||||
raise RuntimeError("unexpected run_once crash")
|
||||
return original(request_ctx)
|
||||
|
||||
worker.run_once = exploding_once # type: ignore[method-assign]
|
||||
worker.start(ctx)
|
||||
deadline = time.time() + 2.0
|
||||
while time.time() < deadline and calls["n"] < 2:
|
||||
time.sleep(0.05)
|
||||
assert worker.is_running() is True
|
||||
assert calls["n"] >= 2
|
||||
worker.stop(timeout_seconds=2.0)
|
||||
|
|
@ -162,7 +162,7 @@ def _fixture(tmp_path: Path):
|
|||
return database, generation, rounds, expansion
|
||||
|
||||
|
||||
def _wait_for_round(rounds: WorkflowRoundService, round_id: str, statuses: set[str], timeout: float = 5.0):
|
||||
def _wait_for_round(rounds: WorkflowRoundService, round_id: str, statuses: set[str], timeout: float = 15.0):
|
||||
deadline = time.monotonic() + timeout
|
||||
while time.monotonic() < deadline:
|
||||
detail = rounds.get_round(round_id).to_dict()
|
||||
|
|
@ -307,7 +307,7 @@ def test_four_candidates_execute_concurrently_with_isolated_outputs(tmp_path: Pa
|
|||
active += 1
|
||||
max_active = max(max_active, active)
|
||||
try:
|
||||
barrier.wait(timeout=2.0)
|
||||
barrier.wait(timeout=10.0)
|
||||
return original_execute(task, ctx)
|
||||
finally:
|
||||
with guard:
|
||||
|
|
|
|||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
57
web/assets/index-EHiWqZav.js
普通文件
57
web/assets/index-EHiWqZav.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -4,8 +4,8 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AstrBot ImageStudio</title>
|
||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-D_8_bZ04.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-Cj5Y2axI.css">
|
||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-EHiWqZav.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-Fxlc51Vo.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用