fix: harden ImageStudio queue and vision workflows

这个提交存在于:
YokiiroBW 2026-07-20 17:57:02 +08:00
父节点 3415232b4e
当前提交 91220b9059
共有 38 个文件被更改,包括 2609 次插入 和 471 次删除

查看文件

@ -1,207 +1,318 @@
## 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
- 将脸部年龄风格、实际年龄与身体成熟度拆分处理;画风正向提示词不再继承未成年、青少年或幼态身体措辞,三组验证主体统一为明确成年人,全身验证固定成熟肢体长度与约 6.5~7.5 头身比例。
- 画风核心项、必须保留项及背景、具体光效、具体色盘等易污染内容增加证据门控;仅当多图支持率不低于 60%、置信度不低于 70% 时进入最终提示词。
- 自动还原度评分增加一致性校准:最终分不高于模型自评分,偏差、修正补丁、语义风险和文字严重度会扣分;“维度全满分但同时要求修正”会标记为审核结果不一致。
- 对模型给出的安全改写再做一次语义形状审计;发丝高光中的光环、横带、条块等物体化措辞改写为贴合发丝曲面的半透明断续缎面光泽,并加入白色实线、连续光带、几何折线块等负向约束。
- 公共 detailed 画风胶囊与 portrait/fullbody/novel_scene 尺度胶囊在服务端去重,尺度胶囊只保留该构图尺度独有的约束,减少长提示词的重复注意力占用。
- 默认与模型返回的验证内容统一经过中性化:头像使用哑光棚拍,全身使用中性日光,跨场景使用普通阴天,移除黎明、日落、霓虹、散景、镜头光晕、体积光与戏剧性逆光偏置。
- 灏嗚劯閮ㄥ勾榫勯鏍笺€佸疄闄呭勾榫勪笌韬綋鎴愮啛搴︽媶鍒嗗鐞嗭紱鐢婚姝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
- 详细角色工作流支持逐节点解锁:锁定节点可查看,只有当前节点可操作。
- 前后端增加防越级校验;生图节点必须采用图片后才能推进。
- 提示词规划、素材绑定保存与确认分离,并兼容旧工作流数据。
- 璇︾粏瑙掕壊宸ヤ綔娴佹敮鎸侀€愯妭鐐硅В閿侊細閿佸畾鑺傜偣鍙煡鐪嬶紝鍙湁褰撳墠鑺傜偣鍙搷浣溿€?
- 鍓嶅悗绔鍔犻槻瓒婄骇鏍¢獙锛涚敓鍥捐妭鐐瑰繀椤婚噰鐢ㄥ浘鐗囧悗鎵嶈兘鎺ㄨ繘銆?
- 鎻愮ず璇嶈鍒掋€佺礌鏉愮粦瀹氫繚瀛樹笌纭鍒嗙锛屽苟鍏煎鏃у伐浣滄祦鏁版嵁銆?

查看文件

@ -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,
)

查看文件

@ -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

文件差异内容过多而无法显示 加载差异

查看文件

@ -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__

查看文件

@ -1,7 +1,7 @@
plugin:
name: astrbot_plugin_imagestudio
display_name: ImageStudio
version: 1.0.33
version: 1.0.53
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,7 +43,7 @@ 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
@ -70,12 +70,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 +88,8 @@ advanced_materials:
per_image: 0
per_1k_tokens: 0
# 提示词转译、内容审核和普通/NSFW 模型动态分流。
# 默认只启用本地规则审核;LLM 转译与成人自动分流必须由管理员明确开启。
# 鎻愮ず璇嶈浆璇戙€佸唴瀹瑰鏍稿拰鏅€?NSFW 妯″瀷鍔ㄦ€佸垎娴併€?
# 榛樿鍙惎鐢ㄦ湰鍦拌鍒欏鏍革紱LLM 杞瘧涓庢垚浜鸿嚜鍔ㄥ垎娴佸繀椤荤敱绠$悊鍛樻槑纭紑鍚€?
prompt_governance:
translation:
enabled: false
@ -136,8 +137,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 +149,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 +168,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.33"
PLUGIN_VERSION = "1.0.53"
@dataclass(frozen=True)
@ -87,3 +87,6 @@ class ConfigService:
def _resolve_path(path: str | Path) -> Path:
return resolve_config_path(path)

查看文件

