1import{r as e,j as t}from"./vendor-react-DejgYtBM.js";import{L as n,f as r,m as s,o as l,R as i,C as a,k as o,D as d,B as c,j as u,y as h,i as p,G as m,W as y,V as g,X as x,l as f,O as j}from"./vendor-semi-D8d7bTtM.js";import{A as _,s as v,w as b}from"./index-BeIIFw6E.js";import"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";const{Content:w}=n,{Title:S,Text:k}=r,A="__model_verify_schedule_list_all__";function C(e){const t=e.group??e.Group??"",n=String(t).split(",").map(e=>e.trim()).filter(Boolean);return n.length?n:["default"]}function I(e,t){return Array.isArray(t)&&0!==t.length?e.filter(e=>t.some(t=>t&&function(e,t){return!t||"all"===t||C(e).includes(t)}(e,t))):e}const z=[{key:"official",title:"宿¹æ¨¡åç伪快æ£",description:"ä¾§éåè®®ä¸è´æ§ã注å
¥æ··æ·ä¸éèå·¥å
·ä¿¡å·ãä¸»è¦æµè¯è¿ä¸ª",protocol:"auto",suites:""},{key:"injection",title:"注å
¥ææ§å¿«æ£",description:"éªè¯ç´æ¥ä¸é´æ¥æç¤ºæ³¨å
¥ãç½ååç»è¿çï¼å»ºè®® Claude/Messages é¾è·¯ï¼ã",protocol:"anthropic",suites:"params,error,injection,authenticity"},{key:"toolchain",title:"ç¼å+å·¥å
·é¾ç龿µè¯",description:"è¦ç cache_controlãtool_useãtool_choice çåºç¡é¾è·¯ã",protocol:"anthropic",suites:"cache,tools,toolchoice,params,error"}];function $(e){if(!e)return"-";if("custom"===e)return"èªå®ä¹ï¼é«çº§é项ï¼";const t=z.find(t=>t.key===e);return t?t.title:e}function O(e){if(!e||"string"!=typeof e)return"â";try{const t=JSON.parse(e),n=t?.results;return Array.isArray(n)&&0!==n.length?n.map(e=>`${e.suite||"-"}:${e.status||"-"}`).join(" · "):"â"}catch{return"â"}}function T(e){const n=String(e||"").toLowerCase();return"pending"===n||"queued"===n?t.jsx(p,{color:"grey",children:"pending"}):"running"===n||"processing"===n?t.jsx(p,{color:"blue",children:"running"}):"completed"===n||"success"===n||"succeeded"===n?t.jsx(p,{color:"green",children:"completed"}):"failed"===n||"error"===n?t.jsx(p,{color:"red",children:"failed"}):"pass"===n?t.jsx(p,{color:"green",children:"pass"}):"warn"===n?t.jsx(p,{color:"orange",children:"warn"}):"fail"===n?t.jsx(p,{color:"red",children:"fail"}):t.jsx(p,{children:"unknown"})}function V({scheduleId:n,onOpenDetail:r}){const[s,l]=e.useState(!1),[i,a]=e.useState(1),[o,d]=e.useState(null),u=e.useCallback(async()=>{l(!0);try{const e=await _.get(`/api/model_verify/schedules/${n}/today_results`,{params:{page:i,page_size:10}});d(e.data?.data??null)}catch(e){v(e),d(null)}finally{l(!1)}},[n,i]);e.useEffect(()=>{u()},[u]);const p=o?.total_groups??0,m=o?.groups??[];return t.jsx("div",{style:{padding:"10px 16px 16px 48px",background:"hsl(var(--foreground) / 0.02)"},children:t.jsxs(f,{spinning:s,children:[t.jsx(k,{type:"tertiary",size:"small",style:{display:"block",marginBottom:10},children:0===o?.total_records?"仿¥å°æ 宿¶æ§è¡è®°å½ï¼ææå¡å¨æ¬å°æ¥åæ¥ç»è®¡ï¼ãå±å¼åç¹å»åç»/æ¸ é坿¥ç忬¡ç»æã":`仿¥ ${o?.day_label||""} å
± ${o.total_records} æ¡è®°å½ï¼æé£ç´æåç»ææ¸ éå½ç±»ãæ¬é¡µ ${m.length} 个åç»/æ¸ éï¼å
± ${p} ä¸ªï¼æ¯é¡µ 10 个ï¼ã`}),m.length>0?t.jsxs(t.Fragment,{children:[t.jsx(x,{accordion:!0,style:{maxWidth:960},children:m.map(e=>t.jsx(x.Panel,{header:`${e.label}ï¼${e.records?.length||0} æ¡ï¼`,itemKey:`${e.kind}:${e.key}`,children:t.jsx(h,{size:"small",rowKey:"id",pagination:!1,dataSource:e.records||[],columns:[{title:"æ¶é´",dataIndex:"created_time",width:168,render:e=>e?new Date(1e3*e).toLocaleString():"-"},{title:"ç¶æ",dataIndex:"status",width:100,render:e=>T(e)},{title:"å¥ä»¶æè¦",dataIndex:"report_json",ellipsis:!0,render:e=>t.jsx(k,{size:"small",ellipsis:{showTooltip:!0},children:O(e)})},{title:"é误",dataIndex:"error",ellipsis:!0,render:e=>e||"â"},{title:"æä½",width:88,render:(e,n)=>t.jsx(c,{size:"small",type:"tertiary",onClick:()=>r(n.id),children:"详æ
"})}]})}))}),p>10?t.jsx(j,{style:{marginTop:12},currentPage:i,pageSize:10,total:p,onPageChange:e=>a(e),showSizeChanger:!1}):null]}):null]})})}function N(e){if(!e)return"";const t=e.id??e.Id,n=e.name??e.Name;return`${("string"==typeof n?n.trim():"")||"æªå½åæ¸ é"}ï¼#${t}ï¼ç±»å ${e.type??e.Type??""}ï¼`}function B(){const[r,f]=e.useState(!1),[j,O]=e.useState([]),[B,D]=e.useState([]),[E,R]=e.useState(!0),[L,M]=e.useState(!1),[W,K]=e.useState([]),[q,J]=e.useState(0),[F,H]=e.useState(1),[G]=e.useState(10),[X,Q]=e.useState(null),[U,Y]=e.useState(null),Z=e.useRef(null),[ee,te]=e.useState(!1),[ne,re]=e.useState([]),[se,le]=e.useState(0),[ie,ae]=e.useState(1),[oe]=e.useState(10),[de,ce]=e.useState(!1),[ue,he]=e.useState(null),pe=e.useRef(null),[me,ye]=e.useState([]),[ge,xe]=e.useState(A),[fe,je]=e.useState([]),[_e,ve]=e.useState([]),be=e.useRef(!0),we="claude-opus-4-7",Se=e.useMemo(()=>function(e){const t=new Set;for(const n of e)for(const e of C(n))t.add(e);return Array.from(t).sort((e,t)=>
1e.localeCompare(t,"zh-CN"))}(B),[B]),ke=e.useMemo(()=>I(B,me),[B,me]),Ae=e.useMemo(()=>I(B,_e),[B,_e]),Ce=e.useCallback(async()=>{try{const e=await _.get("/api/user/models"),t=e.data?.data||[];O(Array.isArray(t)?t:[]),R(!0)}catch(e){O([]),R(!1)}},[]),Ie=e.useCallback(async()=>{try{const e=[];let t=1;const n=100;for(;;){const r=await _.get("/api/channel/",{params:{page:t,page_size:n,id_sort:!0}}),s=r.data?.data,l=Array.isArray(s?.items)?s.items:[],i="number"==typeof s?.total?s.total:null;if(e.push(...l),0===l.length||t>500)break;if(null!=i&&e.length>=i)break;if(l.length<n)break;t+=1}D(e)}catch(e){v(e)}},[]),ze=e.useCallback(async()=>{M(!0);try{const e=await _.get("/api/model_verify/",{params:{page:F,page_size:G}}),t=e.data?.data;K(t?.items||[]),J(t?.total||0)}catch(e){v(e)}finally{M(!1)}},[F,G]);e.useEffect(()=>{Ce(),Ie()},[Ce,Ie]),e.useEffect(()=>{if(!U)return;if(!E)return;if(!Array.isArray(j)||0===j.length)return;if(!j.includes(we))return;const e=U.getValue("model_name");"string"==typeof e&&""!==e.trim()||U.setValue("model_name",we)},[U,E,j]),e.useEffect(()=>{ze()},[ze]);const $e=e.useCallback(async e=>{const t=e&&"number"==typeof e.page&&e.page>0?e.page:ie;te(!0);try{const e={page:t,page_size:oe};ge&&ge!==A&&(e.channel_group=ge);const n=await _.get("/api/model_verify/schedules",{params:e}),r=n.data?.data;re(r?.items||[]),le(r?.total||0)}catch(n){v(n)}finally{te(!1)}},[ie,oe,ge]);e.useEffect(()=>{$e()},[$e]),e.useEffect(()=>{je([])},[ie,ge]),e.useEffect(()=>{const e=Z.current;if(!e)return;if(me.length>0)return void e.setValue("channel_ids",[]);const t=e.getValue("channel_ids");if(!Array.isArray(t)||0===t.length)return;const n=new Set(ke.map(e=>e.id??e.Id)),r=t.filter(e=>n.has(e));r.length!==t.length&&e.setValue("channel_ids",r)},[me,ke,B,U]),e.useEffect(()=>{const e=pe.current;if(!e||!de)return;if(_e.length>0)return void e.setValue("channel_ids",[]);const t=e.getValue("channel_ids");if(!Array.isArray(t)||0===t.length)return;const n=new Set(Ae.map(e=>e.id??e.Id)),r=t.filter(e=>n.has(e));r.length!==t.length&&e.setValue("channel_ids",r)},[_e,Ae,B,de]);const Oe=async e=>{try{const t=await _.get(`/api/model_verify/${e}`),n=t.data?.data;Q(n?.record||n)}catch(t){v(t)}},Te=async(e={})=>{if(!U)return;try{await U.validate()}catch{return}const t=U.getValues(),n=e.protocol??t.protocol??"auto",r=void 0!==e.suites?e.suites:t.suites??"",s=void 0!==e.scenario?e.scenario:"custom";f(!0);try{const e=[...new Set((me||[]).map(e=>String(e).trim()).filter(Boolean))],l=e.length>0,i=Array.isArray(t.channel_ids)?t.channel_ids:[],a=[...new Set(i.filter(e=>null!=e))],o=await _.post("/api/model_verify/run",{model_meta_id:0,model_name:t.model_name||"",channel_id:0,channel_ids:l?[]:a,channel_group:"",channel_groups:e,protocol:n,suites:r,scenario:s,async:!!t.async,use_user_token:!!t.use_user_token}),d=o.data?.data;if(d?.async){const e=Array.isArray(d.ids)&&d.ids.length?d.ids.join(","):d.id;if(b(`ä»»å¡å·²å建 id=${e}ï¼å¯å¨åè¡¨ä¸æ¥çè¿åº¦`),t.open_sse&&Array.isArray(d.ids)&&1===d.ids.length){const e=new EventSource(`/api/model_verify/${d.ids[0]}/events`,{withCredentials:!0});e.addEventListener("final",t=>{try{const e=JSON.parse(t.data);Q(e)}catch{}e.close(),ze()}),e.onerror=()=>e.close()}}else d?.records&&Array.isArray(d.records)&&d.records.length>1?(Q(d.records[d.records.length-1]),b(`éªç宿ï¼${d.records.length} ä¸ªæ¸ éï¼`)):(Q(d?.records?.[0]??d),b("éªç宿"));ze()}catch(l){v(l)}finally{f(!1)}},Ve=[{title:"ID",dataIndex:"id",width:70},{title:"模å",dataIndex:"model_name",width:180},{title:"åè®®",dataIndex:"protocol",width:100},{title:"æµè¯åºæ¯",dataIndex:"scenario",width:200,ellipsis:!0,render:e=>$(e)},{title:"ç¶æ",dataIndex:"status",width:100},{title:"æ¶é´",dataIndex:"created_time",render:e=>e?new Date(1e3*e).toLocaleString():"-"},{title:"æä½",key:"actions",render:(e,n)=>t.jsx(c,{size:"small",onClick:()=>Oe(n.id),children:"详æ
"})}];let Ne=null,Be=null;if(X?.report_json)try{Ne=JSON.parse(X.report_json),Ne&&"object"==typeof Ne&&!Array.isArray(Ne)&&delete Ne.endpoint}catch{Ne=null}if(X?.trust_json)try{Be=JSON.parse(X.trust_json)}catch{Be=null}const Pe=Array.isArray(Ne?.results)?Ne.results.map((e,t)=>({key:`${t}-${e.suite??"row"}`,suite:e.suite,status:e.status,summary:e.summary,duration_ms:e.duration_ms,findings:e.findings,metrics:e.metrics,error:e.error})):[],De=(()=>{const e=Pe.find(e=>"authenticity"===String(e.suite||"").toLowerCase()),t=e?.metrics?.spoof_risk_score;return"number"==typeof t?t:null})(),Ee=(()=>{const e=Be?.metrics?.trust_score_final??Be?.metrics?.trust_score;return"number"==typeof e?e:"string"!=typeof e||""===e.trim()||Number.isNaN(Number(e))?null:Number(e)})(),Re=({label:e,value:n})=>{const r=(e=>{if(null==e)return null;const t="number"==typeof e?e:Number(e);return Number.isNaN(t)?null:t>=0&&t<=1?Math.round(100*t):t>=0&&t<=100?Math.round(t):Math.round(Math.max(0,Math.min(100,t)))})(n)??0,s=null==n?"-":"number"==typeof n?n.toFixed(2):String(n);return t.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[t.jsxs("div",{style:{position:"relative",width:56,height:56,flex:"0 0 56px"},children:[t.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:`conic-gradient(rgba(16, 185, 129, 0.75) ${3.6*r}deg, rgba(16, 185, 129, 0.18) 0deg)`,transition:"background 240ms ease",WebkitMask:"radial-gradient(farthest-side, transparent 62%, #000 63%)",mask:"radial-gradient(farthest-side, transparent 62%, #000 63%)"}}),t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:13,color:"hsl(var(--foreground))"},children:s})]}),t.jsxs("div",{children:[t.jsx(k,{type:"tertiary",size:"small",style:{display:"block"},children:e}),t.jsx(k,{strong:!0,style:{fontSize:18},children:s})]})]})},Le=[{title:"Suite",dataIndex:"suite",width:140},{title:"ç¶æ",dataIndex:"status",width:90,render:e=>T(e)},{title:"æè¦",dataIndex:"summary"},{title:"èæ¶(ms)",dataIndex:"duration_ms",width:110}],Me={borderRadius:12,boxShadow:"0 1px 4px rgba(15, 23, 42, 0.06)",border:"1px solid hsl(var(--border))",background:"hsl(var(--card))"},We={...Me,height:"100%",display:"flex",flexDirection:"column"};return t.jsx(n,{className:"",style:{minHeight:"calc(100vh - var(--app-header-offset, 80px))",background:"hsl(var(--background))"},children:t.jsxs(w,{style:{padding:"28px 24px 48px",maxWidth:1120,margin:"0 auto"},children:[t.jsxs("div",{style:{marginBottom:24},children:[t.jsx(S,{heading:3,style:{marginBottom:8,fontWeight:700},children:"模åéªç"}),t.jsx(k,{strong:!0,style:{fontSize:15,color:"hsl(var(--foreground))"},children:"Claude API å¿«æ£"}),t.jsx(P,{style:{marginTop:10},children:"æé¢è®¾åºæ¯åèµ·æ¢æµï¼é»è®¤ä½¿ç¨æéæ¸ éé
ç½®ç䏿¸¸ API å°å䏿¸ éå¯é¥ç´è¿æ¥è¯¢ãé«çº§é项ä¸å¯å¼å¯ãç¨æ·ä»¤ç模å¼ãï¼æ¹ä¸ºç¨ä¸ªäººä»¤çè¯·æ±æ¬ç«æ¥å£ï¼
1æ¶èé¢åº¦ï¼ã"})]}),t.jsx(s,{bodyStyle:{padding:24},style:Me,children:t.jsxs(l,{initValues:{async:!0,open_sse:!0,channel_ids:[]},getFormApi:e=>{Z.current=e,Y(e)},onValueChange:()=>{const e=Z.current;if(!e)return;const t=!!e.getValue("async");t&&!be.current&&e.setValue("open_sse",!0),be.current=t},labelPosition:"top",layout:"vertical",children:[t.jsx(i,{gutter:[16,0],children:t.jsx(a,{xs:24,children:E?t.jsx(l.Select,{field:"model_name",label:"模å ID",rules:[{required:!0,message:"è¯·éæ©æ¨¡å"}],filter:!0,placeholder:"éæ©æ¨¡å",style:{width:"100%"},children:j.map(e=>t.jsx(o.Option,{value:e,children:e},e))}):t.jsx(l.Input,{field:"model_name",label:"模å ID",rules:[{required:!0,message:"请è¾å
¥æ¨¡åå"}],placeholder:"ä¾å¦ claude-opus-4-7"})})}),t.jsx(i,{gutter:[16,16],style:{marginTop:16},children:t.jsxs(a,{xs:24,children:[t.jsxs(l.Select,{field:"strictness",label:"ä¸¥æ ¼åº¦",initValue:"balanced",children:[t.jsx(o.Option,{value:"fast",children:"fast"}),t.jsx(o.Option,{value:"balanced",children:"balanced"}),t.jsx(o.Option,{value:"forensic",children:"forensic"})]}),t.jsx(k,{type:"tertiary",size:"small",style:{marginTop:4,display:"block"},children:"å½å为çé¢é¢è®¾ï¼ä¸å½±åæå¡ç«¯å¥ä»¶æéï¼åç»å¯ä¸ HardGate 对é½ï¼"})]})}),t.jsx(d,{margin:"24px"}),t.jsx("div",{style:{marginBottom:12},children:t.jsx(k,{strong:!0,style:{fontSize:15},children:"æµè¯åºæ¯"})}),t.jsx(i,{gutter:[16,16],style:{alignItems:"stretch"},children:z.map(e=>t.jsx(a,{xs:24,md:8,style:{display:"flex"},children:t.jsxs(s,{bodyStyle:{padding:16,flex:1},style:{...We,flex:1},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(k,{strong:!0,style:{fontSize:15,display:"block",marginBottom:8},children:e.title}),t.jsx(P,{children:e.description})]}),t.jsx(c,{block:!0,theme:"solid",type:"primary",loading:r,style:{marginTop:16},onClick:()=>Te({protocol:e.protocol,suites:e.suites,scenario:e.key}),children:"å¼å§æµè¯"})]})},e.key))}),t.jsx(d,{margin:"24px"}),t.jsxs("details",{style:{cursor:"pointer"},children:[t.jsx("summary",{style:{fontWeight:600,marginBottom:12},children:"é«çº§é项"}),t.jsx(i,{gutter:[16,0],style:{marginBottom:12},children:t.jsxs(a,{xs:24,md:12,children:[t.jsx(k,{type:"secondary",size:"small",style:{display:"block",marginBottom:6},children:"æ¸ éåç»ï¼å¤éï¼ä¸éåæä¸æ¹åºå®æ¸ éï¼å¤éæ¶æ¯ä¸ªåç»ä¾æ¬¡éªçï¼"}),t.jsx(o,{multiple:!0,maxTagCount:3,showClear:!0,value:me,onChange:e=>ye(Array.isArray(e)?e:[]),placeholder:"ä¸é = 䏿åç»",style:{width:"100%"},children:Se.map(e=>t.jsx(o.Option,{value:e,children:e},e))})]})}),t.jsxs(i,{gutter:[16,0],children:[t.jsxs(a,{xs:24,md:12,children:[t.jsx(l.Select,{field:"channel_ids",label:"æ¸ éï¼å¯å¤éï¼ä¸æ¹éäºåç»æ¶ä»¥åç»ä¸ºåï¼å¿½ç¥æ¤å¤ï¼",multiple:!0,maxTagCount:3,showClear:!0,filter:!0,style:{width:"100%"},children:ke.map(e=>{const n=e.id??e.Id;return t.jsx(o.Option,{value:n,children:N(e)},n)})}),t.jsx(c,{size:"small",type:"tertiary",style:{marginTop:8},onClick:()=>{const e=Z.current;e&&e.setValue("channel_ids",[])},children:"æ¸
é¤éæ©"})]}),t.jsx(a,{xs:24,md:12,children:t.jsxs(l.Select,{field:"protocol",label:"åè®®",initValue:"auto",style:{width:"100%"},children:[t.jsx(o.Option,{value:"auto",children:"èªå¨"}),t.jsx(o.Option,{value:"anthropic",children:"Anthropic"}),t.jsx(o.Option,{value:"openai",children:"OpenAI å
¼å®¹"})]})})]}),t.jsx(l.Input,{field:"suites",label:"å¥ä»¶ï¼éå·åéï¼ç空é»è®¤ï¼",placeholder:"ä¾å¦ params,error,authenticity æ all",style:{marginTop:12}}),t.jsxs(u,{style:{marginTop:12},wrap:!0,children:[t.jsx(l.Checkbox,{field:"async",children:"弿¥æ§è¡"}),t.jsx(l.Checkbox,{field:"open_sse",children:"弿¥æ¶è®¢é
SSE"}),t.jsx(l.Checkbox,{field:"use_user_token",children:"ç¨æ·ä»¤ç模å¼ï¼èµ°æ¬ç« /v1ï¼æ¶èé¢åº¦ï¼"})]}),t.jsx(c,{theme:"solid",type:"tertiary",loading:r,style:{marginTop:16},onClick:()=>Te({}),children:"æé«çº§é项å¼å§éªç"})]})]})}),t.jsxs("div",{style:{marginTop:28},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,flexWrap:"wrap",gap:12},children:[t.jsx(S,{heading:6,style:{margin:0},children:"宿¶æ£æµ"}),t.jsxs(u,{wrap:!0,children:[t.jsxs(o,{value:ge,onChange:e=>{xe(e??A),ae(1)},style:{width:220},placeholder:"å
¨é¨ä»»å¡",children:[t.jsx(o.Option,{value:A,children:"å
¨é¨ä»»å¡"}),Se.map(e=>t.jsx(o.Option,{value:e,children:e},e))]}),t.jsx(c,{type:"primary",theme:"solid",onClick:()=>{he(null),ve([]),ce(!0),setTimeout(()=>{const e=pe.current;e&&e.setValues({name:"",model_name:E&&j.includes(we)?we:"",channel_ids:[],protocol:"auto",suites:"",scenario:"custom",use_user_token:!1,enabled:!0,interval_minutes:60})},0)},children:"æ°å»ºå®æ¶ä»»å¡"})]})]}),t.jsx(P,{style:{marginBottom:12},children:"主èç¹æé´éèªå¨æ§è¡éªçï¼å¯å¤éåºå®æ¸ é便¬¡éªçï¼æå¤éæ¸ éåç»ï¼æ¯ç»å¨æéæ¸ å¹¶ä¾æ¬¡æ§è
1¡ï¼ä¸åºå®æ¸ éåæ¶å¡«æ¶ä»¥åç»ä¸ºåï¼ãå¤åç»ä¸å¤æ¸ éå䏿¯æç¨æ·ä»¤ç模å¼ãé»è®¤èµ°æ¸ é䏿¸¸å¯é¥ï¼å¾éãç¨æ·ä»¤ç模å¼ãæ¶éé
ç½®ç³»ç» ServerAddressï¼å¹¶æ¶è任塿å±ç¨æ·çé¢åº¦ãè¡¨æ ¼é»è®¤å±ç¤ºå
¨é¨å®æ¶ä»»å¡ï¼å¯éè¿ä¸æ¹ä¸æææ¸ éåç»çéã"}),t.jsx(s,{bodyStyle:{padding:16},style:Me,children:t.jsx(h,{loading:ee,rowKey:"id",expandedRowRender:e=>t.jsx(V,{scheduleId:e.id,onOpenDetail:Oe}),expandedRowKeys:fe,onExpand:(e,t)=>{const n=t.id;je(t=>e?t.includes(n)?t:[...t,n]:t.filter(e=>e!==n))},columns:[{title:"ID",dataIndex:"id",width:64},{title:"åç§°",dataIndex:"name",width:120,ellipsis:!0,render:e=>e||"-"},{title:"模å",dataIndex:"model_name",width:160,ellipsis:!0},{title:"æ¸ é",dataIndex:"channel_id",width:220,ellipsis:!0,render:(e,t)=>{const n=Array.isArray(t.channel_groups)&&t.channel_groups.length>0?t.channel_groups:t.channel_group?[t.channel_group]:[];if(n.length>0&&(!e||0===e))return n.length>1?`æåç»: ${n.join(", ")}`:`æåç»: ${n[0]}`;const r=Array.isArray(t.channel_ids)&&t.channel_ids.length>0?t.channel_ids:e>0?[e]:[];return r.length>1?function(e,t){return Array.isArray(e)&&0!==e.length?e.map(e=>{const n=t.find(t=>(t.id??t.Id)===e);return n?N(n):`#${e}`}).join(" · "):"-"}(r,B):t.channel_name||(e?`#${e}`:"-")}}
1,{title:"åç»",width:120,ellipsis:!0,render:(e,t)=>{const n=Array.isArray(t.channel_groups)&&t.channel_groups.length>0?t.channel_groups:t.channel_group?[t.channel_group]:[];return n.length?n.join(", "):(r=B.find(e=>(e.id??e.Id)===t.channel_id))?C(r).join(", "):"-";var r}},{title:"é´é(å)",dataIndex:"interval_minutes",width:88},{title:"å¯ç¨",dataIndex:"enabled",width:72,render:e=>e?t.jsx(p,{color:"green",children:"æ¯"}):t.jsx(p,{children:"å¦"})},{title:"䏿¬¡æ§è¡",dataIndex:"next_run_at",width:160,render:e=>e?new Date(1e3*e).toLocaleString():"-"},{title:"䏿¬¡/æè¿é误",dataIndex:"last_error",ellipsis:!0,render:(e,n)=>t.jsxs("span",{title:e||"",children:[n.last_run_at?new Date(1e3*n.last_run_at).toLocaleString():"-",e?` · ${e}`:""]})},{title:"仿¥æ§è¡",width:200,render:(e,n)=>{const r=n.today_summary;return r&&r.count?t.jsxs(u,{vertical:!0,align:"start",spacing:4,children:[t.jsxs(k,{size:"small",children:[r.count," æ¡ Â· æå ",r.completed," · 失败 ",r.failed,r.running?` · è¿è¡ä¸ ${r.running}`:""]}),r.last_at?t.jsxs(k,{type:"tertiary",size:"small",children:["æè¿ ",new Date(1e3*r.last_at).toLocaleString()]}):null]}):t.jsx(k,{type:"tertiary",size:"small",children:"æ "})}},{title:"æä½",width:160,render:(e,n)=>t.jsxs(u,{children:[t.jsx(c,{size:"small",onClick:()=>(e=>{he(e.id);const t=Array.isArray(e.channel_groups)?e.channel_groups.filter(Boolean):[],n=(e.channel_group||"").trim();if(t.length>0)ve(t);else if(n)ve([n]);else{const t=B.find(t=>(t.id??t.Id)===e.channel_id);if(t){const e=C(t);ve(e[0]?[e[0]]:[])}else ve([])}ce(!0),setTimeout(()=>{const t=pe.current;if(t){const n=Array.isArray(e.channel_ids)&&e.channel_ids.length>0?e.channel_ids:e.channel_id>0?[e.channel_id]:[];t.setValues({name:e.name||"",model_name:e.model_name||"",channel_ids:n,protocol:e.protocol||"auto",suites:e.suites||"",scenario:e.scenario||"custom",use_user_token:!!e.use_user_token,enabled:!!e.enabled,interval_minutes:e.interval_minutes||60})}},0)})(n),children:"ç¼è¾"}),t.jsx(m,{title:"ç¡®å®å é¤è¯¥å®æ¶ä»»å¡ï¼",onConfirm:()=>(async e=>{try{await _.delete(`/api/model_verify/schedules/${e}`),b("å·²å é¤"),$e()}catch(t){v(t)}})(n.id),children:t.jsx(c,{size:"small",type:"danger",children:"å é¤"})})]})}],dataSource:ne,pagination:{currentPage:ie,pageSize:oe,total:se,onPageChange:e=>ae(e)}})})]}),t.jsx(y,{title:ue?`ç¼è¾å®æ¶ä»»å¡ #${ue}`:"æ°å»ºå®æ¶ä»»å¡",visible:de,onCancel:()=>ce(!1),width:520,children:t.jsxs(l,{getFormApi:e=>{pe.current=e},onValueChange:(e,t)=>
1{if(!t||void 0===t.scenario)return;const n=pe.current;if(!n)return;const r=z.find(e=>e.key===t.scenario);r&&(n.setValue("protocol",r.protocol),n.setValue("suites",r.suites))},labelPosition:"top",layout:"vertical",children:[t.jsx(l.Input,{field:"name",label:"夿³¨åç§°",placeholder:"å¯é"}),E?t.jsx(l.Select,{field:"model_name",label:"模å ID",rules:[{required:!0,message:"è¯·éæ©æ¨¡å"}],filter:!0,getPopupContainer:()=>document.body,style:{width:"100%"},children:j.map(e=>t.jsx(o.Option,{value:e,children:e},e))}):t.jsx(l.Input,{field:"model_name",label:"模å ID",rules:[{required:!0,message:"请è¾å
¥æ¨¡åå"}]}),t.jsx(k,{type:"secondary",size:"small",style:{display:"block",marginBottom:6},children:"æ¸ éåç»ï¼å¤éï¼ï¼ä¸éåé¡»é䏿¹åºå®æ¸ éï¼éäºåç»åæååç»ä¾æ¬¡å¨æéæ¸ ï¼ä¿åæ¶å¿½ç¥ä¸æ¹æ¸ éï¼ã"}),t.jsx(o,{multiple:!0,maxTagCount:3,showClear:!0,getPopupContainer:()=>document.body,value:_e,onChange:e=>{const t=Array.isArray(e)?e:[];ve(t);const n=pe.current;n&&t.length>0&&n.setValue("channel_ids",[])},placeholder:"ä¸é = ä»
ç¨åºå®æ¸ é",style:{width:"100%",marginBottom:12},children:Se.map(e=>t.jsx(o.Option,{value:e,children:e},e))}),t.jsx(l.Select,{field:"channel_ids",label:"æ¸ éï¼æªéåç»æ¶è³å°éä¸ä¸ªï¼å¯å¤éï¼",multiple:!0,maxTagCount:3,rules:0===_e.length?[{required:!0,message:"è¯·éæ©æ¸ é"}]:[],filter:!0,getPopupContainer:()=>document.body,style:{width:"100%"},children:Ae.map(e=>{const n=e.id??e.Id;return t.jsx(o.Option,{value:n,children:N(e)},n)})}),t.jsxs(l.Select,{field:"scenario",label:"æµè¯åºæ¯",initValue:"custom",getPopupContainer:()=>document.body,style:{width:"100%"},children:[z.map(e=>t.jsx(o.Option,{value:e.key,children:e.title},e.key)),t.jsx(o.Option,{value:"custom",children:"èªå®ä¹ï¼é«çº§é项ï¼"},"custom")]}),t.jsxs(l.Select,{field:"protocol",label:"åè®®",initValue:"auto",getPopupContainer:()=>document.body,style:{width:"100%"},children:[t.jsx(o.Option,{value:"auto",children:"èªå¨"}),t.jsx(o.Option,{value:"anthropic",children:"Anthropic"}),t.jsx(o.Option,{value:"openai",children:"OpenAI å
¼å®¹"})]}),t.jsx(l.Input,{field:"suites",label:"å¥ä»¶ï¼éå·åéï¼ç空é»è®¤ï¼"}),t.jsx(l.InputNumber,{field:"interval_minutes",label:"é´éï¼åéï¼1â10080ï¼",min:1,max:10080,initValue:60,style:{width:"100%"}}),t.jsxs(u,{wrap:!0,style:{marginTop:8},children:[t.jsx(l.Checkbox,{field:"enabled",children:"å¯ç¨"}),t.jsx(l.Checkbox,{field:"use_user_token",children:"ç¨æ·ä»¤ç模å¼"})]}),t.jsx(c,{theme:"solid",type:"primary",block:!0,style:{marginTop:20},onClick:async()=>{const e=pe.current;if(!e)return;try{await e.validate()}catch{return}const t=e.getValues(),n=[...new Set((_e||[]).map(e=>String(e).trim()).filter(Boolean))],r=Array.isArray(t.channel_ids)?t.channel_ids:[],s=[...new Set(r.filter(e=>null!=e))];if(0===n.length&&0===s.length)return void v(new Error("è¯·éæ©è³å°ä¸ä¸ªæ¸ éï¼æå¨ä¸æ¹éæ©è³å°ä¸ä¸ªåç»"));const l={name:(t.name||"").trim(),model_name:(t.model_name||"").trim(),channel_id:n.length?0:1===s.length?s[0]:0,channel_ids:n.length?[]:s,channel_group:"",channel_groups:n,protocol:t.protocol||"auto",suites:t.suites||"",scenario:(t.scenario||"").trim()||"custom",use_user_token:!!t.use_user_token,enabled:!!t.enabled,interval_minutes:Number(t.interval_minutes)||60};try{ue?(await _.put(`/api/model_verify/schedules/${ue}`,l),b("å·²æ´æ°å®æ¶ä»»å¡")):(await _.post("/api/model_verify/schedules",l),b("å·²åå»ºå®æ¶ä»»å¡"),ae(1)),ce(!1),$e(ue?void 0:{page:1})}catch(i){v(i)}},children:"ä¿å"})]})}),t.jsxs("div",{style:{marginTop:28},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,flexWrap:"wrap",gap:8},children:[t.jsx(S,{heading:6,style:{margin:0},children:"åå²è®°å½"}),t.jsx(c,{type:"tertiary",loading:L,onClick:()=>ze(),children:"å·æ°"})]}),t.jsx(s,{bodyStyle:{padding:16},style:Me,children:t.jsx(h,{loading:L,columns:Ve,dataSource:W,pagination:{currentPage:F,pageSize:G,total:q,onPageChange:e=>H(e)}})})]}),t.jsx(y,{title:`éªç详æ
#${X?.id||""}`,visible:!!X,onCancel:()=>Q(null),width:860,children:X?t.jsxs("div",{style:{maxHeight:"calc(100vh - 140px)",overflow:"auto",paddingRight:6},children:[t.jsx(g,{size:"small",data:[{key:"ç¶æ",value:T(X.status)},{key:"åè®®",value:X.protocol||"-"},{key:"æµè¯åºæ¯",value:$(X.scenario)},{key:"模å",value:X.model_name||"-"},{key:"æ¸ é",value:X.channel_id??"-"},{key:"å建æ¶é´",value:X.created_time?new Date(1e3*X.created_time).toLocaleStr
1ing():"-"},{key:"é误",value:X.error||"-"}]}),t.jsx("div",{style:{marginTop:16},children:t.jsx(s,{bodyStyle:{padding:12},style:{...Me,borderStyle:"dashed"},children:t.jsxs(i,{gutter:[16,12],style:{alignItems:"center"},children:[t.jsx(a,{xs:24,sm:12,children:t.jsx(Re,{label:"Spoof Risk",value:De})}),t.jsx(a,{xs:24,sm:12,children:t.jsx(Re,{label:"Trust Score",value:Ee})}),t.jsx(a,{xs:24,children:t.jsxs(k,{type:"tertiary",size:"small",children:["HardGateFail=",Be?.metrics?.hard_gate_fail??"-"]})})]})})}),t.jsxs("div",{style:{marginTop:16},children:[t.jsx(S,{heading:6,children:"å¥ä»¶ç»æ"}),t.jsx(h,{size:"small",pagination:!1,columns:Le,dataSource:Pe,rowKey:"key"})]}),t.jsx("div",{style:{marginTop:16},children:t.jsx(x,{defaultActiveKey:[],children:t.jsx(x.Panel,{header:"åå§ JSONï¼report/trustï¼",itemKey:"raw",children:t.jsx("pre",{style:{whiteSpace:"pre-wrap",fontSize:12},children:JSON.stringify({status:X.status,protocol:X.protocol,channel_id:X.channel_id,error:X.error,report:Ne,trust:Be},null,2)})})})})]}):null})]})})}function P({children:e,style:n}){return t.jsx(k,{type:"secondary",style:{fontSize:13,lineHeight:1.65,...n},children:e})}export{B as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.