PageSourceSearch

https://nickz.ai/assets/js/index-DYDhepfB.js

js nickz.ai collected 2026-10-05 14:20:25 UTC 26,363 bytes, 1 lines download raw bytes

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.