astrbot_plugin_imagestudio/web/assets/WorkflowCandidatePool-DJoqy0B_.js

2 行
9.2 KiB
JavaScript

import{d as R,a as o,e as r,f as d,t as n,h as f,F as X,r as Y,g as k,j as c,_ as Z}from"./index-BoUvGtzh.js";const ee={class:"workflow-candidate-pool","aria-label":"本轮候选池"},te={class:"workflow-candidate-header"},ae={class:"workflow-candidate-header-state"},de={key:0},ie={key:1},ne={key:2},se={key:0,class:"workflow-candidate-readonly"},le={key:1,class:"workflow-candidate-error",role:"alert"},oe={key:2,class:"workflow-candidate-grid"},re={class:"workflow-candidate-card-head"},ue=["title"],ce=["aria-pressed","disabled","title","onClick"],fe=["src","alt"],me={class:"workflow-candidate-image-tags"},_e={key:0},ke={key:1},ve={key:2},be={key:3},ye={key:1,class:"workflow-candidate-placeholder",role:"status"},Ce={class:"workflow-candidate-source"},he=["title"],ge=["title"],we={key:2,class:"workflow-candidate-failure"},pe={class:"workflow-candidate-main-actions"},Se=["disabled","onClick"],Ie=["aria-pressed","disabled","onClick"],$e=["aria-pressed","disabled","onClick"],xe={class:"workflow-candidate-feedback","aria-label":"候选反馈"},Be=["aria-pressed","disabled","title","onClick"],Le=["aria-pressed","disabled","onClick"],je=["aria-pressed","disabled","onClick"],De=["disabled","onClick"],Fe={key:3,class:"workflow-candidate-empty"},ze=R({__name:"WorkflowCandidatePool",props:{candidates:{},roundDisplayCode:{default:""},roundStatus:{default:""},focusedCandidateId:{default:""},comparedCandidateIds:{default:()=>[]},finalCandidateId:{default:""},confirmedCandidateId:{default:""},feedbackByCandidateId:{default:()=>({})},imageUrlByCandidateId:{default:()=>({})},imageFit:{default:"contain"},busyCandidateIds:{default:()=>[]},maxCompared:{default:5},maxLiked:{default:3},loading:{type:Boolean,default:!1},busy:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},confirmed:{type:Boolean,default:!1},error:{default:""},emptyText:{default:"当前轮次还没有候选。"}},emits:["focus","preview","toggle-compare","set-feedback","set-final","retry"],setup(i,{emit:V}){const s=i,y=V,L=new Set(["neutral","liked","rejected","strict_rejected"]),W=new Set(["planned","queued","running","retrying"]),I=new Set(["failed","dead_letter","cancelled"]),j=new Set(["succeeded","success","completed"]),C=c(()=>[...s.candidates].sort((t,a)=>t.display_index-a.display_index)),E=c(()=>new Set(C.value.map(t=>t.candidate_id))),D=c(()=>new Set(s.comparedCandidateIds.filter(t=>E.value.has(t)))),K=c(()=>new Set(s.busyCandidateIds)),h=c(()=>{var t;return s.confirmedCandidateId||((t=C.value.find(a=>a.is_final))==null?void 0:t.candidate_id)||""}),v=c(()=>s.loading||s.busy||s.disabled||s.readOnly||s.confirmed||!!h.value),A=c(()=>s.loading||s.disabled),F=c(()=>D.value.size),G=c(()=>C.value.filter(t=>b(t)).length),z=c(()=>C.value.filter(t=>u(t)==="liked").length),O=c(()=>{const t={active:"进行中",planned:"待入队",queued:"排队中",running:"生成中",completed:"全部成功",partial_success:"部分成功",all_failed:"全部失败",cancelled:"已取消",confirmed:"已确认"},a=s.roundStatus.trim().toLowerCase();return t[a]||s.roundStatus});function w(t){return String(t.candidate.generation_status||"planned").trim().toLowerCase()}function U(t){const a={planned:"待入队",queued:"排队中",running:"生成中",retrying:"重试中",succeeded:"已完成",failed:"生成失败",dead_letter:"重试耗尽",cancelled:"已取消"},e=w(t);return a[e]||t.candidate.generation_status||"未知状态"}function p(t){const a=w(t);return j.has(a)?"succeeded":W.has(a)?"active":I.has(a)?"failed":"unknown"}function q(t){const a=t.image;return s.imageUrlByCandidateId[t.candidate_id]||M(a==null?void 0:a.thumbnail_url)||M(a==null?void 0:a.image_url)||""}function M(t){const a=String(t||"").trim();return/^(?:https?:|data:|blob:|\/)/i.test(a)?a:""}function $(t){return!!q(t)}function S(t){var l,m;const a=String(t.candidate.provider_id||"").trim(),e=String(t.candidate.provider_model||((l=t.image)==null?void 0:l.model_used)||t.candidate.model_route||((m=t.image)==null?void 0:m.model_route)||"").trim();return a&&e&&a!==e?`${a} / ${e}`:a||e||"模<EFBFBD><EFBFBD>