@ -1162,3 +1162,34 @@ main 仍停留在 v1.0.20,因此克隆后必须切换到 codex/ui-navigation-s
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` 的工作树中,尚未提交或推送。
下一步应由用户手动重试画风验证;确认真实生成不再出现前端提前超时后,再提交、推送并制作正式发布包。

查看文件

@ -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,

查看文件

@ -1,12 +1,12 @@
{
"name": "astrbot-plugin-imagestudio-frontend",
"version": "1.0.33",
"version": "1.0.53",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "astrbot-plugin-imagestudio-frontend",
"version": "1.0.33",
"version": "1.0.53",
"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.33",
"version": "1.0.53",
"private": true,
"type": "module",
"scripts": {
@ -23,3 +23,4 @@
},
"devDependencies": {}
}

查看文件

@ -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

查看文件

@ -339,4 +339,14 @@ 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 {
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 {

查看文件

@ -3311,7 +3311,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 +3363,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 +10215,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 +10226,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 +10250,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), {})
@ -13538,7 +13559,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>

查看文件

@ -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,8 @@ const validationInstructionText = ref("")
const decisionNotes = ref("")
const fidelityPercent = ref(85)
const acceptConfirmed = ref(false)
const validationReferenceEnabled = ref(false)
const validationReferenceSourceId = ref("")
let pollTimer = 0
const ownedMediaObjectUrls = new Set<string>()
@ -97,7 +100,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 +123,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 +311,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 +362,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 +373,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 +384,7 @@ async function refreshImportSummaries() {
async function selectImport(importId: string) {
deleteConfirmImportId.value = ""
selectedImportId.value = importId
reviewWorkbenchOpen.value = false
await loadImportDetail(importId)
}
@ -662,10 +693,17 @@ 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),
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 +769,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 +777,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 = "本轮反馈已保存,调整后的下一轮验证图已加入队列。"
@ -1436,6 +1483,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 +1496,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
@ -1483,6 +1531,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">
@ -1517,7 +1592,7 @@ function errorMessage(err: unknown) {
<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="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>
@ -1859,4 +1934,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>

查看文件

@ -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/)
})

查看文件

@ -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.33
short_desc: AstrBot 鍐呯殑瑙掕壊璧勪骇銆佸伐浣滄祦涓庡浘鐗囩敓鎴愮鐞嗗伐浣滃彴銆?
version: 1.0.53
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-w6jYgE11.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-vON1Mq3d.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

查看文件

@ -19,10 +19,14 @@ from backend.services.advanced_style_set_service import (
_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,
_scale_specific_style_prompt,
_scale_transfer_instruction,
_sanitize_validation_content,
_validation_cases,
_weighted_style_fidelity_score,
)
@ -430,6 +434,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")
@ -463,7 +485,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)
@ -489,6 +511,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)
@ -496,8 +522,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(
@ -591,6 +622,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,
@ -599,6 +631,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"),
@ -655,7 +689,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")
@ -748,6 +784,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)
@ -1026,12 +1128,15 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
self.assertNotIn("pre-adolescent", prompt.casefold())
self.assertNotIn("early adolescent", prompt.casefold())
self.assertNotIn("child proportions", prompt.casefold())
self.assertIn("adult", 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.assertIn("adult", fullbody)
self.assertIn("6.5", fullbody)
self.assertIn("7.5", fullbody)
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}
@ -1140,7 +1245,7 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
"scale_capsules": {
"fullbody": (
"thin colored lineart matching local fills, layered irises with multiple catchlights, "
"adult body proportions between 6.5 and 7.5 heads tall"
"source head-to-body ratio around 1:6 with slender limbs"
)
},
"feature_evidence": [
@ -1155,9 +1260,10 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
).casefold()
self.assertNotIn("thin colored lineart", scale)
self.assertNotIn("layered irises", scale)
self.assertIn("adult body proportions", scale)
self.assertIn("head-to-body", scale)
self.assertIn("1:6", scale)
def test_validation_cases_force_adult_subject_and_neutral_scene_lighting(self) -> None:
def test_validation_cases_keep_age_band_open_and_neutral_scene_lighting(self) -> None:
cases = _validation_cases(
[
{
@ -1176,13 +1282,13 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
None,
)
portrait, fullbody, novel = [item["content_prompt"].casefold() for item in cases]
self.assertIn("adult", portrait)
self.assertNotIn("mature adult", portrait)
self.assertNotIn("the depicted character is an adult", portrait)
self.assertNotIn("neon", portrait)
self.assertNotIn("bokeh", portrait)
self.assertIn("6.5", fullbody)
self.assertIn("7.5", fullbody)
self.assertNotIn("youthful full body", fullbody)
self.assertIn("adult", novel)
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)
@ -1190,5 +1296,291 @@ class AdvancedStyleSetWorkflowTests(unittest.TestCase):
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_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"])
if __name__ == "__main__":
unittest.main()

查看文件

@ -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 普通文件
查看文件

@ -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:

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

文件差异因一行或多行过长而隐藏

查看文件

@ -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-D3hLsIA0.js"></script>
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-sCOYj51_.css">
</head>
<body>
<div id="app"></div>