diff --git a/CHANGELOG.md b/CHANGELOG.md index ea954f1..59a5840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.6.6] - 2026-04-12 + +### 🐛 Fixed +- **WebUI** + - 修复媒体文件服务接口未拼接目录前缀导致图片无法预览的问题 (ref #70) + - 历史模块路径改为绝对路径,避免非项目根目录启动时路径解析失败 + +### ✨ Added +- **WebUI** + - 请求历史 Prompt 列支持点击弹窗预览完整内容 + - 预览弹窗新增「复制全文」按钮 + - 重发失败记录时自动删除旧的失败条目 + ## [3.6.5] - 2026-04-09 ### ✨ Added diff --git a/src/server/api/admin/routes.js b/src/server/api/admin/routes.js index 162d582..ff4e997 100644 --- a/src/server/api/admin/routes.js +++ b/src/server/api/admin/routes.js @@ -43,7 +43,8 @@ import { deleteByDateRange as deleteHistoryByDateRange, retryMediaDownload, getStats as getHistoryStats, - getModelList as getHistoryModelList + getModelList as getHistoryModelList, + getMediaDir } from '../../../utils/history.js'; import path from 'path'; import fs from 'fs/promises'; @@ -519,7 +520,8 @@ export function createAdminRouter(context) { } try { - const data = await fs.readFile(filepath); + const fullPath = path.join(getMediaDir(), filepath); + const data = await fs.readFile(fullPath); const ext = path.extname(filepath).toLowerCase(); const mimeTypes = { '.png': 'image/png', diff --git a/src/utils/history.js b/src/utils/history.js index e5f0ee1..36c4237 100644 --- a/src/utils/history.js +++ b/src/utils/history.js @@ -8,7 +8,7 @@ import fs from 'fs/promises'; import path from 'path'; import { logger } from './logger.js'; -const DATA_DIR = 'data/history'; +const DATA_DIR = path.join(process.cwd(), 'data', 'history'); const DB_PATH = path.join(DATA_DIR, 'history.db'); const MEDIA_DIR = path.join(DATA_DIR, 'media'); diff --git a/webui/dist/assets/index.js b/webui/dist/assets/index.js index a53a76f..152b7d9 100644 --- a/webui/dist/assets/index.js +++ b/webui/dist/assets/index.js @@ -472,4 +472,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${s}:focus, &.picture ${s} `]:{opacity:1},[o]:{color:e.colorTextDescription,transition:`all ${e.motionDurationSlow}`},[`&:hover ${o}`]:{color:e.colorText}},[`${t}-icon ${o}`]:{color:e.colorTextDescription,fontSize:r},[`${l}-progress`]:{position:"absolute",bottom:-e.uploadProgressOffset,width:"100%",paddingInlineStart:r+e.paddingXS,fontSize:r,lineHeight:0,pointerEvents:"none","> div":{margin:0}}},[`${l}:hover ${s}`]:{opacity:1,color:e.colorText},[`${l}-error`]:{color:e.colorError,[`${l}-name, ${t}-icon ${o}`]:{color:e.colorError},[a]:{[`${o}, ${o}:hover`]:{color:e.colorError},[s]:{opacity:1}}},[`${t}-list-item-container`]:{transition:`opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,"&::before":{display:"table",width:0,height:0,content:'""'}}})}}},g3=new ot("uploadAnimateInlineIn",{from:{width:0,height:0,margin:0,padding:0,opacity:0}}),h3=new ot("uploadAnimateInlineOut",{to:{width:0,height:0,margin:0,padding:0,opacity:0}}),Zce=e=>{const{componentCls:t}=e,n=`${t}-animate-inline`;return[{[`${t}-wrapper`]:{[`${n}-appear, ${n}-enter, ${n}-leave`]:{animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseInOutCirc,animationFillMode:"forwards"},[`${n}-appear, ${n}-enter`]:{animationName:g3},[`${n}-leave`]:{animationName:h3}}},g3,h3]},Qce=e=>{const{componentCls:t,iconCls:n,uploadThumbnailSize:o,uploadProgressOffset:r}=e,i=`${t}-list`,l=`${i}-item`;return{[`${t}-wrapper`]:{[`${i}${i}-picture, ${i}${i}-picture-card`]:{[l]:{position:"relative",height:o+e.lineWidth*2+e.paddingXS*2,padding:e.paddingXS,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:"transparent"},[`${l}-thumbnail`]:m(m({},qt),{width:o,height:o,lineHeight:`${o+e.paddingSM}px`,textAlign:"center",flex:"none",[n]:{fontSize:e.fontSizeHeading2,color:e.colorPrimary},img:{display:"block",width:"100%",height:"100%",overflow:"hidden"}}),[`${l}-progress`]:{bottom:r,width:`calc(100% - ${e.paddingSM*2}px)`,marginTop:0,paddingInlineStart:o+e.paddingXS}},[`${l}-error`]:{borderColor:e.colorError,[`${l}-thumbnail ${n}`]:{"svg path[fill='#e6f7ff']":{fill:e.colorErrorBg},"svg path[fill='#1890ff']":{fill:e.colorError}}},[`${l}-uploading`]:{borderStyle:"dashed",[`${l}-name`]:{marginBottom:r}}}}}},Jce=e=>{const{componentCls:t,iconCls:n,fontSizeLG:o,colorTextLightSolid:r}=e,i=`${t}-list`,l=`${i}-item`,a=e.uploadPicCardSize;return{[`${t}-wrapper${t}-picture-card-wrapper`]:m(m({},qo()),{display:"inline-block",width:"100%",[`${t}${t}-select`]:{width:a,height:a,marginInlineEnd:e.marginXS,marginBottom:e.marginXS,textAlign:"center",verticalAlign:"top",backgroundColor:e.colorFillAlter,border:`${e.lineWidth}px dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[`> ${t}`]:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",textAlign:"center"},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimary}},[`${i}${i}-picture-card`]:{[`${i}-item-container`]:{display:"inline-block",width:a,height:a,marginBlock:`0 ${e.marginXS}px`,marginInline:`0 ${e.marginXS}px`,verticalAlign:"top"},"&::after":{display:"none"},[l]:{height:"100%",margin:0,"&::before":{position:"absolute",zIndex:1,width:`calc(100% - ${e.paddingXS*2}px)`,height:`calc(100% - ${e.paddingXS*2}px)`,backgroundColor:e.colorBgMask,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'" "'}},[`${l}:hover`]:{[`&::before, ${l}-actions`]:{opacity:1}},[`${l}-actions`]:{position:"absolute",insetInlineStart:0,zIndex:10,width:"100%",whiteSpace:"nowrap",textAlign:"center",opacity:0,transition:`all ${e.motionDurationSlow}`,[`${n}-eye, ${n}-download, ${n}-delete`]:{zIndex:10,width:o,margin:`0 ${e.marginXXS}px`,fontSize:o,cursor:"pointer",transition:`all ${e.motionDurationSlow}`}},[`${l}-actions, ${l}-actions:hover`]:{[`${n}-eye, ${n}-download, ${n}-delete`]:{color:new ht(r).setAlpha(.65).toRgbString(),"&:hover":{color:r}}},[`${l}-thumbnail, ${l}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${l}-name`]:{display:"none",textAlign:"center"},[`${l}-file + ${l}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${e.paddingXS*2}px)`},[`${l}-uploading`]:{[`&${l}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${n}-eye, ${n}-download, ${n}-delete`]:{display:"none"}},[`${l}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${e.paddingXS*2}px)`,paddingInlineStart:0}}})}},eue=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},tue=e=>{const{componentCls:t,colorTextDisabled:n}=e;return{[`${t}-wrapper`]:m(m({},Ue(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-disabled`]:{color:n,cursor:"not-allowed"}})}},nue=Ke("Upload",e=>{const{fontSizeHeading3:t,fontSize:n,lineHeight:o,lineWidth:r,controlHeightLG:i}=e,l=Math.round(n*o),a=ke(e,{uploadThumbnailSize:t*2,uploadProgressOffset:l/2+r,uploadPicCardSize:i*2.55});return[tue(a),Yce(a),Qce(a),Jce(a),qce(a),Zce(a),eue(a),Hc(a)]});var oue=function(e,t,n,o){function r(i){return i instanceof n?i:new n(function(l){l(i)})}return new(n||(n=Promise))(function(i,l){function a(c){try{u(o.next(c))}catch(d){l(d)}}function s(c){try{u(o.throw(c))}catch(d){l(d)}}function u(c){c.done?i(c.value):r(c.value).then(a,s)}u((o=o.apply(e,t||[])).next())})},rue=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var M;return(M=s.value)!==null&&M!==void 0?M:d.value}),[g,v]=Mt(e.defaultFileList||[],{value:He(e,"fileList"),postState:M=>{const R=Date.now();return(M??[]).map((D,z)=>(!D.uid&&!Object.isFrozen(D)&&(D.uid=`__AUTO__${R}_${z}__`),D))}}),h=oe("drop"),b=oe(null);We(()=>{Pt(e.fileList!==void 0||o.value===void 0,"Upload","`value` is not a valid prop, do you mean `fileList`?"),Pt(e.transformFile===void 0,"Upload","`transformFile` is deprecated. Please use `beforeUpload` directly."),Pt(e.remove===void 0,"Upload","`remove` props is deprecated. Please use `remove` event.")});const y=(M,R,D)=>{var z,E;let A=[...R];e.maxCount===1?A=A.slice(-1):e.maxCount&&(A=A.slice(0,e.maxCount)),v(A);const N={file:M,fileList:A};D&&(N.event=D),(z=e["onUpdate:fileList"])===null||z===void 0||z.call(e,N.fileList),(E=e.onChange)===null||E===void 0||E.call(e,N),i.onFieldChange()},S=(M,R)=>oue(this,void 0,void 0,function*(){const{beforeUpload:D,transformFile:z}=e;let E=M;if(D){const A=yield D(M,R);if(A===!1)return!1;if(delete M[Ts],A===Ts)return Object.defineProperty(M,Ts,{value:!0,configurable:!0}),!1;typeof A=="object"&&A&&(E=A)}return z&&(E=yield z(E)),E}),$=M=>{const R=M.filter(E=>!E.file[Ts]);if(!R.length)return;const D=R.map(E=>zu(E.file));let z=[...g.value];D.forEach(E=>{z=Hu(E,z)}),D.forEach((E,A)=>{let N=E;if(R[A].parsedFile)E.status="uploading";else{const{originFileObj:k}=E;let F;try{F=new File([k],k.name,{type:k.type})}catch{F=new Blob([k],{type:k.type}),F.name=k.name,F.lastModifiedDate=new Date,F.lastModified=new Date().getTime()}F.uid=E.uid,N=F}y(N,z)})},w=(M,R,D)=>{try{typeof M=="string"&&(M=JSON.parse(M))}catch{}if(!ov(R,g.value))return;const z=zu(R);z.status="done",z.percent=100,z.response=M,z.xhr=D;const E=Hu(z,g.value);y(z,E)},C=(M,R)=>{if(!ov(R,g.value))return;const D=zu(R);D.status="uploading",D.percent=M.percent;const z=Hu(D,g.value);y(D,z,M)},O=(M,R,D)=>{if(!ov(D,g.value))return;const z=zu(D);z.error=M,z.response=R,z.status="error";const E=Hu(z,g.value);y(z,E)},x=M=>{let R;const D=e.onRemove||e.remove;Promise.resolve(typeof D=="function"?D(M):D).then(z=>{var E,A;if(z===!1)return;const N=Lce(M,g.value);N&&(R=m(m({},M),{status:"removed"}),(E=g.value)===null||E===void 0||E.forEach(k=>{const F=R.uid!==void 0?"uid":"name";k[F]===R[F]&&!Object.isFrozen(k)&&(k.status="removed")}),(A=b.value)===null||A===void 0||A.abort(R),y(R,N))})},I=M=>{var R;h.value=M.type,M.type==="drop"&&((R=e.onDrop)===null||R===void 0||R.call(e,M))};r({onBatchStart:$,onSuccess:w,onProgress:C,onError:O,fileList:g,upload:b});const[T]=ko("Upload",Yn.Upload,P(()=>e.locale)),_=(M,R)=>{const{removeIcon:D,previewIcon:z,downloadIcon:E,previewFile:A,onPreview:N,onDownload:k,isImageUrl:F,progress:L,itemRender:H,iconRender:j,showUploadList:Y}=e,{showDownloadIcon:Q,showPreviewIcon:U,showRemoveIcon:ee}=typeof Y=="boolean"?{}:Y;return Y?f(Uce,{prefixCls:l.value,listType:e.listType,items:g.value,previewFile:A,onPreview:N,onDownload:k,onRemove:x,showRemoveIcon:!p.value&&ee,showPreviewIcon:U,showDownloadIcon:Q,removeIcon:D,previewIcon:z,downloadIcon:E,iconRender:j,locale:T.value,isImageUrl:F,progress:L,itemRender:H,appendActionVisible:R,appendAction:M},m({},n)):M?.()};return()=>{var M,R,D;const{listType:z,type:E}=e,{class:A,style:N}=o,k=rue(o,["class","style"]),F=m(m(m({onBatchStart:$,onError:O,onProgress:C,onSuccess:w},k),e),{id:(M=e.id)!==null&&M!==void 0?M:i.id.value,prefixCls:l.value,beforeUpload:S,onChange:void 0,disabled:p.value});delete F.remove,(!n.default||p.value)&&delete F.id;const L={[`${l.value}-rtl`]:a.value==="rtl"};if(E==="drag"){const Q=se(l.value,{[`${l.value}-drag`]:!0,[`${l.value}-drag-uploading`]:g.value.some(U=>U.status==="uploading"),[`${l.value}-drag-hover`]:h.value==="dragover",[`${l.value}-disabled`]:p.value,[`${l.value}-rtl`]:a.value==="rtl"},o.class,c.value);return u(f("span",B(B({},o),{},{class:se(`${l.value}-wrapper`,L,A,c.value)}),[f("div",{class:Q,onDrop:I,onDragover:I,onDragleave:I,style:o.style},[f(c3,B(B({},F),{},{ref:b,class:`${l.value}-btn`}),B({default:()=>[f("div",{class:`${l.value}-drag-container`},[(R=n.default)===null||R===void 0?void 0:R.call(n)])]},n))]),_()]))}const H=se(l.value,{[`${l.value}-select`]:!0,[`${l.value}-select-${z}`]:!0,[`${l.value}-disabled`]:p.value,[`${l.value}-rtl`]:a.value==="rtl"}),j=$t((D=n.default)===null||D===void 0?void 0:D.call(n)),Y=Q=>f("div",{class:H,style:Q},[f(c3,B(B({},F),{},{ref:b}),n)]);return u(z==="picture-card"?f("span",B(B({},o),{},{class:se(`${l.value}-wrapper`,`${l.value}-picture-card-wrapper`,L,o.class,c.value)}),[_(Y,!!(j&&j.length))]):f("span",B(B({},o),{},{class:se(`${l.value}-wrapper`,L,o.class,c.value)}),[Y(j&&j.length?void 0:{display:"none"}),_()]))}}});var v3=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{height:r}=e,i=v3(e,["height"]),{style:l}=o,a=v3(o,["style"]),s=m(m(m({},i),a),{type:"drag",style:m(m({},l),{height:typeof r=="number"?`${r}px`:r})});return f(kd,s,n)}}}),iue=Fd,lue=m(kd,{Dragger:Fd,LIST_IGNORE:Ts,install(e){return e.component(kd.name,kd),e.component(Fd.name,Fd),e}});function aue(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function sue(e){return Object.keys(e).map(t=>`${aue(t)}: ${e[t]};`).join(" ")}function m3(){return window.devicePixelRatio||1}function rv(e,t,n,o){e.translate(t,n),e.rotate(Math.PI/180*Number(o)),e.translate(-t,-n)}const cue=(e,t)=>{let n=!1;return e.removedNodes.length&&(n=Array.from(e.removedNodes).some(o=>o===t)),e.type==="attributes"&&e.target===t&&(n=!0),n};var uue=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r2&&arguments[2]!==void 0?arguments[2]:{};const{window:o=eI}=n,r=uue(n,["window"]);let i;const l=Q8(()=>o&&"MutationObserver"in o),a=()=>{i&&(i.disconnect(),i=void 0)},s=ye(()=>cy(e),c=>{a(),l.value&&o&&c&&(i=new MutationObserver(t),i.observe(c,r))},{immediate:!0}),u=()=>{a(),s()};return Z8(u),{isSupported:l,stop:u}}const iv=2,b3=3,fue=()=>({zIndex:Number,rotate:Number,width:Number,height:Number,image:String,content:Fe([String,Array]),font:De(),rootClassName:String,gap:at(),offset:at()}),pue=ie({name:"AWatermark",inheritAttrs:!1,props:Ze(fue(),{zIndex:9,rotate:-22,font:{},gap:[100,100]}),setup(e,t){let{slots:n,attrs:o}=t;const[,r]=oi(),i=ne(),l=ne(),a=ne(!1),s=P(()=>{var _,M;return(M=(_=e.gap)===null||_===void 0?void 0:_[0])!==null&&M!==void 0?M:100}),u=P(()=>{var _,M;return(M=(_=e.gap)===null||_===void 0?void 0:_[1])!==null&&M!==void 0?M:100}),c=P(()=>s.value/2),d=P(()=>u.value/2),p=P(()=>{var _,M;return(M=(_=e.offset)===null||_===void 0?void 0:_[0])!==null&&M!==void 0?M:c.value}),g=P(()=>{var _,M;return(M=(_=e.offset)===null||_===void 0?void 0:_[1])!==null&&M!==void 0?M:d.value}),v=P(()=>{var _,M;return(M=(_=e.font)===null||_===void 0?void 0:_.fontSize)!==null&&M!==void 0?M:r.value.fontSizeLG}),h=P(()=>{var _,M;return(M=(_=e.font)===null||_===void 0?void 0:_.fontWeight)!==null&&M!==void 0?M:"normal"}),b=P(()=>{var _,M;return(M=(_=e.font)===null||_===void 0?void 0:_.fontStyle)!==null&&M!==void 0?M:"normal"}),y=P(()=>{var _,M;return(M=(_=e.font)===null||_===void 0?void 0:_.fontFamily)!==null&&M!==void 0?M:"sans-serif"}),S=P(()=>{var _,M;return(M=(_=e.font)===null||_===void 0?void 0:_.color)!==null&&M!==void 0?M:r.value.colorFill}),$=P(()=>{var _;const M={zIndex:(_=e.zIndex)!==null&&_!==void 0?_:9,position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",backgroundRepeat:"repeat"};let R=p.value-c.value,D=g.value-d.value;return R>0&&(M.left=`${R}px`,M.width=`calc(100% - ${R}px)`,R=0),D>0&&(M.top=`${D}px`,M.height=`calc(100% - ${D}px)`,D=0),M.backgroundPosition=`${R}px ${D}px`,M}),w=()=>{l.value&&(l.value.remove(),l.value=void 0)},C=(_,M)=>{var R;i.value&&l.value&&(a.value=!0,l.value.setAttribute("style",sue(m(m({},$.value),{backgroundImage:`url('${_}')`,backgroundSize:`${(s.value+M)*iv}px`}))),(R=i.value)===null||R===void 0||R.append(l.value),setTimeout(()=>{a.value=!1}))},O=_=>{let M=120,R=64;const D=e.content,z=e.image,E=e.width,A=e.height;if(!z&&_.measureText){_.font=`${Number(v.value)}px ${y.value}`;const N=Array.isArray(D)?D:[D],k=N.map(F=>_.measureText(F).width);M=Math.ceil(Math.max(...k)),R=Number(v.value)*N.length+(N.length-1)*b3}return[E??M,A??R]},x=(_,M,R,D,z)=>{const E=m3(),A=e.content,N=Number(v.value)*E;_.font=`${b.value} normal ${h.value} ${N}px/${z}px ${y.value}`,_.fillStyle=S.value,_.textAlign="center",_.textBaseline="top",_.translate(D/2,0);const k=Array.isArray(A)?A:[A];k?.forEach((F,L)=>{_.fillText(F??"",M,R+L*(N+b3*E))})},I=()=>{var _;const M=document.createElement("canvas"),R=M.getContext("2d"),D=e.image,z=(_=e.rotate)!==null&&_!==void 0?_:-22;if(R){l.value||(l.value=document.createElement("div"));const E=m3(),[A,N]=O(R),k=(s.value+A)*E,F=(u.value+N)*E;M.setAttribute("width",`${k*iv}px`),M.setAttribute("height",`${F*iv}px`);const L=s.value*E/2,H=u.value*E/2,j=A*E,Y=N*E,Q=(j+s.value*E)/2,U=(Y+u.value*E)/2,ee=L+k,X=H+F,J=Q+k,Z=U+F;if(R.save(),rv(R,Q,U,z),D){const G=new Image;G.onload=()=>{R.drawImage(G,L,H,j,Y),R.restore(),rv(R,J,Z,z),R.drawImage(G,ee,X,j,Y),C(M.toDataURL(),A)},G.crossOrigin="anonymous",G.referrerPolicy="no-referrer",G.src=D}else x(R,L,H,j,Y),R.restore(),rv(R,J,Z,z),x(R,ee,X,j,Y),C(M.toDataURL(),A)}};return We(()=>{I()}),ye(()=>[e,r.value.colorFill,r.value.fontSizeLG],()=>{I()},{deep:!0,flush:"post"}),Qe(()=>{w()}),due(i,_=>{a.value||_.forEach(M=>{cue(M,l.value)&&(w(),I())})},{attributes:!0,subtree:!0,childList:!0,attributeFilter:["style","class"]}),()=>{var _;return f("div",B(B({},o),{},{ref:i,class:[o.class,e.rootClassName],style:[{position:"relative"},o.style]}),[(_=n.default)===null||_===void 0?void 0:_.call(n)])}}}),gue=_t(pue);function y3(e,t){return{[`${e}, ${e}:hover, ${e}:focus`]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function S3(e){return{backgroundColor:e.bgColorSelected,boxShadow:e.boxShadow}}const hue=m({overflow:"hidden"},qt),vue=e=>{const{componentCls:t}=e;return{[t]:m(m(m(m(m({},Ue(e)),{display:"inline-block",padding:e.segmentedContainerPadding,color:e.labelColor,backgroundColor:e.bgColor,borderRadius:e.borderRadius,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,[`${t}-group`]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",width:"100%"},[`&${t}-rtl`]:{direction:"rtl"},[`&${t}-block`]:{display:"flex"},[`&${t}-block ${t}-item`]:{flex:1,minWidth:0},[`${t}-item`]:{position:"relative",textAlign:"center",cursor:"pointer",transition:`color ${e.motionDurationMid} ${e.motionEaseInOut}`,borderRadius:e.borderRadiusSM,"&-selected":m(m({},S3(e)),{color:e.labelColorHover}),"&::after":{content:'""',position:"absolute",width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",transition:`background-color ${e.motionDurationMid}`,pointerEvents:"none"},[`&:hover:not(${t}-item-selected):not(${t}-item-disabled)`]:{color:e.labelColorHover,"&::after":{backgroundColor:e.bgColorHover}},"&-label":m({minHeight:e.controlHeight-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeight-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`},hue),"&-icon + *":{marginInlineStart:e.marginSM/2},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},[`${t}-thumb`]:m(m({},S3(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:`${e.paddingXXS}px 0`,borderRadius:e.borderRadiusSM,[`& ~ ${t}-item:not(${t}-item-selected):not(${t}-item-disabled)::after`]:{backgroundColor:"transparent"}}),[`&${t}-lg`]:{borderRadius:e.borderRadiusLG,[`${t}-item-label`]:{minHeight:e.controlHeightLG-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightLG-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontal}px`,fontSize:e.fontSizeLG},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadius}},[`&${t}-sm`]:{borderRadius:e.borderRadiusSM,[`${t}-item-label`]:{minHeight:e.controlHeightSM-e.segmentedContainerPadding*2,lineHeight:`${e.controlHeightSM-e.segmentedContainerPadding*2}px`,padding:`0 ${e.segmentedPaddingHorizontalSM}px`},[`${t}-item, ${t}-thumb`]:{borderRadius:e.borderRadiusXS}}}),y3(`&-disabled ${t}-item`,e)),y3(`${t}-item-disabled`,e)),{[`${t}-thumb-motion-appear-active`]:{transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOut}, width ${e.motionDurationSlow} ${e.motionEaseInOut}`,willChange:"transform, width"}})}},mue=Ke("Segmented",e=>{const{lineWidthBold:t,lineWidth:n,colorTextLabel:o,colorText:r,colorFillSecondary:i,colorBgLayout:l,colorBgElevated:a}=e,s=ke(e,{segmentedPaddingHorizontal:e.controlPaddingHorizontal-n,segmentedPaddingHorizontalSM:e.controlPaddingHorizontalSM-n,segmentedContainerPadding:t,labelColor:o,labelColorHover:r,bgColor:l,bgColorHover:i,bgColorSelected:a});return[vue(s)]}),$3=e=>e?{left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth}:null,na=e=>e!==void 0?`${e}px`:void 0,bue=ie({props:{value:Ct(),getValueIndex:Ct(),prefixCls:Ct(),motionName:Ct(),onMotionStart:Ct(),onMotionEnd:Ct(),direction:Ct(),containerRef:Ct()},emits:["motionStart","motionEnd"],setup(e,t){let{emit:n}=t;const o=oe(),r=v=>{var h;const b=e.getValueIndex(v),y=(h=e.containerRef.value)===null||h===void 0?void 0:h.querySelectorAll(`.${e.prefixCls}-item`)[b];return y?.offsetParent&&y},i=oe(null),l=oe(null);ye(()=>e.value,(v,h)=>{const b=r(h),y=r(v),S=$3(b),$=$3(y);i.value=S,l.value=$,n(b&&y?"motionStart":"motionEnd")},{flush:"post"});const a=P(()=>{var v,h;return e.direction==="rtl"?na(-((v=i.value)===null||v===void 0?void 0:v.right)):na((h=i.value)===null||h===void 0?void 0:h.left)}),s=P(()=>{var v,h;return e.direction==="rtl"?na(-((v=l.value)===null||v===void 0?void 0:v.right)):na((h=l.value)===null||h===void 0?void 0:h.left)});let u;const c=v=>{clearTimeout(u),rt(()=>{v&&(v.style.transform="translateX(var(--thumb-start-left))",v.style.width="var(--thumb-start-width)")})},d=v=>{u=setTimeout(()=>{v&&(xf(v,`${e.motionName}-appear-active`),v.style.transform="translateX(var(--thumb-active-left))",v.style.width="var(--thumb-active-width)")})},p=v=>{i.value=null,l.value=null,v&&(v.style.transform=null,v.style.width=null,wf(v,`${e.motionName}-appear-active`)),n("motionEnd")},g=P(()=>{var v,h;return{"--thumb-start-left":a.value,"--thumb-start-width":na((v=i.value)===null||v===void 0?void 0:v.width),"--thumb-active-left":s.value,"--thumb-active-width":na((h=l.value)===null||h===void 0?void 0:h.width)}});return Qe(()=>{clearTimeout(u)}),()=>{const v={ref:o,style:g.value,class:[`${e.prefixCls}-thumb`]};return f(pn,{appear:!0,onBeforeEnter:c,onEnter:d,onAfterEnter:p},{default:()=>[!i.value||!l.value?null:f("div",v,null)]})}}});function yue(e){return e.map(t=>typeof t=="object"&&t!==null?t:{label:t?.toString(),title:t?.toString(),value:t})}const Sue=()=>({prefixCls:String,options:at(),block:$e(),disabled:$e(),size:Ne(),value:m(m({},Fe([String,Number])),{required:!0}),motionName:String,onChange:ve(),"onUpdate:value":ve()}),xE=(e,t)=>{let{slots:n,emit:o}=t;const{value:r,disabled:i,payload:l,title:a,prefixCls:s,label:u=n.label,checked:c,className:d}=e,p=g=>{i||o("change",g,r)};return f("label",{class:se({[`${s}-item-disabled`]:i},d)},[f("input",{class:`${s}-item-input`,type:"radio",disabled:i,checked:c,onChange:p},null),f("div",{class:`${s}-item-label`,title:typeof a=="string"?a:""},[typeof u=="function"?u({value:r,disabled:i,payload:l,title:a}):u??r])])};xE.inheritAttrs=!1;const $ue=ie({name:"ASegmented",inheritAttrs:!1,props:Ze(Sue(),{options:[],motionName:"thumb-motion"}),slots:Object,setup(e,t){let{emit:n,slots:o,attrs:r}=t;const{prefixCls:i,direction:l,size:a}=Te("segmented",e),[s,u]=mue(i),c=ne(),d=ne(!1),p=P(()=>yue(e.options)),g=(v,h)=>{e.disabled||(n("update:value",h),n("change",h))};return()=>{const v=i.value;return s(f("div",B(B({},r),{},{class:se(v,{[u.value]:!0,[`${v}-block`]:e.block,[`${v}-disabled`]:e.disabled,[`${v}-lg`]:a.value=="large",[`${v}-sm`]:a.value=="small",[`${v}-rtl`]:l.value==="rtl"},r.class),ref:c}),[f("div",{class:`${v}-group`},[f(bue,{containerRef:c,prefixCls:v,value:e.value,motionName:`${v}-${e.motionName}`,direction:l.value,getValueIndex:h=>p.value.findIndex(b=>b.value===h),onMotionStart:()=>{d.value=!0},onMotionEnd:()=>{d.value=!1}},null),p.value.map(h=>f(xE,B(B({key:h.value,prefixCls:v,checked:h.value===e.value,onChange:g},h),{},{className:se(h.className,`${v}-item`,{[`${v}-item-selected`]:h.value===e.value&&!d.value}),disabled:!!e.disabled||!!h.disabled}),o))])]))}}}),Cue=_t($ue),xue=e=>{const{componentCls:t}=e;return{[t]:m(m({},Ue(e)),{display:"flex",justifyContent:"center",alignItems:"center",padding:e.paddingSM,backgroundColor:e.colorWhite,borderRadius:e.borderRadiusLG,border:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`,position:"relative",width:"100%",height:"100%",overflow:"hidden",[`& > ${t}-mask`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:10,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",color:e.colorText,lineHeight:e.lineHeight,background:e.QRCodeMaskBackgroundColor,textAlign:"center",[`& > ${t}-expired , & > ${t}-scanned`]:{color:e.QRCodeTextColor}},"&-icon":{marginBlockEnd:e.marginXS,fontSize:e.controlHeight}}),[`${t}-borderless`]:{borderColor:"transparent"}}},wue=Ke("QRCode",e=>xue(ke(e,{QRCodeTextColor:"rgba(0, 0, 0, 0.88)",QRCodeMaskBackgroundColor:"rgba(255, 255, 255, 0.96)"})));var Oue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"};function C3(e){for(var t=1;t({size:{type:Number,default:160},value:{type:String,required:!0},type:Ne("canvas"),color:String,bgColor:String,includeMargin:Boolean,imageSettings:De()}),Yue=()=>m(m({},F1()),{errorLevel:Ne("M"),icon:String,iconSize:{type:Number,default:40},status:Ne("active"),bordered:{type:Boolean,default:!0}});var Mo;(function(e){class t{static encodeText(a,s){const u=e.QrSegment.makeSegments(a);return t.encodeSegments(u,s)}static encodeBinary(a,s){const u=e.QrSegment.makeBytes(a);return t.encodeSegments([u],s)}static encodeSegments(a,s){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:40,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1,p=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;if(!(t.MIN_VERSION<=u&&u<=c&&c<=t.MAX_VERSION)||d<-1||d>7)throw new RangeError("Invalid value");let g,v;for(g=u;;g++){const S=t.getNumDataCodewords(g,s)*8,$=i.getTotalBits(a,g);if($<=S){v=$;break}if(g>=c)throw new RangeError("Data too long")}for(const S of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])p&&v<=t.getNumDataCodewords(g,S)*8&&(s=S);const h=[];for(const S of a){n(S.mode.modeBits,4,h),n(S.numChars,S.mode.numCharCountBits(g),h);for(const $ of S.getData())h.push($)}r(h.length==v);const b=t.getNumDataCodewords(g,s)*8;r(h.length<=b),n(0,Math.min(4,b-h.length),h),n(0,(8-h.length%8)%8,h),r(h.length%8==0);for(let S=236;h.lengthy[$>>>3]|=S<<7-($&7)),new t(g,s,y,d)}constructor(a,s,u,c){if(this.version=a,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],at.MAX_VERSION)throw new RangeError("Version value out of range");if(c<-1||c>7)throw new RangeError("Mask value out of range");this.size=a*4+17;const d=[];for(let g=0;g>>9)*1335;const c=(s<<10|u)^21522;r(c>>>15==0);for(let d=0;d<=5;d++)this.setFunctionModule(8,d,o(c,d));this.setFunctionModule(8,7,o(c,6)),this.setFunctionModule(8,8,o(c,7)),this.setFunctionModule(7,8,o(c,8));for(let d=9;d<15;d++)this.setFunctionModule(14-d,8,o(c,d));for(let d=0;d<8;d++)this.setFunctionModule(this.size-1-d,8,o(c,d));for(let d=8;d<15;d++)this.setFunctionModule(8,this.size-15+d,o(c,d));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let u=0;u<12;u++)a=a<<1^(a>>>11)*7973;const s=this.version<<12|a;r(s>>>18==0);for(let u=0;u<18;u++){const c=o(s,u),d=this.size-11+u%3,p=Math.floor(u/3);this.setFunctionModule(d,p,c),this.setFunctionModule(p,d,c)}}drawFinderPattern(a,s){for(let u=-4;u<=4;u++)for(let c=-4;c<=4;c++){const d=Math.max(Math.abs(c),Math.abs(u)),p=a+c,g=s+u;0<=p&&p{(S!=v-d||w>=g)&&y.push($[S])});return r(y.length==p),y}drawCodewords(a){if(a.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let c=0;c>>3],7-(s&7)),s++)}}r(s==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let s=0;s5&&a++):(this.finderPenaltyAddHistory(g,v),p||(a+=this.finderPenaltyCountPatterns(v)*t.PENALTY_N3),p=this.modules[d][h],g=1);a+=this.finderPenaltyTerminateAndCount(p,g,v)*t.PENALTY_N3}for(let d=0;d5&&a++):(this.finderPenaltyAddHistory(g,v),p||(a+=this.finderPenaltyCountPatterns(v)*t.PENALTY_N3),p=this.modules[h][d],g=1);a+=this.finderPenaltyTerminateAndCount(p,g,v)*t.PENALTY_N3}for(let d=0;dp+(g?1:0),s);const u=this.size*this.size,c=Math.ceil(Math.abs(s*20-u*10)/u)-1;return r(0<=c&&c<=9),a+=c*t.PENALTY_N4,r(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2,u=[6];for(let c=this.size-7;u.lengtht.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*a+128)*a+64;if(a>=2){const u=Math.floor(a/7)+2;s-=(25*u-10)*u-55,a>=7&&(s-=36)}return r(208<=s&&s<=29648),s}static getNumDataCodewords(a,s){return Math.floor(t.getNumRawDataModules(a)/8)-t.ECC_CODEWORDS_PER_BLOCK[s.ordinal][a]*t.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");const s=[];for(let c=0;c0);for(const c of a){const d=c^u.shift();u.push(0),s.forEach((p,g)=>u[g]^=t.reedSolomonMultiply(p,d))}return u}static reedSolomonMultiply(a,s){if(a>>>8||s>>>8)throw new RangeError("Byte out of range");let u=0;for(let c=7;c>=0;c--)u=u<<1^(u>>>7)*285,u^=(s>>>c&1)*a;return r(u>>>8==0),u}finderPenaltyCountPatterns(a){const s=a[1];r(s<=this.size*3);const u=s>0&&a[2]==s&&a[3]==s*3&&a[4]==s&&a[5]==s;return(u&&a[0]>=s*4&&a[6]>=s?1:0)+(u&&a[6]>=s*4&&a[0]>=s?1:0)}finderPenaltyTerminateAndCount(a,s,u){return a&&(this.finderPenaltyAddHistory(s,u),s=0),s+=this.size,this.finderPenaltyAddHistory(s,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(a,s){s[0]==0&&(a+=this.size),s.pop(),s.unshift(a)}}t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(l,a,s){if(a<0||a>31||l>>>a)throw new RangeError("Value out of range");for(let u=a-1;u>=0;u--)s.push(l>>>u&1)}function o(l,a){return(l>>>a&1)!=0}function r(l){if(!l)throw new Error("Assertion error")}class i{static makeBytes(a){const s=[];for(const u of a)n(u,8,s);return new i(i.Mode.BYTE,a.length,s)}static makeNumeric(a){if(!i.isNumeric(a))throw new RangeError("String contains non-numeric characters");const s=[];for(let u=0;u=1<1&&arguments[1]!==void 0?arguments[1]:0;const n=[];return e.forEach(function(o,r){let i=null;o.forEach(function(l,a){if(!l&&i!==null){n.push(`M${i+t} ${r+t}h${a-i}v1H${i+t}z`),i=null;return}if(a===o.length-1){if(!l)return;i===null?n.push(`M${a+t},${r+t} h1v1H${a+t}z`):n.push(`M${i+t},${r+t} h${a+1-i}v1H${i+t}z`);return}l&&i===null&&(i=a)})}),n.join("")}function ME(e,t){return e.slice().map((n,o)=>o=t.y+t.h?n:n.map((r,i)=>i=t.x+t.w?r:!1))}function _E(e,t,n,o){if(o==null)return null;const r=e.length+n*2,i=Math.floor(t*Que),l=r/t,a=(o.width||i)*l,s=(o.height||i)*l,u=o.x==null?e.length/2-a/2:o.x*l,c=o.y==null?e.length/2-s/2:o.y*l;let d=null;if(o.excavate){const p=Math.floor(u),g=Math.floor(c),v=Math.ceil(a+u-p),h=Math.ceil(s+c-g);d={x:p,y:g,w:v,h}}return{x:u,y:c,h:s,w:a,excavation:d}}function AE(e,t){return t!=null?Math.floor(t):e?que:Zue}const Jue=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ede=ie({name:"QRCodeCanvas",inheritAttrs:!1,props:m(m({},F1()),{level:String,bgColor:String,fgColor:String,marginSize:Number}),setup(e,t){let{attrs:n,expose:o}=t;const r=P(()=>{var s;return(s=e.imageSettings)===null||s===void 0?void 0:s.src}),i=ne(null),l=ne(null),a=ne(!1);return o({toDataURL:(s,u)=>{var c;return(c=i.value)===null||c===void 0?void 0:c.toDataURL(s,u)}}),Le(()=>{const{value:s,size:u=Zm,level:c=OE,bgColor:d=PE,fgColor:p=IE,includeMargin:g=TE,marginSize:v,imageSettings:h}=e;if(i.value!=null){const b=i.value,y=b.getContext("2d");if(!y)return;let S=Mo.QrCode.encodeText(s,wE[c]).getModules();const $=AE(g,v),w=S.length+$*2,C=_E(S,u,$,h),O=l.value,x=a.value&&C!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;x&&C.excavation!=null&&(S=ME(S,C.excavation));const I=window.devicePixelRatio||1;b.height=b.width=u*I;const T=u/w*I;y.scale(T,T),y.fillStyle=d,y.fillRect(0,0,w,w),y.fillStyle=p,Jue?y.fill(new Path2D(EE(S,$))):S.forEach(function(_,M){_.forEach(function(R,D){R&&y.fillRect(D+$,M+$,1,1)})}),x&&y.drawImage(O,C.x+$,C.y+$,C.w,C.h)}},{flush:"post"}),ye(r,()=>{a.value=!1}),()=>{var s;const u=(s=e.size)!==null&&s!==void 0?s:Zm,c={height:`${u}px`,width:`${u}px`};let d=null;return r.value!=null&&(d=f("img",{src:r.value,key:r.value,style:{display:"none"},onLoad:()=>{a.value=!0},ref:l},null)),f(je,null,[f("canvas",B(B({},n),{},{style:[c,n.style],ref:i}),null),d])}}}),tde=ie({name:"QRCodeSVG",inheritAttrs:!1,props:m(m({},F1()),{color:String,level:String,bgColor:String,fgColor:String,marginSize:Number,title:String}),setup(e){let t=null,n=null,o=null,r=null,i=null,l=null;return Le(()=>{const{value:a,size:s=Zm,level:u=OE,includeMargin:c=TE,marginSize:d,imageSettings:p}=e;t=Mo.QrCode.encodeText(a,wE[u]).getModules(),n=AE(c,d),o=t.length+n*2,r=_E(t,s,n,p),p!=null&&r!=null&&(r.excavation!=null&&(t=ME(t,r.excavation)),l=f("image",{"xlink:href":p.src,height:r.h,width:r.w,x:r.x+n,y:r.y+n,preserveAspectRatio:"none"},null)),i=EE(t,n)}),()=>{const a=e.bgColor&&PE,s=e.fgColor&&IE;return f("svg",{height:e.size,width:e.size,viewBox:`0 0 ${o} ${o}`},[!!e.title&&f("title",null,[e.title]),f("path",{fill:a,d:`M0,0 h${o}v${o}H0z`,"shape-rendering":"crispEdges"},null),f("path",{fill:s,d:i,"shape-rendering":"crispEdges"},null),l])}}}),nde=ie({name:"AQrcode",inheritAttrs:!1,props:Yue(),emits:["refresh"],setup(e,t){let{emit:n,attrs:o,expose:r}=t;const[i]=ko("QRCode"),{prefixCls:l}=Te("qrcode",e),[a,s]=wue(l),[,u]=oi(),c=oe();r({toDataURL:(p,g)=>{var v;return(v=c.value)===null||v===void 0?void 0:v.toDataURL(p,g)}});const d=P(()=>{const{value:p,icon:g="",size:v=160,iconSize:h=40,color:b=u.value.colorText,bgColor:y="transparent",errorLevel:S="M"}=e,$={src:g,x:void 0,y:void 0,height:h,width:h,excavate:!0};return{value:p,size:v-(u.value.paddingSM+u.value.lineWidth)*2,level:S,bgColor:y,fgColor:b,imageSettings:g?$:void 0}});return()=>{const p=l.value;return a(f("div",B(B({},o),{},{style:[o.style,{width:`${e.size}px`,height:`${e.size}px`,backgroundColor:d.value.bgColor}],class:[s.value,p,{[`${p}-borderless`]:!e.bordered}]}),[e.status!=="active"&&f("div",{class:`${p}-mask`},[e.status==="loading"&&f($r,null,null),e.status==="expired"&&f(je,null,[f("p",{class:`${p}-expired`},[i.value.expired]),f(Vt,{type:"link",onClick:g=>n("refresh",g)},{default:()=>[i.value.refresh],icon:()=>f(D1,null,null)})]),e.status==="scanned"&&f("p",{class:`${p}-scanned`},[i.value.scanned])]),e.type==="canvas"?f(ede,B({ref:c},d.value),null):f(tde,d.value,null)]))}}}),ode=_t(nde);function rde(e){const t=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,{top:o,right:r,bottom:i,left:l}=e.getBoundingClientRect();return o>=0&&l>=0&&r<=t&&i<=n}function ide(e,t,n,o){const[r,i]=bt(void 0);Le(()=>{const c=typeof e.value=="function"?e.value():e.value;i(c||null)},{flush:"post"});const[l,a]=bt(null),s=()=>{if(!t.value){a(null);return}if(r.value){!rde(r.value)&&t.value&&r.value.scrollIntoView(o.value);const{left:c,top:d,width:p,height:g}=r.value.getBoundingClientRect(),v={left:c,top:d,width:p,height:g,radius:0};JSON.stringify(l.value)!==JSON.stringify(v)&&a(v)}else a(null)};return We(()=>{ye([t,r],()=>{s()},{flush:"post",immediate:!0}),window.addEventListener("resize",s)}),Qe(()=>{window.removeEventListener("resize",s)}),[P(()=>{var c,d;if(!l.value)return l.value;const p=((c=n.value)===null||c===void 0?void 0:c.offset)||6,g=((d=n.value)===null||d===void 0?void 0:d.radius)||2;return{left:l.value.left-p,top:l.value.top-p,width:l.value.width+p*2,height:l.value.height+p*2,radius:g}}),r]}const lde=()=>({arrow:Fe([Boolean,Object]),target:Fe([String,Function,Object]),title:Fe([String,Object]),description:Fe([String,Object]),placement:Ne(),mask:Fe([Object,Boolean],!0),className:{type:String},style:De(),scrollIntoViewOptions:Fe([Boolean,Object])}),L1=()=>m(m({},lde()),{prefixCls:{type:String},total:{type:Number},current:{type:Number},onClose:ve(),onFinish:ve(),renderPanel:ve(),onPrev:ve(),onNext:ve()}),ade=ie({name:"DefaultPanel",inheritAttrs:!1,props:L1(),setup(e,t){let{attrs:n}=t;return()=>{const{prefixCls:o,current:r,total:i,title:l,description:a,onClose:s,onPrev:u,onNext:c,onFinish:d}=e;return f("div",B(B({},n),{},{class:se(`${o}-content`,n.class)}),[f("div",{class:`${o}-inner`},[f("button",{type:"button",onClick:s,"aria-label":"Close",class:`${o}-close`},[f("span",{class:`${o}-close-x`},[mt("×")])]),f("div",{class:`${o}-header`},[f("div",{class:`${o}-title`},[l])]),f("div",{class:`${o}-description`},[a]),f("div",{class:`${o}-footer`},[f("div",{class:`${o}-sliders`},[i>1?[...Array.from({length:i}).keys()].map((p,g)=>f("span",{key:p,class:g===r?"active":""},null)):null]),f("div",{class:`${o}-buttons`},[r!==0?f("button",{class:`${o}-prev-btn`,onClick:u},[mt("Prev")]):null,r===i-1?f("button",{class:`${o}-finish-btn`,onClick:d},[mt("Finish")]):f("button",{class:`${o}-next-btn`,onClick:c},[mt("Next")])])])])])}}}),sde=ie({name:"TourStep",inheritAttrs:!1,props:L1(),setup(e,t){let{attrs:n}=t;return()=>{const{current:o,renderPanel:r}=e;return f(je,null,[typeof r=="function"?r(m(m({},n),e),o):f(ade,B(B({},n),e),null)])}}});let D3=0;const cde=Dn();function ude(){let e;return cde?(e=D3,D3+=1):e="TEST_OR_SSR",e}function dde(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oe("");const t=`vc_unique_${ude()}`;return e.value||t}const ju={fill:"transparent","pointer-events":"auto"},fde=ie({name:"TourMask",props:{prefixCls:{type:String},pos:De(),rootClassName:{type:String},showMask:$e(),fill:{type:String,default:"rgba(0,0,0,0.5)"},open:$e(),animated:Fe([Boolean,Object]),zIndex:{type:Number}},setup(e,t){let{attrs:n}=t;const o=dde();return()=>{const{prefixCls:r,open:i,rootClassName:l,pos:a,showMask:s,fill:u,animated:c,zIndex:d}=e,p=`${r}-mask-${o}`,g=typeof c=="object"?c?.placeholder:c;return f(kc,{visible:i,autoLock:!0},{default:()=>i&&f("div",B(B({},n),{},{class:se(`${r}-mask`,l,n.class),style:[{position:"fixed",left:0,right:0,top:0,bottom:0,zIndex:d,pointerEvents:"none"},n.style]}),[s?f("svg",{style:{width:"100%",height:"100%"}},[f("defs",null,[f("mask",{id:p},[f("rect",{x:"0",y:"0",width:"100vw",height:"100vh",fill:"white"},null),a&&f("rect",{x:a.left,y:a.top,rx:a.radius,width:a.width,height:a.height,fill:"black",class:g?`${r}-placeholder-animated`:""},null)])]),f("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:u,mask:`url(#${p})`},null),a&&f(je,null,[f("rect",B(B({},ju),{},{x:"0",y:"0",width:"100%",height:a.top}),null),f("rect",B(B({},ju),{},{x:"0",y:"0",width:a.left,height:"100%"}),null),f("rect",B(B({},ju),{},{x:"0",y:a.top+a.height,width:"100%",height:`calc(100vh - ${a.top+a.height}px)`}),null),f("rect",B(B({},ju),{},{x:a.left+a.width,y:"0",width:`calc(100vw - ${a.left+a.width}px)`,height:"100%"}),null)])]):null])})}}}),pde=[0,0],N3={left:{points:["cr","cl"],offset:[-8,0]},right:{points:["cl","cr"],offset:[8,0]},top:{points:["bc","tc"],offset:[0,-8]},bottom:{points:["tc","bc"],offset:[0,8]},topLeft:{points:["bl","tl"],offset:[0,-8]},leftTop:{points:["tr","tl"],offset:[-8,0]},topRight:{points:["br","tr"],offset:[0,-8]},rightTop:{points:["tl","tr"],offset:[8,0]},bottomRight:{points:["tr","br"],offset:[0,8]},rightBottom:{points:["bl","br"],offset:[8,0]},bottomLeft:{points:["tl","bl"],offset:[0,8]},leftBottom:{points:["br","bl"],offset:[-8,0]}};function RE(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;const t={};return Object.keys(N3).forEach(n=>{t[n]=m(m({},N3[n]),{autoArrow:e,targetOffset:pde})}),t}RE();var gde=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{builtinPlacements:e,popupAlign:t}=W6();return{builtinPlacements:e,popupAlign:t,steps:at(),open:$e(),defaultCurrent:{type:Number},current:{type:Number},onChange:ve(),onClose:ve(),onFinish:ve(),mask:Fe([Boolean,Object],!0),arrow:Fe([Boolean,Object],!0),rootClassName:{type:String},placement:Ne("bottom"),prefixCls:{type:String,default:"rc-tour"},renderPanel:ve(),gap:De(),animated:Fe([Boolean,Object]),scrollIntoViewOptions:Fe([Boolean,Object],!0),zIndex:{type:Number,default:1001}}},hde=ie({name:"Tour",inheritAttrs:!1,props:Ze(DE(),{}),setup(e){const{defaultCurrent:t,placement:n,mask:o,scrollIntoViewOptions:r,open:i,gap:l,arrow:a}=Ko(e),s=oe(),[u,c]=Mt(0,{value:P(()=>e.current),defaultValue:t.value}),[d,p]=Mt(void 0,{value:P(()=>e.open),postState:x=>u.value<0||u.value>=e.steps.length?!1:x??!0}),g=ne(d.value);Le(()=>{d.value&&!g.value&&c(0),g.value=d.value});const v=P(()=>e.steps[u.value]||{}),h=P(()=>{var x;return(x=v.value.placement)!==null&&x!==void 0?x:n.value}),b=P(()=>{var x;return d.value&&((x=v.value.mask)!==null&&x!==void 0?x:o.value)}),y=P(()=>{var x;return(x=v.value.scrollIntoViewOptions)!==null&&x!==void 0?x:r.value}),[S,$]=ide(P(()=>v.value.target),i,l,y),w=P(()=>$.value?typeof v.value.arrow>"u"?a.value:v.value.arrow:!1),C=P(()=>typeof w.value=="object"?w.value.pointAtCenter:!1);ye(C,()=>{var x;(x=s.value)===null||x===void 0||x.forcePopupAlign()}),ye(u,()=>{var x;(x=s.value)===null||x===void 0||x.forcePopupAlign()});const O=x=>{var I;c(x),(I=e.onChange)===null||I===void 0||I.call(e,x)};return()=>{var x;const{prefixCls:I,steps:T,onClose:_,onFinish:M,rootClassName:R,renderPanel:D,animated:z,zIndex:E}=e,A=gde(e,["prefixCls","steps","onClose","onFinish","rootClassName","renderPanel","animated","zIndex"]);if($.value===void 0)return null;const N=()=>{p(!1),_?.(u.value)},k=typeof b.value=="boolean"?b.value:!!b.value,F=typeof b.value=="boolean"?void 0:b.value,L=()=>$.value||document.body,H=()=>f(sde,B({arrow:w.value,key:"content",prefixCls:I,total:T.length,renderPanel:D,onPrev:()=>{O(u.value-1)},onNext:()=>{O(u.value+1)},onClose:N,current:u.value,onFinish:()=>{N(),M?.()}},v.value),null),j=P(()=>{const Y=S.value||lv,Q={};return Object.keys(Y).forEach(U=>{typeof Y[U]=="number"?Q[U]=`${Y[U]}px`:Q[U]=Y[U]}),Q});return d.value?f(je,null,[f(fde,{zIndex:E,prefixCls:I,pos:S.value,showMask:k,style:F?.style,fill:F?.color,open:d.value,animated:z,rootClassName:R},null),f(Hl,B(B({},A),{},{arrow:!!A.arrow,builtinPlacements:v.value.target?(x=A.builtinPlacements)!==null&&x!==void 0?x:RE(C.value):void 0,ref:s,popupStyle:v.value.target?v.value.style:m(m({},v.value.style),{position:"fixed",left:lv.left,top:lv.top,transform:"translate(-50%, -50%)"}),popupPlacement:h.value,popupVisible:d.value,popupClassName:se(R,v.value.className),prefixCls:I,popup:H,forceRender:!1,destroyPopupOnHide:!0,zIndex:E,mask:!1,getTriggerDOMNode:L}),{default:()=>[f(kc,{visible:d.value,autoLock:!0},{default:()=>[f("div",{class:se(R,`${I}-target-placeholder`),style:m(m({},j.value),{position:"fixed",pointerEvents:"none"})},null)]})]})]):null}}}),vde=()=>m(m({},DE()),{steps:{type:Array},prefixCls:{type:String},current:{type:Number},type:{type:String},"onUpdate:current":Function}),mde=()=>m(m({},L1()),{cover:{type:Object},nextButtonProps:{type:Object},prevButtonProps:{type:Object},current:{type:Number},type:{type:String}}),bde=ie({name:"ATourPanel",inheritAttrs:!1,props:mde(),setup(e,t){let{attrs:n,slots:o}=t;const{current:r,total:i}=Ko(e),l=P(()=>r.value===i.value-1),a=u=>{var c;const d=e.prevButtonProps;(c=e.onPrev)===null||c===void 0||c.call(e,u),typeof d?.onClick=="function"&&d?.onClick()},s=u=>{var c,d;const p=e.nextButtonProps;l.value?(c=e.onFinish)===null||c===void 0||c.call(e,u):(d=e.onNext)===null||d===void 0||d.call(e,u),typeof p?.onClick=="function"&&p?.onClick()};return()=>{const{prefixCls:u,title:c,onClose:d,cover:p,description:g,type:v,arrow:h}=e,b=e.prevButtonProps,y=e.nextButtonProps;let S;c&&(S=f("div",{class:`${u}-header`},[f("div",{class:`${u}-title`},[c])]));let $;g&&($=f("div",{class:`${u}-description`},[g]));let w;p&&(w=f("div",{class:`${u}-cover`},[p]));let C;o.indicatorsRender?C=o.indicatorsRender({current:r.value,total:i}):C=[...Array.from({length:i.value}).keys()].map((I,T)=>f("span",{key:I,class:se(T===r.value&&`${u}-indicator-active`,`${u}-indicator`)},null));const O=v==="primary"?"default":"primary",x={type:"default",ghost:v==="primary"};return f(Nl,{componentName:"Tour",defaultLocale:Yn.Tour},{default:I=>{var T;return f("div",B(B({},n),{},{class:se(v==="primary"?`${u}-primary`:"",n.class,`${u}-content`)}),[h&&f("div",{class:`${u}-arrow`,key:"arrow"},null),f("div",{class:`${u}-inner`},[f(Fn,{class:`${u}-close`,onClick:d},null),w,S,$,f("div",{class:`${u}-footer`},[i.value>1&&f("div",{class:`${u}-indicators`},[C]),f("div",{class:`${u}-buttons`},[r.value!==0?f(Vt,B(B(B({},x),b),{},{onClick:a,size:"small",class:se(`${u}-prev-btn`,b?.className)}),{default:()=>[Pv(b?.children)?b.children():(T=b?.children)!==null&&T!==void 0?T:I.Previous]}):null,f(Vt,B(B({type:O},y),{},{onClick:s,size:"small",class:se(`${u}-next-btn`,y?.className)}),{default:()=>[Pv(y?.children)?y?.children():l.value?I.Finish:I.Next]})])])])])}})}}}),yde=e=>{let{defaultType:t,steps:n,current:o,defaultCurrent:r}=e;const i=oe(r?.value),l=P(()=>o?.value);ye(l,c=>{i.value=c??r?.value},{immediate:!0});const a=c=>{i.value=c},s=P(()=>{var c,d;return typeof i.value=="number"?n&&((d=(c=n.value)===null||c===void 0?void 0:c[i.value])===null||d===void 0?void 0:d.type):t?.value});return{currentMergedType:P(()=>{var c;return(c=s.value)!==null&&c!==void 0?c:t?.value}),updateInnerCurrent:a}},Sde=e=>{const{componentCls:t,lineHeight:n,padding:o,paddingXS:r,borderRadius:i,borderRadiusXS:l,colorPrimary:a,colorText:s,colorFill:u,indicatorHeight:c,indicatorWidth:d,boxShadowTertiary:p,tourZIndexPopup:g,fontSize:v,colorBgContainer:h,fontWeightStrong:b,marginXS:y,colorTextLightSolid:S,tourBorderRadius:$,colorWhite:w,colorBgTextHover:C,tourCloseSize:O,motionDurationSlow:x,antCls:I}=e;return[{[t]:m(m({},Ue(e)),{color:s,position:"absolute",zIndex:g,display:"block",visibility:"visible",fontSize:v,lineHeight:n,width:520,"--antd-arrow-background-color":h,"&-pure":{maxWidth:"100%",position:"relative"},[`&${t}-hidden`]:{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{textAlign:"start",textDecoration:"none",borderRadius:$,boxShadow:p,position:"relative",backgroundColor:h,border:"none",backgroundClip:"padding-box",[`${t}-close`]:{position:"absolute",top:o,insetInlineEnd:o,color:e.colorIcon,outline:"none",width:O,height:O,borderRadius:e.borderRadiusSM,transition:`background-color ${e.motionDurationMid}, color ${e.motionDurationMid}`,display:"flex",alignItems:"center",justifyContent:"center","&:hover":{color:e.colorIconHover,backgroundColor:e.wireframe?"transparent":e.colorFillContent}},[`${t}-cover`]:{textAlign:"center",padding:`${o+O+r}px ${o}px 0`,img:{width:"100%"}},[`${t}-header`]:{padding:`${o}px ${o}px ${r}px`,[`${t}-title`]:{lineHeight:n,fontSize:v,fontWeight:b}},[`${t}-description`]:{padding:`0 ${o}px`,lineHeight:n,wordWrap:"break-word"},[`${t}-footer`]:{padding:`${r}px ${o}px ${o}px`,textAlign:"end",borderRadius:`0 0 ${l}px ${l}px`,display:"flex",[`${t}-indicators`]:{display:"inline-block",[`${t}-indicator`]:{width:d,height:c,display:"inline-block",borderRadius:"50%",background:u,"&:not(:last-child)":{marginInlineEnd:c},"&-active":{background:a}}},[`${t}-buttons`]:{marginInlineStart:"auto",[`${I}-btn`]:{marginInlineStart:y}}}},[`${t}-primary, &${t}-primary`]:{"--antd-arrow-background-color":a,[`${t}-inner`]:{color:S,textAlign:"start",textDecoration:"none",backgroundColor:a,borderRadius:i,boxShadow:p,[`${t}-close`]:{color:S},[`${t}-indicators`]:{[`${t}-indicator`]:{background:new ht(S).setAlpha(.15).toRgbString(),"&-active":{background:S}}},[`${t}-prev-btn`]:{color:S,borderColor:new ht(S).setAlpha(.15).toRgbString(),backgroundColor:a,"&:hover":{backgroundColor:new ht(S).setAlpha(.15).toRgbString(),borderColor:"transparent"}},[`${t}-next-btn`]:{color:a,borderColor:"transparent",background:w,"&:hover":{background:new ht(C).onBackground(w).toRgbString()}}}}}),[`${t}-mask`]:{[`${t}-placeholder-animated`]:{transition:`all ${x}`}},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${t}-inner`]:{borderRadius:Math.min($,Rb)}}},Db(e,{colorBg:"var(--antd-arrow-background-color)",contentRadius:$,limitVerticalRadius:!0})]},$de=Ke("Tour",e=>{const{borderRadiusLG:t,fontSize:n,lineHeight:o}=e,r=ke(e,{tourZIndexPopup:e.zIndexPopupBase+70,indicatorWidth:6,indicatorHeight:6,tourBorderRadius:t,tourCloseSize:n*o});return[Sde(r)]});var Cde=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{const{steps:h,current:b,type:y,rootClassName:S}=e,$=Cde(e,["steps","current","type","rootClassName"]),w=se({[`${u.value}-primary`]:g.value==="primary",[`${u.value}-rtl`]:c.value==="rtl"},p.value,S),C=(I,T)=>f(bde,B(B({},I),{},{type:y,current:T}),{indicatorsRender:r.indicatorsRender}),O=I=>{v(I),o("update:current",I),o("change",I)},x=P(()=>Ab({arrowPointAtCenter:!0,autoAdjustOverflow:!0}));return d(f(hde,B(B(B({},n),$),{},{rootClassName:w,prefixCls:u.value,current:b,defaultCurrent:e.defaultCurrent,animated:!0,renderPanel:C,onChange:O,steps:h,builtinPlacements:x.value}),null))}}}),wde=_t(xde),NE=Symbol("appConfigContext"),Ode=e=>Xe(NE,e),Pde=()=>Ve(NE,{}),BE=Symbol("appContext"),Ide=e=>Xe(BE,e),Tde=dt({message:{},notification:{},modal:{}}),Ede=()=>Ve(BE,Tde),Mde=e=>{const{componentCls:t,colorText:n,fontSize:o,lineHeight:r,fontFamily:i}=e;return{[t]:{color:n,fontSize:o,lineHeight:r,fontFamily:i}}},_de=Ke("App",e=>[Mde(e)]),Ade=()=>({rootClassName:String,message:De(),notification:De()}),Rde=()=>Ede(),ec=ie({name:"AApp",props:Ze(Ade(),{}),setup(e,t){let{slots:n}=t;const{prefixCls:o}=Te("app",e),[r,i]=_de(o),l=P(()=>se(i.value,o.value,e.rootClassName)),a=Pde(),s=P(()=>({message:m(m({},a.message),e.message),notification:m(m({},a.notification),e.notification)}));Ode(s.value);const[u,c]=s5(s.value.message),[d,p]=S5(s.value.notification),[g,v]=xT(),h=P(()=>({message:u,notification:d,modal:g}));return Ide(h.value),()=>{var b;return r(f("div",{class:l.value},[v(),c(),p(),(b=n.default)===null||b===void 0?void 0:b.call(n)]))}}});ec.useApp=Rde;ec.install=function(e){e.component(ec.name,ec)};const kE=["wrap","nowrap","wrap-reverse"],FE=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],LE=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"],Dde=(e,t)=>{const n={};return kE.forEach(o=>{n[`${e}-wrap-${o}`]=t.wrap===o}),n},Nde=(e,t)=>{const n={};return LE.forEach(o=>{n[`${e}-align-${o}`]=t.align===o}),n[`${e}-align-stretch`]=!t.align&&!!t.vertical,n},Bde=(e,t)=>{const n={};return FE.forEach(o=>{n[`${e}-justify-${o}`]=t.justify===o}),n};function kde(e,t){return se(m(m(m({},Dde(e,t)),Nde(e,t)),Bde(e,t)))}const Fde=e=>{const{componentCls:t}=e;return{[t]:{display:"flex","&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}},Lde=e=>{const{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}},zde=e=>{const{componentCls:t}=e,n={};return kE.forEach(o=>{n[`${t}-wrap-${o}`]={flexWrap:o}}),n},Hde=e=>{const{componentCls:t}=e,n={};return LE.forEach(o=>{n[`${t}-align-${o}`]={alignItems:o}}),n},jde=e=>{const{componentCls:t}=e,n={};return FE.forEach(o=>{n[`${t}-justify-${o}`]={justifyContent:o}}),n},Vde=Ke("Flex",e=>{const t=ke(e,{flexGapSM:e.paddingXS,flexGap:e.padding,flexGapLG:e.paddingLG});return[Fde(t),Lde(t),zde(t),Hde(t),jde(t)]});function B3(e){return["small","middle","large"].includes(e)}const Wde=()=>({prefixCls:Ne(),vertical:$e(),wrap:Ne(),justify:Ne(),align:Ne(),flex:Fe([Number,String]),gap:Fe([Number,String]),component:Ct()});var Kde=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,o=Object.getOwnPropertySymbols(e);r{var c;return[l.value,s.value,kde(l.value,e),{[`${l.value}-rtl`]:i.value==="rtl",[`${l.value}-gap-${e.gap}`]:B3(e.gap),[`${l.value}-vertical`]:(c=e.vertical)!==null&&c!==void 0?c:r?.value.vertical}]});return()=>{var c;const{flex:d,gap:p,component:g="div"}=e,v=Kde(e,["flex","gap","component"]),h={};return d&&(h.flex=d),p&&!B3(p)&&(h.gap=`${p}px`),a(f(g,B({class:[o.class,u.value],style:[o.style,h]},nt(v,["justify","wrap","align","vertical"])),{default:()=>[(c=n.default)===null||c===void 0?void 0:c.call(n)]}))}}}),Xde=_t(Gde),k3=Object.freeze(Object.defineProperty({__proto__:null,Affix:E6,Alert:lW,Anchor:rl,AnchorLink:L0,App:ec,AutoComplete:NV,AutoCompleteOptGroup:DV,AutoCompleteOption:RV,Avatar:yl,AvatarGroup:hf,BackTop:Lf,Badge:Ks,BadgeRibbon:vf,Breadcrumb:Sl,BreadcrumbItem:Cc,BreadcrumbSeparator:Of,Button:Vt,ButtonGroup:$f,Calendar:JX,Card:Oa,CardGrid:Mf,CardMeta:Ef,Carousel:LY,Cascader:eQ,CheckableTag:Nf,Checkbox:Ao,CheckboxGroup:Rf,Col:lQ,Collapse:Xs,CollapsePanel:_f,Comment:dQ,Compact:pf,ConfigProvider:Cl,DatePicker:TJ,Descriptions:aa,DescriptionsItem:N5,DirectoryTree:_d,Divider:HJ,Drawer:nee,Dropdown:Xo,DropdownButton:$c,Empty:Ci,Flex:Xde,FloatButton:_i,FloatButtonGroup:Ff,Form:xi,FormItem:e5,FormItemRest:uf,Grid:iQ,Image:ll,ImagePreviewGroup:rT,Input:ln,InputGroup:K5,InputNumber:Rte,InputPassword:U5,InputSearch:G5,Layout:Gte,LayoutContent:Kte,LayoutFooter:Vte,LayoutHeader:jte,LayoutSider:Wte,List:vi,ListItem:cT,ListItemMeta:aT,LocaleProvider:r5,Mentions:Jne,MentionsOption:Id,Menu:Xt,MenuDivider:wc,MenuItem:Sr,MenuItemGroup:xc,Modal:Nt,MonthPicker:bd,PageHeader:Eoe,Pagination:gg,Popconfirm:Noe,Popover:Nb,Progress:t1,QRCode:ode,QuarterPicker:yd,Radio:jn,RadioButton:If,RadioGroup:uy,RangePicker:Sd,Rate:Cre,Result:wl,Row:Fre,Segmented:Cue,Select:mn,SelectOptGroup:MV,SelectOption:EV,Skeleton:Tn,SkeletonAvatar:Sy,SkeletonButton:my,SkeletonImage:yy,SkeletonInput:by,SkeletonTitle:Yp,Slider:tie,Space:Ea,Spin:$r,Statistic:jr,StatisticCountdown:hoe,Step:Td,Steps:yie,SubMenu:_l,Switch:Eie,TabPane:Tf,Table:Hae,TableColumn:Rd,TableColumnGroup:Dd,TableSummary:Nd,TableSummaryCell:Xf,TableSummaryRow:Gf,Tabs:$l,Tag:Ta,Textarea:Ly,TimePicker:Bse,TimeRangePicker:Bd,Timeline:Js,TimelineItem:Mc,Tooltip:no,Tour:wde,Transfer:use,Tree:aE,TreeNode:Ad,TreeSelect:Dse,TreeSelectNode:qm,Typography:to,TypographyLink:ls,TypographyParagraph:as,TypographyText:ss,TypographyTitle:cs,Upload:lue,UploadDragger:iue,Watermark:gue,WeekPicker:md,message:Gn,notification:Di},Symbol.toStringTag,{value:"Module"})),Ude=function(e){return Object.keys(k3).forEach(t=>{const n=k3[t];n.install&&e.use(n)}),e.use(T9.StyleProvider),e.config.globalProperties.$message=Gn,e.config.globalProperties.$notification=Di,e.config.globalProperties.$info=Nt.info,e.config.globalProperties.$success=Nt.success,e.config.globalProperties.$error=Nt.error,e.config.globalProperties.$warning=Nt.warning,e.config.globalProperties.$confirm=Nt.confirm,e.config.globalProperties.$destroyAll=Nt.destroyAll,e},Yde={version:m6,install:Ude};const sa=typeof document<"u";function zE(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function qde(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&zE(e.default)}const Tt=Object.assign;function av(e,t){const n={};for(const o in t){const r=t[o];n[o]=Jo(r)?r.map(e):e(r)}return n}const tc=()=>{},Jo=Array.isArray;function F3(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const HE=/#/g,Zde=/&/g,Qde=/\//g,Jde=/=/g,efe=/\?/g,jE=/\+/g,tfe=/%5B/g,nfe=/%5D/g,VE=/%5E/g,ofe=/%60/g,WE=/%7B/g,rfe=/%7C/g,KE=/%7D/g,ife=/%20/g;function z1(e){return e==null?"":encodeURI(""+e).replace(rfe,"|").replace(tfe,"[").replace(nfe,"]")}function lfe(e){return z1(e).replace(WE,"{").replace(KE,"}").replace(VE,"^")}function Qm(e){return z1(e).replace(jE,"%2B").replace(ife,"+").replace(HE,"%23").replace(Zde,"%26").replace(ofe,"`").replace(WE,"{").replace(KE,"}").replace(VE,"^")}function afe(e){return Qm(e).replace(Jde,"%3D")}function sfe(e){return z1(e).replace(HE,"%23").replace(efe,"%3F")}function cfe(e){return sfe(e).replace(Qde,"%2F")}function _c(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const ufe=/\/$/,dfe=e=>e.replace(ufe,"");function sv(e,t,n="/"){let o,r={},i="",l="";const a=t.indexOf("#");let s=t.indexOf("?");return s=a>=0&&s>a?-1:s,s>=0&&(o=t.slice(0,s),i=t.slice(s,a>0?a:t.length),r=e(i.slice(1))),a>=0&&(o=o||t.slice(0,a),l=t.slice(a,t.length)),o=hfe(o??t,n),{fullPath:o+i+l,path:o,query:r,hash:_c(l)}}function ffe(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function L3(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function pfe(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&Va(t.matched[o],n.matched[r])&&GE(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Va(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function GE(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!gfe(e[n],t[n]))return!1;return!0}function gfe(e,t){return Jo(e)?z3(e,t):Jo(t)?z3(t,e):e?.valueOf()===t?.valueOf()}function z3(e,t){return Jo(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function hfe(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let i=n.length-1,l,a;for(l=0;l1&&i--;else break;return n.slice(0,i).join("/")+"/"+o.slice(l).join("/")}const pi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Jm=(function(e){return e.pop="pop",e.push="push",e})({}),cv=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function vfe(e){if(!e)if(sa){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),dfe(e)}const mfe=/^[^#]+#/;function bfe(e,t){return e.replace(mfe,"#")+t}function yfe(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Cg=()=>({left:window.scrollX,top:window.scrollY});function Sfe(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=yfe(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function H3(e,t){return(history.state?history.state.position-t:-1)+e}const e0=new Map;function $fe(e,t){e0.set(e,t)}function Cfe(e){const t=e0.get(e);return e0.delete(e),t}function xfe(e){return typeof e=="string"||e&&typeof e=="object"}function XE(e){return typeof e=="string"||typeof e=="symbol"}let Gt=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const UE=Symbol("");Gt.MATCHER_NOT_FOUND+"",Gt.NAVIGATION_GUARD_REDIRECT+"",Gt.NAVIGATION_ABORTED+"",Gt.NAVIGATION_CANCELLED+"",Gt.NAVIGATION_DUPLICATED+"";function Wa(e,t){return Tt(new Error,{type:e,[UE]:!0},t)}function Rr(e,t){return e instanceof Error&&UE in e&&(t==null||!!(e.type&t))}const wfe=["params","query","hash"];function Ofe(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of wfe)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Pfe(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;or&&Qm(r)):[o&&Qm(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function Ife(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Jo(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const Tfe=Symbol(""),V3=Symbol(""),xg=Symbol(""),YE=Symbol(""),t0=Symbol("");function Cs(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Si(e,t,n,o,r,i=l=>l()){const l=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((a,s)=>{const u=p=>{p===!1?s(Wa(Gt.NAVIGATION_ABORTED,{from:n,to:t})):p instanceof Error?s(p):xfe(p)?s(Wa(Gt.NAVIGATION_GUARD_REDIRECT,{from:t,to:p})):(l&&o.enterCallbacks[r]===l&&typeof p=="function"&&l.push(p),a())},c=i(()=>e.call(o&&o.instances[r],t,n,u));let d=Promise.resolve(c);e.length<3&&(d=d.then(u)),d.catch(p=>s(p))})}function uv(e,t,n,o,r=i=>i()){const i=[];for(const l of e)for(const a in l.components){let s=l.components[a];if(!(t!=="beforeRouteEnter"&&!l.instances[a]))if(zE(s)){const u=(s.__vccOpts||s)[t];u&&i.push(Si(u,n,o,l,a,r))}else{let u=s();i.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${l.path}"`);const d=qde(c)?c.default:c;l.mods[a]=c,l.components[a]=d;const p=(d.__vccOpts||d)[t];return p&&Si(p,n,o,l,a,r)()}))}}return i}function Efe(e,t){const n=[],o=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let l=0;lVa(u,a))?o.push(a):n.push(a));const s=e.matched[l];s&&(t.matched.find(u=>Va(u,s))||r.push(s))}return[n,o,r]}let Mfe=()=>location.protocol+"//"+location.host;function qE(e,t){const{pathname:n,search:o,hash:r}=t,i=e.indexOf("#");if(i>-1){let l=r.includes(e.slice(i))?e.slice(i).length:1,a=r.slice(l);return a[0]!=="/"&&(a="/"+a),L3(a,"")}return L3(n,e)+o+r}function _fe(e,t,n,o){let r=[],i=[],l=null;const a=({state:p})=>{const g=qE(e,location),v=n.value,h=t.value;let b=0;if(p){if(n.value=g,t.value=p,l&&l===v){l=null;return}b=h?p.position-h.position:0}else o(g);r.forEach(y=>{y(n.value,v,{delta:b,type:Jm.pop,direction:b?b>0?cv.forward:cv.back:cv.unknown})})};function s(){l=n.value}function u(p){r.push(p);const g=()=>{const v=r.indexOf(p);v>-1&&r.splice(v,1)};return i.push(g),g}function c(){if(document.visibilityState==="hidden"){const{history:p}=window;if(!p.state)return;p.replaceState(Tt({},p.state,{scroll:Cg()}),"")}}function d(){for(const p of i)p();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:s,listen:u,destroy:d}}function W3(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?Cg():null}}function Afe(e){const{history:t,location:n}=window,o={value:qE(e,n)},r={value:t.state};r.value||i(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(s,u,c){const d=e.indexOf("#"),p=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+s:Mfe()+e+s;try{t[c?"replaceState":"pushState"](u,"",p),r.value=u}catch(g){console.error(g),n[c?"replace":"assign"](p)}}function l(s,u){i(s,Tt({},t.state,W3(r.value.back,s,r.value.forward,!0),u,{position:r.value.position}),!0),o.value=s}function a(s,u){const c=Tt({},r.value,t.state,{forward:s,scroll:Cg()});i(c.current,c,!0),i(s,Tt({},W3(o.value,s,null),{position:c.position+1},u),!1),o.value=s}return{location:o,state:r,push:a,replace:l}}function Rfe(e){e=vfe(e);const t=Afe(e),n=_fe(e,t.state,t.location,t.replace);function o(i,l=!0){l||n.pauseListeners(),history.go(i)}const r=Tt({location:"",base:e,go:o,createHref:bfe.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let fl=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var un=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(un||{});const Dfe={type:fl.Static,value:""},Nfe=/[a-zA-Z0-9_]/;function Bfe(e){if(!e)return[[]];if(e==="/")return[[Dfe]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(g){throw new Error(`ERR (${n})/"${u}": ${g}`)}let n=un.Static,o=n;const r=[];let i;function l(){i&&r.push(i),i=[]}let a=0,s,u="",c="";function d(){u&&(n===un.Static?i.push({type:fl.Static,value:u}):n===un.Param||n===un.ParamRegExp||n===un.ParamRegExpEnd?(i.length>1&&(s==="*"||s==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),i.push({type:fl.Param,value:u,regexp:c,repeatable:s==="*"||s==="+",optional:s==="*"||s==="?"})):t("Invalid state to consume buffer"),u="")}function p(){u+=s}for(;at.length?t.length===1&&t[0]===Hn.Static+Hn.Segment?1:-1:0}function ZE(e,t){let n=0;const o=e.score,r=t.score;for(;n0&&t[t.length-1]<0}const Hfe={strict:!1,end:!0,sensitive:!1};function jfe(e,t,n){const o=Lfe(Bfe(e.path),n),r=Tt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function Vfe(e,t){const n=[],o=new Map;t=F3(Hfe,t);function r(d){return o.get(d)}function i(d,p,g){const v=!g,h=U3(d);h.aliasOf=g&&g.record;const b=F3(t,d),y=[h];if("alias"in d){const w=typeof d.alias=="string"?[d.alias]:d.alias;for(const C of w)y.push(U3(Tt({},h,{components:g?g.record.components:h.components,path:C,aliasOf:g?g.record:h})))}let S,$;for(const w of y){const{path:C}=w;if(p&&C[0]!=="/"){const O=p.record.path,x=O[O.length-1]==="/"?"":"/";w.path=p.record.path+(C&&x+C)}if(S=jfe(w,p,b),g?g.alias.push(S):($=$||S,$!==S&&$.alias.push(S),v&&d.name&&!Y3(S)&&l(d.name)),QE(S)&&s(S),h.children){const O=h.children;for(let x=0;x{l($)}:tc}function l(d){if(XE(d)){const p=o.get(d);p&&(o.delete(d),n.splice(n.indexOf(p),1),p.children.forEach(l),p.alias.forEach(l))}else{const p=n.indexOf(d);p>-1&&(n.splice(p,1),d.record.name&&o.delete(d.record.name),d.children.forEach(l),d.alias.forEach(l))}}function a(){return n}function s(d){const p=Gfe(d,n);n.splice(p,0,d),d.record.name&&!Y3(d)&&o.set(d.record.name,d)}function u(d,p){let g,v={},h,b;if("name"in d&&d.name){if(g=o.get(d.name),!g)throw Wa(Gt.MATCHER_NOT_FOUND,{location:d});b=g.record.name,v=Tt(X3(p.params,g.keys.filter($=>!$.optional).concat(g.parent?g.parent.keys.filter($=>$.optional):[]).map($=>$.name)),d.params&&X3(d.params,g.keys.map($=>$.name))),h=g.stringify(v)}else if(d.path!=null)h=d.path,g=n.find($=>$.re.test(h)),g&&(v=g.parse(h),b=g.record.name);else{if(g=p.name?o.get(p.name):n.find($=>$.re.test(p.path)),!g)throw Wa(Gt.MATCHER_NOT_FOUND,{location:d,currentLocation:p});b=g.record.name,v=Tt({},p.params,d.params),h=g.stringify(v)}const y=[];let S=g;for(;S;)y.unshift(S.record),S=S.parent;return{name:b,path:h,params:v,matched:y,meta:Kfe(y)}}e.forEach(d=>i(d));function c(){n.length=0,o.clear()}return{addRoute:i,resolve:u,removeRoute:l,clearRoutes:c,getRoutes:a,getRecordMatcher:r}}function X3(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function U3(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Wfe(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function Wfe(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function Y3(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Kfe(e){return e.reduce((t,n)=>Tt(t,n.meta),{})}function Gfe(e,t){let n=0,o=t.length;for(;n!==o;){const i=n+o>>1;ZE(e,t[i])<0?o=i:n=i+1}const r=Xfe(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function Xfe(e){let t=e;for(;t=t.parent;)if(QE(t)&&ZE(e,t)===0)return t}function QE({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function q3(e){const t=Ve(xg),n=Ve(YE),o=P(()=>{const s=st(e.to);return t.resolve(s)}),r=P(()=>{const{matched:s}=o.value,{length:u}=s,c=s[u-1],d=n.matched;if(!c||!d.length)return-1;const p=d.findIndex(Va.bind(null,c));if(p>-1)return p;const g=Z3(s[u-2]);return u>1&&Z3(c)===g&&d[d.length-1].path!==g?d.findIndex(Va.bind(null,s[u-2])):p}),i=P(()=>r.value>-1&&Qfe(n.params,o.value.params)),l=P(()=>r.value>-1&&r.value===n.matched.length-1&&GE(n.params,o.value.params));function a(s={}){if(Zfe(s)){const u=t[st(e.replace)?"replace":"push"](st(e.to)).catch(tc);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:o,href:P(()=>o.value.href),isActive:i,isExactActive:l,navigate:a}}function Ufe(e){return e.length===1?e[0]:e}const Yfe=ie({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:q3,setup(e,{slots:t}){const n=dt(q3(e)),{options:o}=Ve(xg),r=P(()=>({[Q3(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Q3(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&Ufe(t.default(n));return e.custom?i:Qr("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},i)}}}),qfe=Yfe;function Zfe(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Qfe(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!Jo(r)||r.length!==o.length||o.some((i,l)=>i.valueOf()!==r[l].valueOf()))return!1}return!0}function Z3(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Q3=(e,t,n)=>e??t??n,Jfe=ie({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ve(t0),r=P(()=>e.route||o.value),i=Ve(V3,0),l=P(()=>{let u=st(i);const{matched:c}=r.value;let d;for(;(d=c[u])&&!d.components;)u++;return u}),a=P(()=>r.value.matched[l.value]);Xe(V3,P(()=>l.value+1)),Xe(Tfe,a),Xe(t0,r);const s=oe();return ye(()=>[s.value,a.value,e.name],([u,c,d],[p,g,v])=>{c&&(c.instances[d]=u,g&&g!==c&&u&&u===p&&(c.leaveGuards.size||(c.leaveGuards=g.leaveGuards),c.updateGuards.size||(c.updateGuards=g.updateGuards))),u&&c&&(!g||!Va(c,g)||!p)&&(c.enterCallbacks[d]||[]).forEach(h=>h(u))},{flush:"post"}),()=>{const u=r.value,c=e.name,d=a.value,p=d&&d.components[c];if(!p)return J3(n.default,{Component:p,route:u});const g=d.props[c],v=g?g===!0?u.params:typeof g=="function"?g(u):g:null,b=Qr(p,Tt({},v,t,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(d.instances[c]=null)},ref:s}));return J3(n.default,{Component:b,route:u})||b}}});function J3(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const epe=Jfe;function tpe(e){const t=Vfe(e.routes,e),n=e.parseQuery||Pfe,o=e.stringifyQuery||j3,r=e.history,i=Cs(),l=Cs(),a=Cs(),s=ne(pi);let u=pi;sa&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=av.bind(null,X=>""+X),d=av.bind(null,cfe),p=av.bind(null,_c);function g(X,J){let Z,G;return XE(X)?(Z=t.getRecordMatcher(X),G=J):G=X,t.addRoute(G,Z)}function v(X){const J=t.getRecordMatcher(X);J&&t.removeRoute(J)}function h(){return t.getRoutes().map(X=>X.record)}function b(X){return!!t.getRecordMatcher(X)}function y(X,J){if(J=Tt({},J||s.value),typeof X=="string"){const te=sv(n,X,J.path),ue=t.resolve({path:te.path},J),le=r.createHref(te.fullPath);return Tt(te,ue,{params:p(ue.params),hash:_c(te.hash),redirectedFrom:void 0,href:le})}let Z;if(X.path!=null)Z=Tt({},X,{path:sv(n,X.path,J.path).path});else{const te=Tt({},X.params);for(const ue in te)te[ue]==null&&delete te[ue];Z=Tt({},X,{params:d(te)}),J.params=d(J.params)}const G=t.resolve(Z,J),q=X.hash||"";G.params=c(p(G.params));const V=ffe(o,Tt({},X,{hash:lfe(q),path:G.path})),K=r.createHref(V);return Tt({fullPath:V,hash:q,query:o===j3?Ife(X.query):X.query||{}},G,{redirectedFrom:void 0,href:K})}function S(X){return typeof X=="string"?sv(n,X,s.value.path):Tt({},X)}function $(X,J){if(u!==X)return Wa(Gt.NAVIGATION_CANCELLED,{from:J,to:X})}function w(X){return x(X)}function C(X){return w(Tt(S(X),{replace:!0}))}function O(X,J){const Z=X.matched[X.matched.length-1];if(Z&&Z.redirect){const{redirect:G}=Z;let q=typeof G=="function"?G(X,J):G;return typeof q=="string"&&(q=q.includes("?")||q.includes("#")?q=S(q):{path:q},q.params={}),Tt({query:X.query,hash:X.hash,params:q.path!=null?{}:X.params},q)}}function x(X,J){const Z=u=y(X),G=s.value,q=X.state,V=X.force,K=X.replace===!0,te=O(Z,G);if(te)return x(Tt(S(te),{state:typeof te=="object"?Tt({},q,te.state):q,force:V,replace:K}),J||Z);const ue=Z;ue.redirectedFrom=J;let le;return!V&&pfe(o,G,Z)&&(le=Wa(Gt.NAVIGATION_DUPLICATED,{to:ue,from:G}),H(G,G,!0,!1)),(le?Promise.resolve(le):_(ue,G)).catch(ae=>Rr(ae)?Rr(ae,Gt.NAVIGATION_GUARD_REDIRECT)?ae:L(ae):k(ae,ue,G)).then(ae=>{if(ae){if(Rr(ae,Gt.NAVIGATION_GUARD_REDIRECT))return x(Tt({replace:K},S(ae.to),{state:typeof ae.to=="object"?Tt({},q,ae.to.state):q,force:V}),J||ue)}else ae=R(ue,G,!0,K,q);return M(ue,G,ae),ae})}function I(X,J){const Z=$(X,J);return Z?Promise.reject(Z):Promise.resolve()}function T(X){const J=Q.values().next().value;return J&&typeof J.runWithContext=="function"?J.runWithContext(X):X()}function _(X,J){let Z;const[G,q,V]=Efe(X,J);Z=uv(G.reverse(),"beforeRouteLeave",X,J);for(const te of G)te.leaveGuards.forEach(ue=>{Z.push(Si(ue,X,J))});const K=I.bind(null,X,J);return Z.push(K),ee(Z).then(()=>{Z=[];for(const te of i.list())Z.push(Si(te,X,J));return Z.push(K),ee(Z)}).then(()=>{Z=uv(q,"beforeRouteUpdate",X,J);for(const te of q)te.updateGuards.forEach(ue=>{Z.push(Si(ue,X,J))});return Z.push(K),ee(Z)}).then(()=>{Z=[];for(const te of V)if(te.beforeEnter)if(Jo(te.beforeEnter))for(const ue of te.beforeEnter)Z.push(Si(ue,X,J));else Z.push(Si(te.beforeEnter,X,J));return Z.push(K),ee(Z)}).then(()=>(X.matched.forEach(te=>te.enterCallbacks={}),Z=uv(V,"beforeRouteEnter",X,J,T),Z.push(K),ee(Z))).then(()=>{Z=[];for(const te of l.list())Z.push(Si(te,X,J));return Z.push(K),ee(Z)}).catch(te=>Rr(te,Gt.NAVIGATION_CANCELLED)?te:Promise.reject(te))}function M(X,J,Z){a.list().forEach(G=>T(()=>G(X,J,Z)))}function R(X,J,Z,G,q){const V=$(X,J);if(V)return V;const K=J===pi,te=sa?history.state:{};Z&&(G||K?r.replace(X.fullPath,Tt({scroll:K&&te&&te.scroll},q)):r.push(X.fullPath,q)),s.value=X,H(X,J,Z,K),L()}let D;function z(){D||(D=r.listen((X,J,Z)=>{if(!U.listening)return;const G=y(X),q=O(G,U.currentRoute.value);if(q){x(Tt(q,{replace:!0,force:!0}),G).catch(tc);return}u=G;const V=s.value;sa&&$fe(H3(V.fullPath,Z.delta),Cg()),_(G,V).catch(K=>Rr(K,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_CANCELLED)?K:Rr(K,Gt.NAVIGATION_GUARD_REDIRECT)?(x(Tt(S(K.to),{force:!0}),G).then(te=>{Rr(te,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_DUPLICATED)&&!Z.delta&&Z.type===Jm.pop&&r.go(-1,!1)}).catch(tc),Promise.reject()):(Z.delta&&r.go(-Z.delta,!1),k(K,G,V))).then(K=>{K=K||R(G,V,!1),K&&(Z.delta&&!Rr(K,Gt.NAVIGATION_CANCELLED)?r.go(-Z.delta,!1):Z.type===Jm.pop&&Rr(K,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),M(G,V,K)}).catch(tc)}))}let E=Cs(),A=Cs(),N;function k(X,J,Z){L(X);const G=A.list();return G.length?G.forEach(q=>q(X,J,Z)):console.error(X),Promise.reject(X)}function F(){return N&&s.value!==pi?Promise.resolve():new Promise((X,J)=>{E.add([X,J])})}function L(X){return N||(N=!X,z(),E.list().forEach(([J,Z])=>X?Z(X):J()),E.reset()),X}function H(X,J,Z,G){const{scrollBehavior:q}=e;if(!sa||!q)return Promise.resolve();const V=!Z&&Cfe(H3(X.fullPath,0))||(G||!Z)&&history.state&&history.state.scroll||null;return rt().then(()=>q(X,J,V)).then(K=>K&&Sfe(K)).catch(K=>k(K,X,J))}const j=X=>r.go(X);let Y;const Q=new Set,U={currentRoute:s,listening:!0,addRoute:g,removeRoute:v,clearRoutes:t.clearRoutes,hasRoute:b,getRoutes:h,resolve:y,options:e,push:w,replace:C,go:j,back:()=>j(-1),forward:()=>j(1),beforeEach:i.add,beforeResolve:l.add,afterEach:a.add,onError:A.add,isReady:F,install(X){X.component("RouterLink",qfe),X.component("RouterView",epe),X.config.globalProperties.$router=U,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>st(s)}),sa&&!Y&&s.value===pi&&(Y=!0,w(r.location).catch(G=>{}));const J={};for(const G in pi)Object.defineProperty(J,G,{get:()=>s.value[G],enumerable:!0});X.provide(xg,U),X.provide(YE,P4(J)),X.provide(t0,s);const Z=X.unmount;Q.add(X),X.unmount=function(){Q.delete(X),Q.size<1&&(u=pi,D&&D(),D=null,s.value=pi,Y=!1,N=!1),Z()}}};function ee(X){return X.reduce((J,Z)=>J.then(()=>T(Z)),Promise.resolve())}return U}function npe(){return Ve(xg)}const JE=j_("settings",{state:()=>({token:localStorage.getItem("admin_token")||"",serverConfig:{},browserConfig:{},workerConfig:[],poolConfig:{strategy:"least_busy",waitTimeout:120,failover:{enabled:!1,maxRetries:3,imgDlRetry:!1,imgDlRetryMaxRetries:2}},adapterConfig:{},adaptersMeta:[]}),actions:{setToken(e){this.token=e,e?localStorage.setItem("admin_token",e):localStorage.removeItem("admin_token")},getHeaders(){const e={"Content-Type":"application/json"};return this.token&&(e.Authorization=`Bearer ${this.token}`),e},async checkAuth(){try{return(await fetch("/admin/status",{headers:this.getHeaders()})).status!==401}catch{return!1}},async handleResponse(e,t){let n={};try{n=await e.json()}catch{}if(e.ok)return t&&Gn.success(t),{success:!0,data:n};{console.error("Request failed:",e.status,n);const o=n.error?.message||n.message||`请求未成功: ${e.status} ${e.statusText}`;return Nt.error({title:"保存失败",content:o,okText:"好的"}),{success:!1,data:n}}},async fetchServerConfig(){try{const e=await fetch("/admin/config/server",{headers:this.getHeaders()});e.ok&&(this.serverConfig=await e.json())}catch(e){console.error("Fetch server config failed",e)}},async saveServerConfig(e){try{const t=await fetch("/admin/config/server",{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if((await this.handleResponse(t,"服务器设置保存成功")).success)return this.serverConfig=e,!0}catch(t){Nt.error({title:"保存失败 (网络异常)",content:t.message})}return!1},async fetchBrowserConfig(){try{const e=await fetch("/admin/config/browser",{headers:this.getHeaders()});e.ok&&(this.browserConfig=await e.json())}catch(e){console.error("Fetch browser config failed",e)}},async saveBrowserConfig(e){try{const t=await fetch("/admin/config/browser",{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if((await this.handleResponse(t,"浏览器设置保存成功")).success)return this.browserConfig=e,!0}catch(t){Nt.error({title:"保存失败 (网络异常)",content:t.message})}return!1},async fetchWorkerConfig(){try{const e=await fetch("/admin/config/instances",{headers:this.getHeaders()});e.ok&&(this.workerConfig=await e.json())}catch(e){console.error("Fetch instance configuration failed",e)}},async saveWorkerConfig(e){try{const t=await fetch("/admin/config/instances",{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if((await this.handleResponse(t,"实例配置保存成功")).success)return this.workerConfig=e,!0}catch(t){Nt.error({title:"保存失败 (网络异常)",content:t.message})}return!1},async fetchPoolConfig(){try{const e=await fetch("/admin/config/pool",{headers:this.getHeaders()});if(e.ok){const t=await e.json();this.poolConfig={strategy:t.strategy||"least_busy",waitTimeout:t.waitTimeout??120,failover:{enabled:t.failover?.enabled||!1,maxRetries:t.failover?.maxRetries||3,imgDlRetry:t.failover?.imgDlRetry||!1,imgDlRetryMaxRetries:t.failover?.imgDlRetryMaxRetries??2}}}}catch(e){console.error("Fetch pool config failed",e)}},async savePoolConfig(e){try{const t=await fetch("/admin/config/pool",{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if((await this.handleResponse(t,"工作池设置保存成功")).success)return this.poolConfig=e,!0}catch(t){Nt.error({title:"保存失败 (网络异常)",content:t.message})}return!1},async fetchAdaptersMeta(){try{const e=await fetch("/admin/adapters",{headers:this.getHeaders()});e.ok&&(this.adaptersMeta=await e.json())}catch(e){console.error("Fetch adapters meta failed",e)}},async fetchAdapterConfig(){try{const e=await fetch("/admin/config/adapters",{headers:this.getHeaders()});e.ok&&(this.adapterConfig=await e.json())}catch(e){console.error("Fetch adapter config failed",e)}},async saveAdapterConfig(e){try{const t=await fetch("/admin/config/adapters",{method:"POST",headers:this.getHeaders(),body:JSON.stringify(e)});if((await this.handleResponse(t,"适配器设置保存成功")).success)return this.adapterConfig={...this.adapterConfig,...e},!0}catch(t){Nt.error({title:"保存失败 (网络异常)",content:t.message})}return!1}}}),ope={style:{padding:"20px 0"}},rpe={style:{"text-align":"center","margin-bottom":"24px"}},ipe={__name:"LoginModal",props:{visible:{type:Boolean,required:!0}},emits:["update:visible","success"],setup(e,{emit:t}){const n=t,o=JE(),r=oe(o.token),i=oe(!1),l=async()=>{if(!r.value){Gn.warning("请输入 Token");return}i.value=!0;try{const a=o.token;o.setToken(r.value),await o.checkAuth()?(Gn.success("验证成功"),n("success"),n("update:visible",!1)):(Gn.error("Token 验证失败,请检查是否正确"),o.setToken(a))}catch{Gn.error("验证过程发生错误")}finally{i.value=!1}};return(a,s)=>{const u=At("a-avatar"),c=At("a-input-password"),d=At("a-form-item"),p=At("a-button"),g=At("a-form"),v=At("a-modal");return Ot(),bi(v,{open:e.visible,title:"需要身份验证",closable:!1,maskClosable:!1,footer:null,width:"400px",centered:""},{default:Je(()=>[xt("div",ope,[xt("div",rpe,[f(u,{size:64,style:{"background-color":"#1890ff"}},{icon:Je(()=>[f(st(Uf))]),_:1}),s[1]||(s[1]=xt("div",{style:{"margin-top":"16px","font-size":"16px","font-weight":"500"}}," WebAI2API 管理面板 ",-1)),s[2]||(s[2]=xt("div",{style:{color:"#8c8c8c","margin-top":"8px"}}," 请输入访问 API Token 以继续 ",-1))]),f(g,{layout:"vertical"},{default:Je(()=>[f(d,{label:"API Token"},{default:Je(()=>[f(c,{value:r.value,"onUpdate:value":s[0]||(s[0]=h=>r.value=h),placeholder:"请输入 API Token",size:"large",onPressEnter:l},{prefix:Je(()=>[f(st(Uf),{style:{color:"rgba(0,0,0,.25)"}})]),_:1},8,["value"])]),_:1}),f(p,{type:"primary",block:"",size:"large",loading:i.value,onClick:l},{default:Je(()=>[...s[3]||(s[3]=[mt(" 验证并登录 ",-1)])]),_:1},8,["loading"])]),_:1})])]),_:1},8,["open"])}}},lpe=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},ape={key:1},spe={key:0},cpe={key:0},upe={href:"https://github.com/foxhui/WebAI2API",target:"_blank",style:{color:"#8c8c8c","font-size":"20px"}},dpe={key:0},fpe={style:{"margin-top":"8px","font-size":"12px",color:"#8c8c8c"}},ppe={key:1},gpe={style:{"margin-top":"8px","font-size":"12px",color:"#ff4d4f"}},hpe={key:2,style:{color:"#8c8c8c","font-size":"12px"}},vpe={key:0},mpe={style:{"margin-top":"8px","font-size":"12px",color:"#8c8c8c"}},bpe={key:1},ype={style:{"margin-top":"8px","font-size":"12px",color:"#ff4d4f"}},Spe={key:2,style:{color:"#8c8c8c","font-size":"12px"}},$pe={style:{"margin-bottom":"12px"}},Cpe={style:{"margin-bottom":"12px"}},xpe={style:{"margin-bottom":"12px"}},wpe={style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},Ope={style:{margin:"0"}},Ppe={key:0,style:{"margin-top":"8px",display:"flex","flex-wrap":"wrap",gap:"4px"}},Ipe={style:{"margin-bottom":"12px"}},Tpe={key:0},Epe={style:{"margin-bottom":"8px"}},Mpe={key:0,style:{"font-size":"12px","max-height":"400px","overflow-y":"auto",background:"#fafafa",padding:"8px","border-radius":"4px"}},_pe={key:0,style:{"white-space":"pre-wrap","word-break":"break-all",margin:"0 0 8px 0"}},Ape={key:1,style:{display:"flex","flex-direction":"column",gap:"8px"}},Rpe={style:{"font-size":"11px",color:"#8c8c8c","margin-bottom":"4px"}},Dpe=["src","alt"],Npe={key:2,style:{display:"flex","flex-direction":"column",gap:"8px"}},Bpe=["src"],kpe={key:1},Fpe={style:{"margin-top":"8px","font-size":"12px",color:"#ff4d4f"}},Lpe={__name:"App",setup(e){const t=npe(),n=JE(),o=oe(["dash"]),r=oe(!1),i=oe(!1),l=oe(!1),a=oe(!1),s=()=>{a.value=!0,n.setToken(""),setTimeout(()=>{a.value=!1,l.value=!0},500)},u=oe(!1),c=oe({models:{status:"pending",data:null,error:null},cookies:{status:"pending",data:null,error:null},chat:{status:"pending",data:null,error:null}}),d=oe("Say hello in one word"),p=oe(""),g=oe([]),v=oe([]),h=oe(!1),b=oe(""),y=async()=>{try{const E=await fetch("/v1/models",{headers:n.getHeaders()});if(E.ok){const A=await E.json();g.value=A.data||[],g.value.length>0&&!p.value&&(p.value=g.value[0].id)}}catch(E){console.error("获取模型列表失败",E)}},S=E=>new Promise((A,N)=>{const k=new FileReader;k.readAsDataURL(E),k.onload=()=>A(k.result),k.onerror=N}),$=E=>["image/png","image/jpeg","image/gif","image/webp"].includes(E.type)?(v.value.length>=10&&Gn.error("最多上传 10 张图片"),!1):(Gn.error("仅支持 PNG, JPEG, GIF, WebP 格式"),!1),w=async E=>{const A=E.file;if(A.status==="removed"){v.value=v.value.filter(N=>N.uid!==A.uid);return}try{const N=await S(A.originFileObj||A);v.value.push({uid:A.uid,name:A.name,base64:N})}catch{Gn.error("图片读取失败")}},C=E=>{const A=E.split(","),N=A[0].match(/:(.*?);/)[1],k=atob(A[1]);let F=k.length;const L=new Uint8Array(F);for(;F--;)L[F]=k.charCodeAt(F);return URL.createObjectURL(new Blob([L],{type:N}))},O=E=>{if(!E)return{text:"",images:[],videos:[]};if(E.trim().startsWith("data:video/"))try{const H=C(E.trim());return{text:"",images:[],videos:[{src:H,type:"video/mp4"}]}}catch(H){return console.error("视频转换失败",H),{text:E,images:[],videos:[]}}const A=/!\[([^\]]*)\]\(([^)]+)\)/g,N=[];let k,F=0,L=[];for(;(k=A.exec(E))!==null;)k.index>F&&L.push(E.substring(F,k.index)),N.push({alt:k[1]||"图片",src:k[2],type:"image"}),F=A.lastIndex;return F{c.value[E].status="loading",c.value[E].error=null,c.value[E].data=null,b.value="";try{let A,N;if(E==="models")A="/v1/models",N={headers:n.getHeaders()};else if(E==="cookies")A="/v1/cookies",N={headers:n.getHeaders()};else if(E==="chat"){A="/v1/chat/completions";let L;if(v.value.length>0){L=[{type:"text",text:d.value}];for(const H of v.value)L.push({type:"image_url",image_url:{url:H.base64}})}else L=d.value;if(N={method:"POST",headers:{...n.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({model:p.value,messages:[{role:"user",content:L}],stream:h.value})},h.value){const H=await fetch(A,N);if(!H.ok){const U=await H.json();throw new Error(U.error?.message||`HTTP ${H.status}`)}const j=H.body.getReader(),Y=new TextDecoder;let Q="";for(;;){const{done:U,value:ee}=await j.read();if(U)break;Q+=Y.decode(ee,{stream:!0});const X=Q.split(` -`);Q=X.pop()||"";for(const J of X)if(J.startsWith("data: ")){const Z=J.slice(6).trim();if(Z==="[DONE]")continue;try{const q=JSON.parse(Z).choices?.[0]?.delta?.content||"";b.value+=q}catch{}}}c.value[E].status="success",c.value[E].data={content:b.value};return}}const k=await fetch(A,N),F=await k.json();k.ok?(c.value[E].status="success",E==="chat"&&F.choices?.[0]?.message?.content?c.value[E].data={content:F.choices[0].message.content}:c.value[E].data=F):(c.value[E].status="error",c.value[E].error=F.error?.message||`HTTP ${k.status}`)}catch(A){c.value[E].status="error",c.value[E].error=A.message}},I=()=>{u.value=!0,Object.keys(c.value).forEach(E=>{c.value[E]={status:"pending",data:null,error:null}}),v.value=[],y()},T={dash:"/",history:"/tools/request","settings-server":"/settings/server","settings-workers":"/settings/workers","settings-browser":"/settings/browser","settings-adapters":"/settings/adapters","tools-display":"/tools/display","tools-cache":"/tools/cache","tools-logs":"/tools/logs"},_=({key:E})=>{const A=T[E];A&&(t.push(A),i.value&&(r.value=!0))},M=oe(!0);let R=null,D=!1;async function z(){try{(await fetch("/admin/status",{headers:n.getHeaders(),signal:AbortSignal.timeout(5e3)})).ok&&D&&(D=!1,Nt.destroyAll(),window.location.reload())}catch{!D&&!M.value&&(D=!0,Nt.warning({title:"后端连接断开",content:"无法连接到后端服务,请检查服务是否正在运行。连接恢复后页面将自动刷新。",okText:"我知道了",centered:!0}))}}return We(async()=>{const E=()=>{i.value=window.innerWidth<=768,i.value&&(r.value=!0)};E(),window.addEventListener("resize",E);try{n.token?await n.checkAuth()||(n.setToken(""),l.value=!0):l.value=!0}catch(A){console.error("Auth check failed",A),l.value=!0}finally{M.value=!1}R=setInterval(z,5e3),wn(()=>{window.removeEventListener("resize",E),R&&clearInterval(R)})}),(E,A)=>{const N=At("a-spin"),k=At("a-button"),F=At("a-flex"),L=At("a-layout-header"),H=At("a-menu-item"),j=At("a-sub-menu"),Y=At("a-menu"),Q=At("a-layout-sider"),U=At("router-view"),ee=At("a-layout-content"),X=At("a-card"),J=At("a-layout-footer"),Z=At("a-layout"),G=At("a-tag"),q=At("a-select-option"),V=At("a-select"),K=At("a-textarea"),te=At("a-upload-dragger"),ue=At("a-checkbox"),le=At("a-space"),ae=At("a-drawer");return M.value?(Ot(),bi(N,{key:0,spinning:M.value,tip:"正在验证身份...",size:"large",style:{height:"100vh",display:"flex","align-items":"center","justify-content":"center"}},null,8,["spinning"])):(Ot(),jt("div",ape,[f(ipe,{visible:l.value,"onUpdate:visible":A[0]||(A[0]=re=>l.value=re)},null,8,["visible"]),f(Z,{style:{"min-height":"100vh"},theme:"light"},{default:Je(()=>[f(L,{class:"header",style:sl({background:"rgba(255, 255, 255, 0.7)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",borderBottom:"1.5px solid rgba(0, 0, 0, 0.05)",display:"flex",alignItems:"center",padding:i.value?"0 12px":"0 24px",position:"fixed",width:"100%",top:0,zIndex:1e3})},{default:Je(()=>[i.value?(Ot(),bi(k,{key:0,type:"text",onClick:A[1]||(A[1]=re=>r.value=!r.value),style:{"margin-right":"8px","font-size":"18px"}},{icon:Je(()=>[f(st(_1))]),_:1})):ir("",!0),xt("div",{class:"logo",style:sl({fontSize:"1.25rem",fontWeight:"bold",color:"#1890ff",marginRight:i.value?"8px":"24px"})}," WebAI2API ",4),f(F,{justify:"end",align:"center",style:{flex:"1"},gap:8},{default:Je(()=>[f(k,{onClick:I,size:i.value?"small":"middle"},{icon:Je(()=>[f(st(I1))]),default:Je(()=>[i.value?ir("",!0):(Ot(),jt("span",spe,"接口测试"))]),_:1},8,["size"]),f(k,{danger:"",loading:a.value,onClick:s,size:i.value?"small":"middle"},{icon:Je(()=>[f(st(R1))]),default:Je(()=>[i.value?ir("",!0):(Ot(),jt("span",cpe,"退出登录"))]),_:1},8,["loading","size"])]),_:1})]),_:1},8,["style"]),f(Z,{style:{"margin-top":"64px"}},{default:Je(()=>[i.value&&!r.value?(Ot(),jt("div",{key:0,class:"sider-mask",onClick:A[2]||(A[2]=re=>r.value=!0)})):ir("",!0),f(Q,{collapsed:r.value,"onUpdate:collapsed":A[4]||(A[4]=re=>r.value=re),collapsible:"",theme:"light","collapsed-width":i.value?0:80,trigger:i.value?null:void 0,style:sl({position:"fixed",left:0,top:"64px",height:"calc(100vh - 64px)",overflowY:"auto",zIndex:i.value?200:100})},{default:Je(()=>[f(Y,{selectedKeys:o.value,"onUpdate:selectedKeys":A[3]||(A[3]=re=>o.value=re),mode:"inline",onClick:_},{default:Je(()=>[f(H,{key:"dash"},{default:Je(()=>[f(st(T1)),A[12]||(A[12]=xt("span",null,"状态概览",-1))]),_:1}),f(H,{key:"history"},{default:Je(()=>[f(st(N1)),A[13]||(A[13]=xt("span",null,"请求模型",-1))]),_:1}),f(j,{key:"settings"},{title:Je(()=>[xt("span",null,[f(st(B1)),A[14]||(A[14]=xt("span",null,"系统设置",-1))])]),default:Je(()=>[f(H,{key:"settings-server"},{default:Je(()=>[...A[15]||(A[15]=[mt("服务器",-1)])]),_:1}),f(H,{key:"settings-workers"},{default:Je(()=>[...A[16]||(A[16]=[mt("工作池",-1)])]),_:1}),f(H,{key:"settings-browser"},{default:Je(()=>[...A[17]||(A[17]=[mt("浏览器",-1)])]),_:1}),f(H,{key:"settings-adapters"},{default:Je(()=>[...A[18]||(A[18]=[mt("适配器",-1)])]),_:1})]),_:1}),f(j,{key:"tools"},{title:Je(()=>[xt("span",null,[f(st(k1)),A[19]||(A[19]=xt("span",null,"系统管理",-1))])]),default:Je(()=>[f(H,{key:"tools-display"},{default:Je(()=>[...A[20]||(A[20]=[mt("虚拟显示器",-1)])]),_:1}),f(H,{key:"tools-cache"},{default:Je(()=>[...A[21]||(A[21]=[mt("缓存与重启",-1)])]),_:1}),f(H,{key:"tools-logs"},{default:Je(()=>[...A[22]||(A[22]=[mt("日志查看器",-1)])]),_:1})]),_:1})]),_:1},8,["selectedKeys"])]),_:1},8,["collapsed","collapsed-width","trigger","style"]),f(Z,{style:sl({marginLeft:i.value?"0":r.value?"80px":"200px",padding:i.value?"12px":"16px",transition:"margin-left 0.2s"})},{default:Je(()=>[f(ee,{style:{"min-height":"280px"}},{default:Je(()=>[f(U)]),_:1}),f(J,{class:"footer",style:{padding:"0px","margin-top":"10px"}},{default:Je(()=>[f(X,{bordered:!1,bodyStyle:{padding:"16px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"}},{default:Je(()=>[xt("div",null,[xt("a",upe,[f(st(E1))])])]),_:1})]),_:1})]),_:1},8,["style"])]),_:1})]),_:1}),f(ae,{open:u.value,"onUpdate:open":A[11]||(A[11]=re=>u.value=re),title:"接口测试",placement:"right",width:i.value?"100%":500},{default:Je(()=>[f(le,{direction:"vertical",style:{width:"100%"},size:"large"},{default:Je(()=>[f(X,{title:"GET /v1/models",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[5]||(A[5]=re=>x("models")),loading:c.value.models.status==="loading"},{default:Je(()=>[...A[23]||(A[23]=[mt(" 测试 ",-1)])]),_:1},8,["loading"])]),default:Je(()=>[c.value.models.status==="success"?(Ot(),jt("div",dpe,[f(G,{color:"success"},{default:Je(()=>[f(st(ml)),A[24]||(A[24]=mt(" 成功 ",-1))]),_:1}),xt("div",fpe," 返回 "+so(c.value.models.data?.data?.length||0)+" 个模型 ",1)])):c.value.models.status==="error"?(Ot(),jt("div",ppe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[25]||(A[25]=mt(" 失败 ",-1))]),_:1}),xt("div",gpe,so(c.value.models.error),1)])):(Ot(),jt("div",hpe,"点击测试按钮开始"))]),_:1}),f(X,{title:"GET /v1/cookies",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[6]||(A[6]=re=>x("cookies")),loading:c.value.cookies.status==="loading"},{default:Je(()=>[...A[26]||(A[26]=[mt(" 测试 ",-1)])]),_:1},8,["loading"])]),default:Je(()=>[c.value.cookies.status==="success"?(Ot(),jt("div",vpe,[f(G,{color:"success"},{default:Je(()=>[f(st(ml)),A[27]||(A[27]=mt(" 成功 ",-1))]),_:1}),xt("div",mpe," 返回 "+so(c.value.cookies.data?.cookies?.length||0)+" 个 Cookie ",1)])):c.value.cookies.status==="error"?(Ot(),jt("div",bpe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[28]||(A[28]=mt(" 失败 ",-1))]),_:1}),xt("div",ype,so(c.value.cookies.error),1)])):(Ot(),jt("div",Spe,"点击测试按钮开始"))]),_:1}),f(X,{title:"POST /v1/chat/completions",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[7]||(A[7]=re=>x("chat")),loading:c.value.chat.status==="loading",disabled:!p.value},{default:Je(()=>[...A[29]||(A[29]=[mt(" 测试 ",-1)])]),_:1},8,["loading","disabled"])]),default:Je(()=>[xt("div",$pe,[A[30]||(A[30]=xt("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"模型",-1)),f(V,{value:p.value,"onUpdate:value":A[8]||(A[8]=re=>p.value=re),style:{width:"100%"},size:"small",placeholder:"选择模型","show-search":""},{default:Je(()=>[(Ot(!0),jt(je,null,su(g.value,re=>(Ot(),bi(q,{key:re.id,value:re.id},{default:Je(()=>[mt(so(re.id),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),xt("div",Cpe,[A[31]||(A[31]=xt("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"提示词",-1)),f(K,{value:d.value,"onUpdate:value":A[9]||(A[9]=re=>d.value=re),placeholder:"输入提示词",rows:2,size:"small"},null,8,["value"])]),xt("div",xpe,[xt("div",wpe," 附加图片 ("+so(v.value.length)+"/10) ",1),f(te,{"file-list":[],multiple:!0,"before-upload":$,onChange:w,accept:".png,.jpg,.jpeg,.gif,.webp","show-upload-list":!1,style:{padding:"8px"}},{default:Je(()=>[xt("p",Ope,[f(st(M1),{style:{"font-size":"24px",color:"#1890ff"}})]),A[32]||(A[32]=xt("p",{style:{"font-size":"12px",margin:"4px 0 0 0",color:"#8c8c8c"}}," 点击或拖拽上传图片 (PNG/JPEG/GIF/WebP) ",-1))]),_:1}),v.value.length>0?(Ot(),jt("div",Ppe,[(Ot(!0),jt(je,null,su(v.value,re=>(Ot(),bi(G,{key:re.uid,closable:"",onClose:ce=>v.value=v.value.filter(pe=>pe.uid!==re.uid)},{default:Je(()=>[f(st(A1)),mt(" "+so(re.name.slice(0,15))+so(re.name.length>15?"...":""),1)]),_:2},1032,["onClose"]))),128))])):ir("",!0)]),xt("div",Ipe,[f(ue,{checked:h.value,"onUpdate:checked":A[10]||(A[10]=re=>h.value=re)},{default:Je(()=>[...A[33]||(A[33]=[mt("流式响应",-1)])]),_:1},8,["checked"])]),c.value.chat.status==="loading"||c.value.chat.status==="success"?(Ot(),jt("div",Tpe,[xt("div",Epe,[c.value.chat.status==="loading"?(Ot(),bi(G,{key:0,color:"processing"},{default:Je(()=>[f(st(Bn)),mt(" "+so(h.value?"正在接收流式响应...":"请求中,可能需要较长时间..."),1)]),_:1})):(Ot(),bi(G,{key:1,color:"success"},{default:Je(()=>[f(st(ml)),A[34]||(A[34]=mt(" 成功 ",-1))]),_:1}))]),(h.value?b.value:c.value.chat.data?.content)?(Ot(),jt("div",Mpe,[O(h.value?b.value:c.value.chat.data?.content).text?(Ot(),jt("pre",_pe,so(O(h.value?b.value:c.value.chat.data?.content).text),1)):ir("",!0),O(h.value?b.value:c.value.chat.data?.content).images.length>0?(Ot(),jt("div",Ape,[(Ot(!0),jt(je,null,su(O(h.value?b.value:c.value.chat.data?.content).images,(re,ce)=>(Ot(),jt("div",{key:ce,style:{border:"1px solid #d9d9d9","border-radius":"4px",padding:"4px",background:"white"}},[xt("div",Rpe,so(re.alt),1),xt("img",{src:re.src,alt:re.alt,style:{"max-width":"100%",height:"auto",display:"block","border-radius":"2px"}},null,8,Dpe)]))),128))])):ir("",!0),O(h.value?b.value:c.value.chat.data?.content).videos.length>0?(Ot(),jt("div",Npe,[(Ot(!0),jt(je,null,su(O(h.value?b.value:c.value.chat.data?.content).videos,(re,ce)=>(Ot(),jt("div",{key:"video-"+ce,style:{border:"1px solid #d9d9d9","border-radius":"4px",padding:"4px",background:"white"}},[A[35]||(A[35]=xt("div",{style:{"font-size":"11px",color:"#8c8c8c","margin-bottom":"4px"}},"生成的视频",-1)),xt("video",{src:re.src,controls:"",style:{"max-width":"100%",height:"auto",display:"block","border-radius":"2px"}}," 您的浏览器不支持视频播放。 ",8,Bpe)]))),128))])):ir("",!0)])):ir("",!0)])):c.value.chat.status==="error"?(Ot(),jt("div",kpe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[36]||(A[36]=mt(" 失败 ",-1))]),_:1}),xt("div",Fpe,so(c.value.chat.error),1)])):ir("",!0)]),_:1})]),_:1})]),_:1},8,["open","width"])]))}}},zpe=lpe(Lpe,[["__scopeId","data-v-b293cd32"]]),Hpe=[{path:"/",component:()=>Tr(()=>import("./dash.js"),__vite__mapDeps([0,1,2]))},{path:"/settings/server",component:()=>Tr(()=>import("./server.js"),__vite__mapDeps([3,4]))},{path:"/settings/workers",component:()=>Tr(()=>import("./workers.js"),[])},{path:"/settings/browser",component:()=>Tr(()=>import("./browser.js"),[])},{path:"/settings/adapters",component:()=>Tr(()=>import("./adapters.js"),[])},{path:"/tools/display",component:()=>Tr(()=>import("./display.js"),__vite__mapDeps([5,2]))},{path:"/tools/cache",component:()=>Tr(()=>import("./cache.js"),__vite__mapDeps([6,1]))},{path:"/tools/logs",component:()=>Tr(()=>import("./logs.js"),__vite__mapDeps([7,8]))},{path:"/tools/request",component:()=>Tr(()=>import("./request.js"),__vite__mapDeps([9,10]))}],jpe=tpe({history:Rfe(),routes:Hpe}),Vpe=B_(),wg=IO(zpe);wg.use(Vpe);wg.use(jpe);wg.use(Yde);wg.mount("#app");export{i0 as A,Vp as B,ml as C,$g as D,jp as E,je as F,ye as G,N1 as H,ze as I,M1 as J,ug as K,Bn as L,Nt as M,A1 as N,Qc as O,R1 as P,D1 as R,B1 as S,lpe as _,wn as a,bi as b,f as c,xt as d,mt as e,ir as f,bl as g,jt as h,At as i,JE as j,Ot as k,dt as l,Gn as m,su as n,We as o,P as p,Tr as q,oe as r,Qr as s,so as t,st as u,v1 as v,Je as w,cg as x,j_ as y,P1 as z}; +`);Q=X.pop()||"";for(const J of X)if(J.startsWith("data: ")){const Z=J.slice(6).trim();if(Z==="[DONE]")continue;try{const q=JSON.parse(Z).choices?.[0]?.delta?.content||"";b.value+=q}catch{}}}c.value[E].status="success",c.value[E].data={content:b.value};return}}const k=await fetch(A,N),F=await k.json();k.ok?(c.value[E].status="success",E==="chat"&&F.choices?.[0]?.message?.content?c.value[E].data={content:F.choices[0].message.content}:c.value[E].data=F):(c.value[E].status="error",c.value[E].error=F.error?.message||`HTTP ${k.status}`)}catch(A){c.value[E].status="error",c.value[E].error=A.message}},I=()=>{u.value=!0,Object.keys(c.value).forEach(E=>{c.value[E]={status:"pending",data:null,error:null}}),v.value=[],y()},T={dash:"/",history:"/tools/request","settings-server":"/settings/server","settings-workers":"/settings/workers","settings-browser":"/settings/browser","settings-adapters":"/settings/adapters","tools-display":"/tools/display","tools-cache":"/tools/cache","tools-logs":"/tools/logs"},_=({key:E})=>{const A=T[E];A&&(t.push(A),i.value&&(r.value=!0))},M=oe(!0);let R=null,D=!1;async function z(){try{(await fetch("/admin/status",{headers:n.getHeaders(),signal:AbortSignal.timeout(5e3)})).ok&&D&&(D=!1,Nt.destroyAll(),window.location.reload())}catch{!D&&!M.value&&(D=!0,Nt.warning({title:"后端连接断开",content:"无法连接到后端服务,请检查服务是否正在运行。连接恢复后页面将自动刷新。",okText:"我知道了",centered:!0}))}}return We(async()=>{const E=()=>{i.value=window.innerWidth<=768,i.value&&(r.value=!0)};E(),window.addEventListener("resize",E);try{n.token?await n.checkAuth()||(n.setToken(""),l.value=!0):l.value=!0}catch(A){console.error("Auth check failed",A),l.value=!0}finally{M.value=!1}R=setInterval(z,5e3),wn(()=>{window.removeEventListener("resize",E),R&&clearInterval(R)})}),(E,A)=>{const N=At("a-spin"),k=At("a-button"),F=At("a-flex"),L=At("a-layout-header"),H=At("a-menu-item"),j=At("a-sub-menu"),Y=At("a-menu"),Q=At("a-layout-sider"),U=At("router-view"),ee=At("a-layout-content"),X=At("a-card"),J=At("a-layout-footer"),Z=At("a-layout"),G=At("a-tag"),q=At("a-select-option"),V=At("a-select"),K=At("a-textarea"),te=At("a-upload-dragger"),ue=At("a-checkbox"),le=At("a-space"),ae=At("a-drawer");return M.value?(Ot(),bi(N,{key:0,spinning:M.value,tip:"正在验证身份...",size:"large",style:{height:"100vh",display:"flex","align-items":"center","justify-content":"center"}},null,8,["spinning"])):(Ot(),jt("div",ape,[f(ipe,{visible:l.value,"onUpdate:visible":A[0]||(A[0]=re=>l.value=re)},null,8,["visible"]),f(Z,{style:{"min-height":"100vh"},theme:"light"},{default:Je(()=>[f(L,{class:"header",style:sl({background:"rgba(255, 255, 255, 0.7)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",borderBottom:"1.5px solid rgba(0, 0, 0, 0.05)",display:"flex",alignItems:"center",padding:i.value?"0 12px":"0 24px",position:"fixed",width:"100%",top:0,zIndex:1e3})},{default:Je(()=>[i.value?(Ot(),bi(k,{key:0,type:"text",onClick:A[1]||(A[1]=re=>r.value=!r.value),style:{"margin-right":"8px","font-size":"18px"}},{icon:Je(()=>[f(st(_1))]),_:1})):ir("",!0),xt("div",{class:"logo",style:sl({fontSize:"1.25rem",fontWeight:"bold",color:"#1890ff",marginRight:i.value?"8px":"24px"})}," WebAI2API ",4),f(F,{justify:"end",align:"center",style:{flex:"1"},gap:8},{default:Je(()=>[f(k,{onClick:I,size:i.value?"small":"middle"},{icon:Je(()=>[f(st(I1))]),default:Je(()=>[i.value?ir("",!0):(Ot(),jt("span",spe,"接口测试"))]),_:1},8,["size"]),f(k,{danger:"",loading:a.value,onClick:s,size:i.value?"small":"middle"},{icon:Je(()=>[f(st(R1))]),default:Je(()=>[i.value?ir("",!0):(Ot(),jt("span",cpe,"退出登录"))]),_:1},8,["loading","size"])]),_:1})]),_:1},8,["style"]),f(Z,{style:{"margin-top":"64px"}},{default:Je(()=>[i.value&&!r.value?(Ot(),jt("div",{key:0,class:"sider-mask",onClick:A[2]||(A[2]=re=>r.value=!0)})):ir("",!0),f(Q,{collapsed:r.value,"onUpdate:collapsed":A[4]||(A[4]=re=>r.value=re),collapsible:"",theme:"light","collapsed-width":i.value?0:80,trigger:i.value?null:void 0,style:sl({position:"fixed",left:0,top:"64px",height:"calc(100vh - 64px)",overflowY:"auto",zIndex:i.value?200:100})},{default:Je(()=>[f(Y,{selectedKeys:o.value,"onUpdate:selectedKeys":A[3]||(A[3]=re=>o.value=re),mode:"inline",onClick:_},{default:Je(()=>[f(H,{key:"dash"},{default:Je(()=>[f(st(T1)),A[12]||(A[12]=xt("span",null,"状态概览",-1))]),_:1}),f(H,{key:"history"},{default:Je(()=>[f(st(N1)),A[13]||(A[13]=xt("span",null,"请求模型",-1))]),_:1}),f(j,{key:"settings"},{title:Je(()=>[xt("span",null,[f(st(B1)),A[14]||(A[14]=xt("span",null,"系统设置",-1))])]),default:Je(()=>[f(H,{key:"settings-server"},{default:Je(()=>[...A[15]||(A[15]=[mt("服务器",-1)])]),_:1}),f(H,{key:"settings-workers"},{default:Je(()=>[...A[16]||(A[16]=[mt("工作池",-1)])]),_:1}),f(H,{key:"settings-browser"},{default:Je(()=>[...A[17]||(A[17]=[mt("浏览器",-1)])]),_:1}),f(H,{key:"settings-adapters"},{default:Je(()=>[...A[18]||(A[18]=[mt("适配器",-1)])]),_:1})]),_:1}),f(j,{key:"tools"},{title:Je(()=>[xt("span",null,[f(st(k1)),A[19]||(A[19]=xt("span",null,"系统管理",-1))])]),default:Je(()=>[f(H,{key:"tools-display"},{default:Je(()=>[...A[20]||(A[20]=[mt("虚拟显示器",-1)])]),_:1}),f(H,{key:"tools-cache"},{default:Je(()=>[...A[21]||(A[21]=[mt("缓存与重启",-1)])]),_:1}),f(H,{key:"tools-logs"},{default:Je(()=>[...A[22]||(A[22]=[mt("日志查看器",-1)])]),_:1})]),_:1})]),_:1},8,["selectedKeys"])]),_:1},8,["collapsed","collapsed-width","trigger","style"]),f(Z,{style:sl({marginLeft:i.value?"0":r.value?"80px":"200px",padding:i.value?"12px":"16px",transition:"margin-left 0.2s"})},{default:Je(()=>[f(ee,{style:{"min-height":"280px"}},{default:Je(()=>[f(U)]),_:1}),f(J,{class:"footer",style:{padding:"0px","margin-top":"10px"}},{default:Je(()=>[f(X,{bordered:!1,bodyStyle:{padding:"16px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"}},{default:Je(()=>[xt("div",null,[xt("a",upe,[f(st(E1))])])]),_:1})]),_:1})]),_:1},8,["style"])]),_:1})]),_:1}),f(ae,{open:u.value,"onUpdate:open":A[11]||(A[11]=re=>u.value=re),title:"接口测试",placement:"right",width:i.value?"100%":500},{default:Je(()=>[f(le,{direction:"vertical",style:{width:"100%"},size:"large"},{default:Je(()=>[f(X,{title:"GET /v1/models",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[5]||(A[5]=re=>x("models")),loading:c.value.models.status==="loading"},{default:Je(()=>[...A[23]||(A[23]=[mt(" 测试 ",-1)])]),_:1},8,["loading"])]),default:Je(()=>[c.value.models.status==="success"?(Ot(),jt("div",dpe,[f(G,{color:"success"},{default:Je(()=>[f(st(ml)),A[24]||(A[24]=mt(" 成功 ",-1))]),_:1}),xt("div",fpe," 返回 "+so(c.value.models.data?.data?.length||0)+" 个模型 ",1)])):c.value.models.status==="error"?(Ot(),jt("div",ppe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[25]||(A[25]=mt(" 失败 ",-1))]),_:1}),xt("div",gpe,so(c.value.models.error),1)])):(Ot(),jt("div",hpe,"点击测试按钮开始"))]),_:1}),f(X,{title:"GET /v1/cookies",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[6]||(A[6]=re=>x("cookies")),loading:c.value.cookies.status==="loading"},{default:Je(()=>[...A[26]||(A[26]=[mt(" 测试 ",-1)])]),_:1},8,["loading"])]),default:Je(()=>[c.value.cookies.status==="success"?(Ot(),jt("div",vpe,[f(G,{color:"success"},{default:Je(()=>[f(st(ml)),A[27]||(A[27]=mt(" 成功 ",-1))]),_:1}),xt("div",mpe," 返回 "+so(c.value.cookies.data?.cookies?.length||0)+" 个 Cookie ",1)])):c.value.cookies.status==="error"?(Ot(),jt("div",bpe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[28]||(A[28]=mt(" 失败 ",-1))]),_:1}),xt("div",ype,so(c.value.cookies.error),1)])):(Ot(),jt("div",Spe,"点击测试按钮开始"))]),_:1}),f(X,{title:"POST /v1/chat/completions",size:"small"},{extra:Je(()=>[f(k,{size:"small",type:"primary",onClick:A[7]||(A[7]=re=>x("chat")),loading:c.value.chat.status==="loading",disabled:!p.value},{default:Je(()=>[...A[29]||(A[29]=[mt(" 测试 ",-1)])]),_:1},8,["loading","disabled"])]),default:Je(()=>[xt("div",$pe,[A[30]||(A[30]=xt("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"模型",-1)),f(V,{value:p.value,"onUpdate:value":A[8]||(A[8]=re=>p.value=re),style:{width:"100%"},size:"small",placeholder:"选择模型","show-search":""},{default:Je(()=>[(Ot(!0),jt(je,null,su(g.value,re=>(Ot(),bi(q,{key:re.id,value:re.id},{default:Je(()=>[mt(so(re.id),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),xt("div",Cpe,[A[31]||(A[31]=xt("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"提示词",-1)),f(K,{value:d.value,"onUpdate:value":A[9]||(A[9]=re=>d.value=re),placeholder:"输入提示词",rows:2,size:"small"},null,8,["value"])]),xt("div",xpe,[xt("div",wpe," 附加图片 ("+so(v.value.length)+"/10) ",1),f(te,{"file-list":[],multiple:!0,"before-upload":$,onChange:w,accept:".png,.jpg,.jpeg,.gif,.webp","show-upload-list":!1,style:{padding:"8px"}},{default:Je(()=>[xt("p",Ope,[f(st(M1),{style:{"font-size":"24px",color:"#1890ff"}})]),A[32]||(A[32]=xt("p",{style:{"font-size":"12px",margin:"4px 0 0 0",color:"#8c8c8c"}}," 点击或拖拽上传图片 (PNG/JPEG/GIF/WebP) ",-1))]),_:1}),v.value.length>0?(Ot(),jt("div",Ppe,[(Ot(!0),jt(je,null,su(v.value,re=>(Ot(),bi(G,{key:re.uid,closable:"",onClose:ce=>v.value=v.value.filter(pe=>pe.uid!==re.uid)},{default:Je(()=>[f(st(A1)),mt(" "+so(re.name.slice(0,15))+so(re.name.length>15?"...":""),1)]),_:2},1032,["onClose"]))),128))])):ir("",!0)]),xt("div",Ipe,[f(ue,{checked:h.value,"onUpdate:checked":A[10]||(A[10]=re=>h.value=re)},{default:Je(()=>[...A[33]||(A[33]=[mt("流式响应",-1)])]),_:1},8,["checked"])]),c.value.chat.status==="loading"||c.value.chat.status==="success"?(Ot(),jt("div",Tpe,[xt("div",Epe,[c.value.chat.status==="loading"?(Ot(),bi(G,{key:0,color:"processing"},{default:Je(()=>[f(st(Bn)),mt(" "+so(h.value?"正在接收流式响应...":"请求中,可能需要较长时间..."),1)]),_:1})):(Ot(),bi(G,{key:1,color:"success"},{default:Je(()=>[f(st(ml)),A[34]||(A[34]=mt(" 成功 ",-1))]),_:1}))]),(h.value?b.value:c.value.chat.data?.content)?(Ot(),jt("div",Mpe,[O(h.value?b.value:c.value.chat.data?.content).text?(Ot(),jt("pre",_pe,so(O(h.value?b.value:c.value.chat.data?.content).text),1)):ir("",!0),O(h.value?b.value:c.value.chat.data?.content).images.length>0?(Ot(),jt("div",Ape,[(Ot(!0),jt(je,null,su(O(h.value?b.value:c.value.chat.data?.content).images,(re,ce)=>(Ot(),jt("div",{key:ce,style:{border:"1px solid #d9d9d9","border-radius":"4px",padding:"4px",background:"white"}},[xt("div",Rpe,so(re.alt),1),xt("img",{src:re.src,alt:re.alt,style:{"max-width":"100%",height:"auto",display:"block","border-radius":"2px"}},null,8,Dpe)]))),128))])):ir("",!0),O(h.value?b.value:c.value.chat.data?.content).videos.length>0?(Ot(),jt("div",Npe,[(Ot(!0),jt(je,null,su(O(h.value?b.value:c.value.chat.data?.content).videos,(re,ce)=>(Ot(),jt("div",{key:"video-"+ce,style:{border:"1px solid #d9d9d9","border-radius":"4px",padding:"4px",background:"white"}},[A[35]||(A[35]=xt("div",{style:{"font-size":"11px",color:"#8c8c8c","margin-bottom":"4px"}},"生成的视频",-1)),xt("video",{src:re.src,controls:"",style:{"max-width":"100%",height:"auto",display:"block","border-radius":"2px"}}," 您的浏览器不支持视频播放。 ",8,Bpe)]))),128))])):ir("",!0)])):ir("",!0)])):c.value.chat.status==="error"?(Ot(),jt("div",kpe,[f(G,{color:"error"},{default:Je(()=>[f(st(bl)),A[36]||(A[36]=mt(" 失败 ",-1))]),_:1}),xt("div",Fpe,so(c.value.chat.error),1)])):ir("",!0)]),_:1})]),_:1})]),_:1},8,["open","width"])]))}}},zpe=lpe(Lpe,[["__scopeId","data-v-b293cd32"]]),Hpe=[{path:"/",component:()=>Tr(()=>import("./dash.js"),__vite__mapDeps([0,1,2]))},{path:"/settings/server",component:()=>Tr(()=>import("./server.js"),__vite__mapDeps([3,4]))},{path:"/settings/workers",component:()=>Tr(()=>import("./workers.js"),[])},{path:"/settings/browser",component:()=>Tr(()=>import("./browser.js"),[])},{path:"/settings/adapters",component:()=>Tr(()=>import("./adapters.js"),[])},{path:"/tools/display",component:()=>Tr(()=>import("./display.js"),__vite__mapDeps([5,2]))},{path:"/tools/cache",component:()=>Tr(()=>import("./cache.js"),__vite__mapDeps([6,1]))},{path:"/tools/logs",component:()=>Tr(()=>import("./logs.js"),__vite__mapDeps([7,8]))},{path:"/tools/request",component:()=>Tr(()=>import("./request.js"),__vite__mapDeps([9,10]))}],jpe=tpe({history:Rfe(),routes:Hpe}),Vpe=B_(),wg=IO(zpe);wg.use(Vpe);wg.use(jpe);wg.use(Yde);wg.mount("#app");export{i0 as A,Vp as B,ml as C,$g as D,jp as E,je as F,ye as G,N1 as H,ze as I,M1 as J,ug as K,Bn as L,Nt as M,A1 as N,Qc as O,R1 as P,$1 as Q,D1 as R,B1 as S,lpe as _,wn as a,bi as b,f as c,xt as d,mt as e,ir as f,bl as g,jt as h,At as i,JE as j,Ot as k,dt as l,Gn as m,su as n,We as o,P as p,Tr as q,oe as r,Qr as s,so as t,st as u,v1 as v,Je as w,cg as x,j_ as y,P1 as z}; diff --git a/webui/dist/assets/request.css b/webui/dist/assets/request.css index 0331fd7..b1ac46e 100644 --- a/webui/dist/assets/request.css +++ b/webui/dist/assets/request.css @@ -1 +1 @@ -.send-upload-area[data-v-43d844d5] .ant-upload-drag{height:calc(100% - 20px)}.stats-content[data-v-43d844d5]{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.stats-numbers[data-v-43d844d5]{display:flex;align-items:center;gap:20px}.stat-item[data-v-43d844d5]{display:flex;align-items:center;gap:6px;padding:4px 12px;background:#fafafa;border-radius:6px;transition:all .2s}.stat-item[data-v-43d844d5]:hover{background:#f0f0f0}.stat-item.success[data-v-43d844d5]{color:#52c41a}.stat-item.error[data-v-43d844d5]{color:#ff4d4f}.stat-item.neutral[data-v-43d844d5]{color:#8c8c8c}.stat-value[data-v-43d844d5]{font-size:18px;font-weight:600;font-family:SF Mono,Monaco,monospace}.stat-label[data-v-43d844d5]{font-size:12px;color:#8c8c8c}.toolbar[data-v-43d844d5]{margin-bottom:16px}.toolbar-row[data-v-43d844d5]{display:flex;align-items:center;gap:8px;margin-bottom:8px}.toolbar-row[data-v-43d844d5]:last-child{margin-bottom:0}.toolbar-status-select[data-v-43d844d5]{width:100px}.toolbar-model-select[data-v-43d844d5]{width:200px}@media(min-width:768px){.toolbar[data-v-43d844d5]{display:flex;justify-content:space-between;align-items:center;gap:12px}.toolbar-row[data-v-43d844d5]{margin-bottom:0}.toolbar-row[data-v-43d844d5]:last-child{flex:1;max-width:300px}}.error-text[data-v-43d844d5]{color:#ff4d4f;font-size:12px}.response-text[data-v-43d844d5]{font-size:12px;color:#595959}.multiline-text[data-v-43d844d5]{font-size:12px;line-height:1.5;max-height:54px;overflow:hidden;word-break:break-all}.multiline-text.clickable[data-v-43d844d5]{cursor:pointer;padding:4px;margin:-4px;border-radius:4px;transition:background .2s}.multiline-text.clickable[data-v-43d844d5]:hover{background:#f0f0f0}.no-media[data-v-43d844d5]{color:#bfbfbf}[data-v-43d844d5] .ant-table-tbody>tr>td{vertical-align:middle}.media-thumb-cell[data-v-43d844d5]{position:relative;width:160px;height:160px;cursor:pointer;display:flex;align-items:center;justify-content:center;margin:8px auto}.thumb-img[data-v-43d844d5]{width:160px;height:160px;object-fit:cover;border-radius:4px;border:1px solid #f0f0f0}.thumb-video[data-v-43d844d5]{width:160px;height:160px;background:#000;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:28px}.thumb-placeholder[data-v-43d844d5]{width:160px;height:160px;background:#fafafa;border:1px dashed #d9d9d9;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#bfbfbf;font-size:24px}.media-count[data-v-43d844d5]{position:absolute;bottom:4px;right:4px;background:#0009;color:#fff;font-size:11px;padding:2px 6px;border-radius:3px}.content-box[data-v-43d844d5]{background:#fafafa;border:1px solid #f0f0f0;border-radius:4px;padding:12px;font-family:Consolas,Monaco,monospace;font-size:13px;white-space:pre-wrap;word-break:break-all;max-height:600px;overflow-y:auto}.content-box.error-box[data-v-43d844d5]{color:#ff4d4f;background:#fff2f0;border-color:#ffccc7}.content-box.reasoning-box[data-v-43d844d5]{background:#f6ffed;border-color:#b7eb8f;color:#389e0d}.media-gallery-large[data-v-43d844d5]{display:flex;flex-direction:column;gap:16px}.media-card-large[data-v-43d844d5]{border:1px solid #f0f0f0;border-radius:8px;overflow:hidden;background:#fafafa}.media-preview-large[data-v-43d844d5]{width:100%;min-height:300px;max-height:500px;display:flex;align-items:center;justify-content:center;background:#f5f5f5}.media-preview-large img[data-v-43d844d5]{max-width:100%;max-height:500px;object-fit:contain}.media-preview-large video[data-v-43d844d5]{max-width:100%;max-height:500px}.media-placeholder-large[data-v-43d844d5]{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#bfbfbf;gap:12px;padding:40px;font-size:48px}.media-status[data-v-43d844d5]{font-size:14px}.media-list[data-v-43d844d5]{display:flex;flex-wrap:wrap;gap:8px}.preview-text-content[data-v-43d844d5]{background:#fafafa;border:1px solid #f0f0f0;border-radius:4px;padding:16px;font-family:Consolas,Monaco,monospace;font-size:14px;white-space:pre-wrap;word-break:break-all;max-height:60vh;overflow-y:auto;line-height:1.6}.preview-image-content[data-v-43d844d5]{display:flex;justify-content:center;align-items:center;min-height:200px}.preview-image-content img[data-v-43d844d5]{max-width:100%;max-height:70vh;object-fit:contain;border-radius:4px}.preview-video-content[data-v-43d844d5]{display:flex;justify-content:center;align-items:center}.preview-video-content video[data-v-43d844d5]{max-width:100%;max-height:70vh;border-radius:4px}.send-upload-area[data-v-43d844d5]{flex:0 0 280px;min-width:200px}.stats-date-picker[data-v-43d844d5]{width:240px}@media(max-width:768px){.send-upload-area[data-v-43d844d5]{flex:1 1 100%!important;min-width:0!important}.stats-date-picker[data-v-43d844d5]{width:100%}.media-thumb-cell[data-v-43d844d5],.thumb-img[data-v-43d844d5]{width:80px;height:80px}.thumb-video[data-v-43d844d5]{width:80px;height:80px;font-size:20px}.thumb-placeholder[data-v-43d844d5]{width:80px;height:80px;font-size:18px}.toolbar[data-v-43d844d5]{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.toolbar-row[data-v-43d844d5]{flex-wrap:nowrap;margin-bottom:0;gap:4px}.toolbar-row[data-v-43d844d5]:last-child{flex:1;min-width:100px}.toolbar-status-select[data-v-43d844d5]{width:80px!important}.toolbar-model-select[data-v-43d844d5]{width:100px!important}.stat-value[data-v-43d844d5]{font-size:14px}.stat-item[data-v-43d844d5]{padding:2px 8px}.content-box[data-v-43d844d5]{max-height:400px;font-size:12px;padding:8px}.media-preview-large[data-v-43d844d5]{min-height:200px;max-height:350px}}@media(max-width:576px){.stats-content[data-v-43d844d5]{flex-direction:column;align-items:flex-start}.stats-content .ant-divider[data-v-43d844d5]{display:none}.stats-numbers[data-v-43d844d5]{margin-top:8px;flex-wrap:wrap;gap:8px}.stat-item[data-v-43d844d5]{padding:2px 6px;gap:4px}.stat-value[data-v-43d844d5]{font-size:13px}.stat-label[data-v-43d844d5]{font-size:11px}} +.send-upload-area[data-v-095eec66] .ant-upload-drag{height:calc(100% - 20px)}.stats-content[data-v-095eec66]{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.stats-numbers[data-v-095eec66]{display:flex;align-items:center;gap:20px}.stat-item[data-v-095eec66]{display:flex;align-items:center;gap:6px;padding:4px 12px;background:#fafafa;border-radius:6px;transition:all .2s}.stat-item[data-v-095eec66]:hover{background:#f0f0f0}.stat-item.success[data-v-095eec66]{color:#52c41a}.stat-item.error[data-v-095eec66]{color:#ff4d4f}.stat-item.neutral[data-v-095eec66]{color:#8c8c8c}.stat-value[data-v-095eec66]{font-size:18px;font-weight:600;font-family:SF Mono,Monaco,monospace}.stat-label[data-v-095eec66]{font-size:12px;color:#8c8c8c}.toolbar[data-v-095eec66]{margin-bottom:16px}.toolbar-row[data-v-095eec66]{display:flex;align-items:center;gap:8px;margin-bottom:8px}.toolbar-row[data-v-095eec66]:last-child{margin-bottom:0}.toolbar-status-select[data-v-095eec66]{width:100px}.toolbar-model-select[data-v-095eec66]{width:200px}@media(min-width:768px){.toolbar[data-v-095eec66]{display:flex;justify-content:space-between;align-items:center;gap:12px}.toolbar-row[data-v-095eec66]{margin-bottom:0}.toolbar-row[data-v-095eec66]:last-child{flex:1;max-width:300px}}.error-text[data-v-095eec66]{color:#ff4d4f;font-size:12px}.response-text[data-v-095eec66]{font-size:12px;color:#595959}.multiline-text[data-v-095eec66]{font-size:12px;line-height:1.5;max-height:54px;overflow:hidden;word-break:break-all}.multiline-text.clickable[data-v-095eec66]{cursor:pointer;padding:4px;margin:-4px;border-radius:4px;transition:background .2s}.multiline-text.clickable[data-v-095eec66]:hover{background:#f0f0f0}.no-media[data-v-095eec66]{color:#bfbfbf}[data-v-095eec66] .ant-table-tbody>tr>td{vertical-align:middle}.media-thumb-cell[data-v-095eec66]{position:relative;width:160px;height:160px;cursor:pointer;display:flex;align-items:center;justify-content:center;margin:8px auto}.thumb-img[data-v-095eec66]{width:160px;height:160px;object-fit:cover;border-radius:4px;border:1px solid #f0f0f0}.thumb-video[data-v-095eec66]{width:160px;height:160px;background:#000;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#fff;font-size:28px}.thumb-placeholder[data-v-095eec66]{width:160px;height:160px;background:#fafafa;border:1px dashed #d9d9d9;border-radius:4px;display:flex;align-items:center;justify-content:center;color:#bfbfbf;font-size:24px}.media-count[data-v-095eec66]{position:absolute;bottom:4px;right:4px;background:#0009;color:#fff;font-size:11px;padding:2px 6px;border-radius:3px}.content-box[data-v-095eec66]{background:#fafafa;border:1px solid #f0f0f0;border-radius:4px;padding:12px;font-family:Consolas,Monaco,monospace;font-size:13px;white-space:pre-wrap;word-break:break-all;max-height:600px;overflow-y:auto}.content-box.error-box[data-v-095eec66]{color:#ff4d4f;background:#fff2f0;border-color:#ffccc7}.content-box.reasoning-box[data-v-095eec66]{background:#f6ffed;border-color:#b7eb8f;color:#389e0d}.media-gallery-large[data-v-095eec66]{display:flex;flex-direction:column;gap:16px}.media-card-large[data-v-095eec66]{border:1px solid #f0f0f0;border-radius:8px;overflow:hidden;background:#fafafa}.media-preview-large[data-v-095eec66]{width:100%;min-height:300px;max-height:500px;display:flex;align-items:center;justify-content:center;background:#f5f5f5}.media-preview-large img[data-v-095eec66]{max-width:100%;max-height:500px;object-fit:contain}.media-preview-large video[data-v-095eec66]{max-width:100%;max-height:500px}.media-placeholder-large[data-v-095eec66]{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#bfbfbf;gap:12px;padding:40px;font-size:48px}.media-status[data-v-095eec66]{font-size:14px}.media-list[data-v-095eec66]{display:flex;flex-wrap:wrap;gap:8px}.preview-text-content[data-v-095eec66]{background:#fafafa;border:1px solid #f0f0f0;border-radius:4px;padding:16px;font-family:Consolas,Monaco,monospace;font-size:14px;white-space:pre-wrap;word-break:break-all;max-height:60vh;overflow-y:auto;line-height:1.6}.preview-image-content[data-v-095eec66]{display:flex;justify-content:center;align-items:center;min-height:200px}.preview-image-content img[data-v-095eec66]{max-width:100%;max-height:70vh;object-fit:contain;border-radius:4px}.preview-video-content[data-v-095eec66]{display:flex;justify-content:center;align-items:center}.preview-video-content video[data-v-095eec66]{max-width:100%;max-height:70vh;border-radius:4px}.send-upload-area[data-v-095eec66]{flex:0 0 280px;min-width:200px}.stats-date-picker[data-v-095eec66]{width:240px}@media(max-width:768px){.send-upload-area[data-v-095eec66]{flex:1 1 100%!important;min-width:0!important}.stats-date-picker[data-v-095eec66]{width:100%}.media-thumb-cell[data-v-095eec66],.thumb-img[data-v-095eec66]{width:80px;height:80px}.thumb-video[data-v-095eec66]{width:80px;height:80px;font-size:20px}.thumb-placeholder[data-v-095eec66]{width:80px;height:80px;font-size:18px}.toolbar[data-v-095eec66]{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.toolbar-row[data-v-095eec66]{flex-wrap:nowrap;margin-bottom:0;gap:4px}.toolbar-row[data-v-095eec66]:last-child{flex:1;min-width:100px}.toolbar-status-select[data-v-095eec66]{width:80px!important}.toolbar-model-select[data-v-095eec66]{width:100px!important}.stat-value[data-v-095eec66]{font-size:14px}.stat-item[data-v-095eec66]{padding:2px 8px}.content-box[data-v-095eec66]{max-height:400px;font-size:12px;padding:8px}.media-preview-large[data-v-095eec66]{min-height:200px;max-height:350px}}@media(max-width:576px){.stats-content[data-v-095eec66]{flex-direction:column;align-items:flex-start}.stats-content .ant-divider[data-v-095eec66]{display:none}.stats-numbers[data-v-095eec66]{margin-top:8px;flex-wrap:wrap;gap:8px}.stat-item[data-v-095eec66]{padding:2px 6px;gap:4px}.stat-value[data-v-095eec66]{font-size:13px}.stat-label[data-v-095eec66]{font-size:11px}} diff --git a/webui/dist/assets/request.js b/webui/dist/assets/request.js index fc6e6ca..a29f36a 100644 --- a/webui/dist/assets/request.js +++ b/webui/dist/assets/request.js @@ -1 +1 @@ -import{c as a,I as Ee,_ as ft,j as mt,G as ye,o as gt,a as yt,h as r,w as l,d as i,F as b,n as q,e as c,u as y,H as _t,t as v,J as ht,f as D,K as Re,C as Te,g as $e,x as je,D as _e,R as Ue,b as M,N as he,O as wt,A as kt,m as _,i as h,r as p,p as bt,M as Ie,k as n}from"./index.js";var xt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};function Le(w){for(var u=1;u{if(!S.value)return!1;const t=J.value.find(e=>e.id===S.value);return t?t.image_policy!=="forbidden":!1});let G=null;const ee=p(window.innerWidth<=768);let te=null;const ae={success:{color:"#52c41a",text:"成功",icon:Te},failed:{color:"#ff4d4f",text:"失败",icon:$e},pending:{color:"#faad14",text:"处理中",icon:je}},P=async()=>{g.value=!0;try{const t=new URLSearchParams({page:E.value,pageSize:K.value});z.value&&z.value!=="all"&&t.append("status",z.value),$.value&&t.append("model",$.value),j.value&&t.append("search",j.value),f.value&&f.value.length===2&&(t.append("startDate",f.value[0].format("YYYY-MM-DD")),t.append("endDate",f.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history?${t.toString()}`,{headers:u.getHeaders()});if(e.ok){const o=await e.json();k.value=o.items||[],Y.value=o.total||0,xe()}}catch{_.error("获取历史记录失败")}finally{g.value=!1}},xe=async()=>{for(const t of k.value)if(t.responseMedia&&t.responseMedia.length>0){const e=t.responseMedia[0];e.localPath&&e.status==="downloaded"&&await ue(e)}},le=async()=>{try{const t=new URLSearchParams;f.value&&f.value.length===2&&(t.append("startDate",f.value[0].format("YYYY-MM-DD")),t.append("endDate",f.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history/stats?${t.toString()}`,{headers:u.getHeaders()});e.ok&&(F.value=await e.json())}catch(t){console.error("获取统计失败",t)}},Me=async()=>{try{const t=await fetch("/admin/history/models",{headers:u.getHeaders()});t.ok&&(ke.value=await t.json())}catch(t){console.error("获取模型列表失败",t)}},Ce=async t=>{ne.value=!0,oe.value=!0;try{const e=await fetch(`/admin/history/${t.id}`,{headers:u.getHeaders()});if(e.ok&&(d.value=await e.json(),d.value.responseMedia))for(const o of d.value.responseMedia)o.localPath&&o.status==="downloaded"&&await ue(o)}catch{_.error("获取详情失败")}finally{oe.value=!1}},ue=async t=>{if(!t.localPath)return null;const e=t.localPath.split("/").pop(),o=e;if(Z.value[o])return Z.value[o];try{const x=await fetch(`/admin/history/media/${e}`,{headers:u.getHeaders()});if(x.ok){const fe=await x.blob(),W=URL.createObjectURL(fe);return Z.value[o]=W,W}}catch(x){console.error("获取媒体失败",x)}return null},se=t=>{if(!t||!t.localPath)return null;const e=t.localPath.split("/").pop();return Z.value[e]||null},Ne=async(t,e)=>{try{const o=await fetch(`/admin/history/${t}/retry-media`,{method:"POST",headers:{...u.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({mediaIndex:e})});if(o.ok)_.success("下载成功"),P(),d.value&&d.value.id===t&&Ce(d.value);else{const x=await o.json();_.error(x.message||"下载失败")}}catch{_.error("请求失败")}},De=t=>{Ie.confirm({title:"确认删除",content:`确定要删除这 ${t.length} 条记录吗?关联的媒体文件也会被删除。`,okText:"删除",okType:"danger",cancelText:"取消",async onOk(){try{(await fetch("/admin/history",{method:"DELETE",headers:{...u.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({ids:t})})).ok?(_.success("删除成功"),pe(),P(),le()):_.error("删除失败")}catch{_.error("请求失败")}}})},Be=()=>{if(!f.value||f.value.length!==2){_.warning("请先选择日期范围");return}Ie.confirm({title:"确认删除",content:`确定要删除 ${f.value[0].format("YYYY-MM-DD")} 至 ${f.value[1].format("YYYY-MM-DD")} 的所有记录吗?`,okText:"删除",okType:"danger",cancelText:"取消",async onOk(){try{const t=new URLSearchParams({startDate:f.value[0].format("YYYY-MM-DD"),endDate:f.value[1].format("YYYY-MM-DD")}),e=await fetch(`/admin/history?${t.toString()}`,{method:"DELETE",headers:u.getHeaders()});if(e.ok){const o=await e.json();_.success(`已删除 ${o.deleted} 条记录`),pe(),P(),le()}else _.error("删除失败")}catch{_.error("请求失败")}}})},Ae=t=>t?new Date(t).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",de=t=>t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:"-",ce=(t,e=120)=>t?t.length>e?t.substring(0,e)+"...":t:"-",Ye=t=>t.responseMedia&&t.responseMedia.length>0,B=t=>Ye(t)?t.responseMedia[0]:null,Ve=[{title:"状态",dataIndex:"status",key:"status",width:70,align:"center"},{title:"Prompt",dataIndex:"prompt",key:"prompt",width:200},{title:"模型",dataIndex:"model_name",key:"model_name",width:150,ellipsis:!0},{title:"响应",key:"response",width:220},{title:"媒体",key:"media",width:180,align:"center"},{title:"时间",dataIndex:"created_at",key:"created_at",width:100,customRender:({value:t})=>Ae(t)},{title:"耗时",dataIndex:"duration_ms",key:"duration_ms",width:60,align:"right",customRender:({value:t})=>de(t)},{title:"",key:"action",width:100,align:"center",fixed:"right"}];ye([z,$,f],()=>{E.value=1,P(),le()}),ye(S,()=>{C.value=[]});let ve=null;ye(j,()=>{ve&&clearTimeout(ve),ve=setTimeout(()=>{E.value=1,P()},300)});const Je=t=>{E.value=t.current,K.value=t.pageSize,pe(),P()},Ge=()=>{P(),Me()},Oe=async t=>{I.value=!0,O.value="text",t.status==="failed"?N.value=t.error_message||"未知错误":N.value=t.response_text||"无响应"},We=async t=>{const e=B(t);if(e){if(e.type==="image")O.value="image";else if(e.type==="video")O.value="video";else{O.value="text",N.value=e.originalUrl||"无预览",I.value=!0;return}if(e.status==="downloaded"){const o=await ue(e);o?(X.value=o,I.value=!0):_.error("预览加载失败")}else N.value="媒体未下载或下载失败,请查看详情并重试下载",O.value="text",I.value=!0}},qe=()=>{I.value=!1,N.value="",X.value="",O.value="text"},Qe=(t,e)=>{U.value=t,be.value=e},Ke=()=>{if(U.value.length===0){_.warning("请先选择要删除的记录");return}De(U.value)},pe=()=>{U.value=[],be.value=[]},Xe=async()=>{try{const t=await fetch("/v1/models",{headers:u.getHeaders()});if(t.ok){const e=await t.json();J.value=e.data||[],J.value.length>0&&!S.value&&(S.value=J.value[0].id)}}catch(t){console.error("获取模型列表失败",t)}},Ze=t=>new Promise((e,o)=>{const x=new FileReader;x.readAsDataURL(t),x.onload=()=>e(x.result),x.onerror=o}),et=t=>["image/png","image/jpeg","image/gif","image/webp"].includes(t.type)?(C.value.length>=10&&_.error("最多上传 10 张图片"),!1):(_.error("仅支持 PNG, JPEG, GIF, WebP 格式"),!1),tt=async t=>{const e=t.file;if(e.status==="removed"){C.value=C.value.filter(o=>o.uid!==e.uid);return}try{const o=await Ze(e.originFileObj||e);C.value.push({uid:e.uid,name:e.name,base64:o})}catch{_.error("图片读取失败")}},Se=()=>{if(!S.value){_.warning("请选择模型");return}if(!L.value.trim()){_.warning("请输入提示词");return}let t;if(C.value.length>0){t=[{type:"text",text:L.value}];for(const o of C.value)t.push({type:"image_url",image_url:{url:o.base64}})}else t=L.value;const e={model:S.value,messages:[{role:"user",content:t}],stream:ie.value};re.value&&(e.reasoning=!0),fetch("/v1/chat/completions",{method:"POST",headers:{...u.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{}),_.success("请求已发送"),L.value="",C.value=[],lt(),setTimeout(()=>{ze(),Pe()},1e3)},at=t=>{const e=t.model_id||t.model_name;e&&(S.value=e),t.prompt&&(L.value=t.prompt),C.value=[],Se()},ze=async()=>{try{const t=new URLSearchParams({page:E.value,pageSize:K.value});z.value&&z.value!=="all"&&t.append("status",z.value),$.value&&t.append("model",$.value),j.value&&t.append("search",j.value),f.value&&f.value.length===2&&(t.append("startDate",f.value[0].format("YYYY-MM-DD")),t.append("endDate",f.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history?${t.toString()}`,{headers:u.getHeaders()});if(e.ok){const o=await e.json();k.value=o.items||[],Y.value=o.total||0,xe()}}catch{}},Pe=async()=>{try{const t=new URLSearchParams;f.value&&f.value.length===2&&(t.append("startDate",f.value[0].format("YYYY-MM-DD")),t.append("endDate",f.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history/stats?${t.toString()}`,{headers:u.getHeaders()});e.ok&&(F.value=await e.json())}catch{}},lt=()=>{G||(G=setInterval(()=>{ze(),Pe()},5e3))},st=()=>{G&&(clearInterval(G),G=null)};return gt(()=>{te=()=>{ee.value=window.innerWidth<=768},window.addEventListener("resize",te),P(),le(),Me(),Xe()}),yt(()=>{st(),te&&window.removeEventListener("resize",te)}),(t,e)=>{const o=h("a-select-option"),x=h("a-select"),fe=h("a-textarea"),W=h("a-checkbox"),R=h("a-button"),nt=h("a-upload-dragger"),H=h("a-tag"),me=h("a-card"),ot=h("a-range-picker"),A=h("a-divider"),it=h("a-input-search"),ge=h("a-tooltip"),rt=h("a-space"),ut=h("a-table"),V=h("a-descriptions-item"),dt=h("a-descriptions"),ct=h("a-spin"),vt=h("a-drawer"),pt=h("a-modal");return n(),r(b,null,[a(me,{title:"发送请求",bordered:!1,style:{"margin-bottom":"24px"}},{default:l(()=>[i("div",Yt,[i("div",Ot,[i("div",St,[e[10]||(e[10]=i("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"模型",-1)),a(x,{value:S.value,"onUpdate:value":e[0]||(e[0]=s=>S.value=s),style:{width:"100%"},size:"small",placeholder:"选择模型","show-search":""},{default:l(()=>[(n(!0),r(b,null,q(J.value,s=>(n(),M(o,{key:s.id,value:s.id},{default:l(()=>[c(v(s.id),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),i("div",zt,[e[11]||(e[11]=i("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"提示词",-1)),a(fe,{value:L.value,"onUpdate:value":e[1]||(e[1]=s=>L.value=s),placeholder:"输入提示词",rows:3,size:"small"},null,8,["value"])]),i("div",Pt,[a(W,{checked:ie.value,"onUpdate:checked":e[2]||(e[2]=s=>ie.value=s)},{default:l(()=>[...e[12]||(e[12]=[c("流式响应",-1)])]),_:1},8,["checked"]),a(W,{checked:re.value,"onUpdate:checked":e[3]||(e[3]=s=>re.value=s)},{default:l(()=>[...e[13]||(e[13]=[c("返回思考",-1)])]),_:1},8,["checked"]),a(R,{type:"primary",onClick:Se,disabled:!S.value},{icon:l(()=>[a(y(_t))]),default:l(()=>[e[14]||(e[14]=c(" 发送 ",-1))]),_:1},8,["disabled"])])]),Fe.value?(n(),r("div",Rt,[i("div",Tt," 附加图片 ("+v(C.value.length)+"/10) ",1),a(nt,{"file-list":[],multiple:!0,"before-upload":et,onChange:tt,accept:".png,.jpg,.jpeg,.gif,.webp","show-upload-list":!1},{default:l(()=>[i("p",$t,[a(y(ht),{style:{"font-size":"20px",color:"#1890ff"}})]),e[15]||(e[15]=i("p",{style:{"font-size":"12px",margin:"2px 0 0 0",color:"#8c8c8c"}}," 点击或拖拽上传图片 ",-1))]),_:1}),C.value.length>0?(n(),r("div",jt,[(n(!0),r(b,null,q(C.value,s=>(n(),M(H,{key:s.uid,closable:"",onClose:m=>C.value=C.value.filter(T=>T.uid!==s.uid)},{default:l(()=>[a(y(he)),c(" "+v(s.name.slice(0,15))+v(s.name.length>15?"...":""),1)]),_:2},1032,["onClose"]))),128))])):D("",!0)])):D("",!0)])]),_:1}),a(me,{title:"请求记录",bordered:!1},{extra:l(()=>[a(R,{type:"link",danger:"",size:"small",onClick:Be,disabled:!f.value||f.value.length!==2},{icon:l(()=>[a(y(_e))]),default:l(()=>[e[16]||(e[16]=c(" 删除所选范围 ",-1))]),_:1},8,["disabled"])]),default:l(()=>[i("div",Ut,[a(ot,{value:f.value,"onUpdate:value":e[4]||(e[4]=s=>f.value=s),format:"YYYY-MM-DD",placeholder:["开始日期","结束日期"],size:"small",class:"stats-date-picker"},null,8,["value"]),a(A,{type:"vertical",style:{height:"32px",margin:"0 16px"}}),i("div",It,[i("div",Lt,[a(y(Re)),i("span",Ht,v(F.value.total),1),e[17]||(e[17]=i("span",{class:"stat-label"},"总数",-1))]),i("div",Et,[a(y(Te)),i("span",Ft,v(F.value.success),1),e[18]||(e[18]=i("span",{class:"stat-label"},"成功",-1))]),i("div",Nt,[a(y($e)),i("span",Bt,v(F.value.failed),1),e[19]||(e[19]=i("span",{class:"stat-label"},"失败",-1))]),i("div",At,[a(y(je)),i("span",Vt,v(de(F.value.avgDuration)),1),e[20]||(e[20]=i("span",{class:"stat-label"},"平均耗时",-1))])])])]),_:1}),a(me,{bordered:!1,style:{"margin-top":"24px"}},{default:l(()=>[i("div",Jt,[i("div",Gt,[a(x,{value:z.value,"onUpdate:value":e[5]||(e[5]=s=>z.value=s),class:"toolbar-status-select",size:"small",placeholder:"状态"},{default:l(()=>[a(o,{value:"all"},{default:l(()=>[...e[21]||(e[21]=[c("全部状态",-1)])]),_:1}),a(o,{value:"success"},{default:l(()=>[...e[22]||(e[22]=[c("成功",-1)])]),_:1}),a(o,{value:"failed"},{default:l(()=>[...e[23]||(e[23]=[c("失败",-1)])]),_:1}),a(o,{value:"pending"},{default:l(()=>[...e[24]||(e[24]=[c("处理中",-1)])]),_:1})]),_:1},8,["value"]),a(x,{value:$.value,"onUpdate:value":e[6]||(e[6]=s=>$.value=s),class:"toolbar-model-select",size:"small",placeholder:"全部模型","allow-clear":"","show-search":""},{default:l(()=>[(n(!0),r(b,null,q(ke.value,s=>(n(),M(o,{key:s,value:s},{default:l(()=>[c(v(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),a(R,{size:"small",onClick:Ge},{icon:l(()=>[a(y(Ue))]),_:1}),U.value.length>0?(n(),M(R,{key:0,type:"primary",danger:"",size:"small",onClick:Ke},{icon:l(()=>[a(y(_e))]),default:l(()=>[c(" 删除选中 ("+v(U.value.length)+") ",1)]),_:1})):D("",!0)]),i("div",Wt,[a(it,{value:j.value,"onUpdate:value":e[7]||(e[7]=s=>j.value=s),placeholder:"搜索 Prompt 或响应内容",size:"small","allow-clear":"",style:{width:"100%"}},null,8,["value"])])]),a(ut,{columns:Ve,"data-source":k.value,loading:g.value,"row-selection":{selectedRowKeys:U.value,onChange:Qe,columnWidth:40},pagination:{current:E.value,pageSize:K.value,total:Y.value,showSizeChanger:!0,showQuickJumper:!0,showTotal:s=>`共 ${s} 条`,pageSizeOptions:["20","50","100","200"]},"row-key":"id",size:"small",scroll:{x:1e3},onChange:Je},{bodyCell:l(({column:s,record:m})=>[s.key==="prompt"?(n(),r("div",qt,v(ce(m.prompt,120)),1)):s.key==="response"?(n(),r(b,{key:1},[m.status==="failed"?(n(),r("div",{key:0,class:"multiline-text error-text clickable",onClick:T=>Oe(m),title:"点击查看完整内容"},v(ce(m.error_message,120)||"错误"),9,Qt)):(n(),r("div",{key:1,class:"multiline-text response-text clickable",onClick:T=>Oe(m),title:"点击查看完整内容"},v(ce(m.response_text,120)||"-"),9,Kt))],64)):s.key==="media"?(n(),r(b,{key:2},[Ye(m)?(n(),r("div",{key:0,class:"media-thumb-cell",onClick:T=>We(m),title:"点击查看大图"},[B(m).status==="downloaded"?(n(),r(b,{key:0},[B(m).type==="image"?(n(),r("img",{key:0,src:se(B(m)),class:"thumb-img",loading:"lazy"},null,8,Zt)):B(m).type==="video"?(n(),r("div",ea,[a(y(Q))])):D("",!0)],64)):(n(),r("div",ta,[B(m).type==="image"?(n(),M(y(he),{key:0})):(n(),M(y(Q),{key:1}))])),m.responseMedia.length>1?(n(),r("span",aa," +"+v(m.responseMedia.length-1),1)):D("",!0)],8,Xt)):(n(),r("span",la,"-"))],64)):s.key==="status"?(n(),M(H,{key:3,color:ae[m.status]?.color||"#8c8c8c",size:"small"},{default:l(()=>[c(v(ae[m.status]?.text||m.status),1)]),_:2},1032,["color"])):s.key==="action"?(n(),M(rt,{key:4,size:0},{default:l(()=>[a(ge,{title:"重发"},{default:l(()=>[a(R,{type:"link",size:"small",onClick:T=>at(m)},{icon:l(()=>[a(y(we))]),_:1},8,["onClick"])]),_:2},1024),a(ge,{title:"详情"},{default:l(()=>[a(R,{type:"link",size:"small",onClick:T=>Ce(m)},{icon:l(()=>[a(y(wt))]),_:1},8,["onClick"])]),_:2},1024),a(ge,{title:"删除"},{default:l(()=>[a(R,{type:"link",size:"small",danger:"",onClick:T=>De([m.id])},{icon:l(()=>[a(y(_e))]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)):D("",!0)]),_:1},8,["data-source","loading","row-selection","pagination"])]),_:1}),a(vt,{open:ne.value,"onUpdate:open":e[8]||(e[8]=s=>ne.value=s),title:"请求详情",placement:"right",width:ee.value?"100%":700,"destroy-on-close":!0},{default:l(()=>[a(ct,{spinning:oe.value},{default:l(()=>[d.value?(n(),r(b,{key:0},[a(dt,{column:ee.value?1:2,size:"small",bordered:""},{default:l(()=>[a(V,{label:"请求 ID",span:2},{default:l(()=>[i("code",null,v(d.value.id),1)]),_:1}),a(V,{label:"时间"},{default:l(()=>[c(v(new Date(d.value.created_at).toLocaleString("zh-CN")),1)]),_:1}),a(V,{label:"状态"},{default:l(()=>[a(H,{color:ae[d.value.status]?.color},{default:l(()=>[c(v(ae[d.value.status]?.text||d.value.status),1)]),_:1},8,["color"])]),_:1}),a(V,{label:"模型",span:2},{default:l(()=>[c(v(d.value.model_name||d.value.model_id||"-"),1)]),_:1}),a(V,{label:"耗时"},{default:l(()=>[c(v(de(d.value.duration_ms)),1)]),_:1}),a(V,{label:"流式"},{default:l(()=>[c(v(d.value.isStreaming?"是":"否"),1)]),_:1})]),_:1},8,["column"]),a(A,{orientation:"left"},{default:l(()=>[...e[25]||(e[25]=[c("Prompt",-1)])]),_:1}),i("div",sa,v(d.value.prompt||"无"),1),d.value.inputImages&&d.value.inputImages.length>0?(n(),r(b,{key:0},[a(A,{orientation:"left"},{default:l(()=>[...e[26]||(e[26]=[c("输入图片",-1)])]),_:1}),i("div",na,[(n(!0),r(b,null,q(d.value.inputImages,(s,m)=>(n(),r("span",{key:m,class:"media-item"},[a(H,null,{default:l(()=>[c(v(s.split("/").pop()),1)]),_:2},1024)]))),128))])],64)):D("",!0),a(A,{orientation:"left"},{default:l(()=>[...e[27]||(e[27]=[c("响应内容",-1)])]),_:1}),i("div",{class:kt(["content-box",{"error-box":d.value.status==="failed"}])},[d.value.status==="failed"?(n(),r(b,{key:0},[c(v(d.value.error_message||"未知错误"),1)],64)):(n(),r(b,{key:1},[c(v(d.value.response_text||"无响应"),1)],64))],2),d.value.reasoning_content?(n(),r(b,{key:1},[a(A,{orientation:"left"},{default:l(()=>[...e[28]||(e[28]=[c("思考过程",-1)])]),_:1}),i("div",oa,v(d.value.reasoning_content),1)],64)):D("",!0),d.value.responseMedia&&d.value.responseMedia.length>0?(n(),r(b,{key:2},[a(A,{orientation:"left"},{default:l(()=>[c("媒体内容 ("+v(d.value.responseMedia.length)+")",1)]),_:1}),i("div",ia,[(n(!0),r(b,null,q(d.value.responseMedia,(s,m)=>(n(),r("div",{key:m,class:"media-card-large"},[i("div",ra,[s.status==="downloaded"&&se(s)?(n(),r(b,{key:0},[s.type==="image"?(n(),r("img",{key:0,src:se(s),alt:"生成图片"},null,8,ua)):s.type==="video"?(n(),r("video",{key:1,src:se(s),controls:""},null,8,da)):D("",!0)],64)):(n(),r("div",ca,[s.type==="image"?(n(),M(y(he),{key:0})):s.type==="video"?(n(),M(y(Q),{key:1})):(n(),M(y(Re),{key:2})),i("div",va,[s.status==="failed"?(n(),M(H,{key:0,color:"red"},{default:l(()=>[...e[29]||(e[29]=[c("下载失败",-1)])]),_:1})):s.status==="external"?(n(),M(H,{key:1,color:"blue"},{default:l(()=>[...e[30]||(e[30]=[c("外部链接",-1)])]),_:1})):s.status==="pending"?(n(),M(H,{key:2,color:"orange"},{default:l(()=>[...e[31]||(e[31]=[c("待下载",-1)])]),_:1})):D("",!0)]),s.status==="failed"?(n(),M(R,{key:3,type:"primary",size:"small",onClick:T=>Ne(d.value.id,m)},{icon:l(()=>[a(y(Ue))]),default:l(()=>[e[32]||(e[32]=c(" 重试下载 ",-1))]),_:1},8,["onClick"])):D("",!0)]))])]))),128))])],64)):D("",!0)],64)):D("",!0)]),_:1},8,["spinning"])]),_:1},8,["open","width"]),a(pt,{open:I.value,"onUpdate:open":e[9]||(e[9]=s=>I.value=s),footer:null,width:ee.value?"95%":O.value==="image"||O.value==="video"?"90%":"70%",centered:"",onCancel:qe},{title:l(()=>[...e[33]||(e[33]=[i("span",null,"快速预览",-1)])]),default:l(()=>[O.value==="text"?(n(),r("div",pa,v(N.value),1)):O.value==="image"?(n(),r("div",fa,[i("img",{src:X.value,alt:"预览图片"},null,8,ma)])):O.value==="video"?(n(),r("div",ga,[i("video",{src:X.value,controls:"",autoplay:""},null,8,ya)])):D("",!0)]),_:1},8,["open","width"])],64)}}},wa=ft(_a,[["__scopeId","data-v-43d844d5"]]);export{wa as default}; +import{c as a,I as Ne,_ as ht,j as _t,G as he,o as wt,a as kt,h as u,w as l,d as i,F as b,n as q,e as c,u as h,H as bt,t as v,J as xt,f as M,K as Te,C as $e,g as je,x as Ue,D as _e,R as Le,b as x,N as we,O as Ct,A as Mt,Q as Dt,m as y,i as _,r as p,p as Yt,M as Ie,k as n}from"./index.js";var Ot={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};function He(w){for(var r=1;r{if(!S.value)return!1;const t=V.value.find(e=>e.id===S.value);return t?t.image_policy!=="forbidden":!1});let G=null;const te=p(window.innerWidth<=768);let ae=null;const le={success:{color:"#52c41a",text:"成功",icon:$e},failed:{color:"#ff4d4f",text:"失败",icon:je},pending:{color:"#faad14",text:"处理中",icon:Ue}},j=async()=>{g.value=!0;try{const t=new URLSearchParams({page:N.value,pageSize:K.value});z.value&&z.value!=="all"&&t.append("status",z.value),U.value&&t.append("model",U.value),L.value&&t.append("search",L.value),m.value&&m.value.length===2&&(t.append("startDate",m.value[0].format("YYYY-MM-DD")),t.append("endDate",m.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history?${t.toString()}`,{headers:r.getHeaders()});if(e.ok){const o=await e.json();k.value=o.items||[],Y.value=o.total||0,Ce()}}catch{y.error("获取历史记录失败")}finally{g.value=!1}},Ce=async()=>{for(const t of k.value)if(t.responseMedia&&t.responseMedia.length>0){const e=t.responseMedia[0];e.localPath&&e.status==="downloaded"&&await de(e)}},se=async()=>{try{const t=new URLSearchParams;m.value&&m.value.length===2&&(t.append("startDate",m.value[0].format("YYYY-MM-DD")),t.append("endDate",m.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history/stats?${t.toString()}`,{headers:r.getHeaders()});e.ok&&(F.value=await e.json())}catch(t){console.error("获取统计失败",t)}},Me=async()=>{try{const t=await fetch("/admin/history/models",{headers:r.getHeaders()});t.ok&&(be.value=await t.json())}catch(t){console.error("获取模型列表失败",t)}},De=async t=>{oe.value=!0,ie.value=!0;try{const e=await fetch(`/admin/history/${t.id}`,{headers:r.getHeaders()});if(e.ok&&(d.value=await e.json(),d.value.responseMedia))for(const o of d.value.responseMedia)o.localPath&&o.status==="downloaded"&&await de(o)}catch{y.error("获取详情失败")}finally{ie.value=!1}},de=async t=>{if(!t.localPath)return null;const e=t.localPath.split("/").pop(),o=e;if(ee.value[o])return ee.value[o];try{const C=await fetch(`/admin/history/media/${e}`,{headers:r.getHeaders()});if(C.ok){const me=await C.blob(),W=URL.createObjectURL(me);return ee.value[o]=W,W}}catch(C){console.error("获取媒体失败",C)}return null},ne=t=>{if(!t||!t.localPath)return null;const e=t.localPath.split("/").pop();return ee.value[e]||null},Be=async(t,e)=>{try{const o=await fetch(`/admin/history/${t}/retry-media`,{method:"POST",headers:{...r.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({mediaIndex:e})});if(o.ok)y.success("下载成功"),j(),d.value&&d.value.id===t&&De(d.value);else{const C=await o.json();y.error(C.message||"下载失败")}}catch{y.error("请求失败")}},Ye=t=>{Ie.confirm({title:"确认删除",content:`确定要删除这 ${t.length} 条记录吗?关联的媒体文件也会被删除。`,okText:"删除",okType:"danger",cancelText:"取消",async onOk(){try{(await fetch("/admin/history",{method:"DELETE",headers:{...r.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({ids:t})})).ok?(y.success("删除成功"),fe(),j(),se()):y.error("删除失败")}catch{y.error("请求失败")}}})},Ae=()=>{if(!m.value||m.value.length!==2){y.warning("请先选择日期范围");return}Ie.confirm({title:"确认删除",content:`确定要删除 ${m.value[0].format("YYYY-MM-DD")} 至 ${m.value[1].format("YYYY-MM-DD")} 的所有记录吗?`,okText:"删除",okType:"danger",cancelText:"取消",async onOk(){try{const t=new URLSearchParams({startDate:m.value[0].format("YYYY-MM-DD"),endDate:m.value[1].format("YYYY-MM-DD")}),e=await fetch(`/admin/history?${t.toString()}`,{method:"DELETE",headers:r.getHeaders()});if(e.ok){const o=await e.json();y.success(`已删除 ${o.deleted} 条记录`),fe(),j(),se()}else y.error("删除失败")}catch{y.error("请求失败")}}})},Je=t=>t?new Date(t).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",ce=t=>t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:"-",ve=(t,e=120)=>t?t.length>e?t.substring(0,e)+"...":t:"-",Oe=t=>t.responseMedia&&t.responseMedia.length>0,B=t=>Oe(t)?t.responseMedia[0]:null,Ve=[{title:"状态",dataIndex:"status",key:"status",width:70,align:"center"},{title:"Prompt",dataIndex:"prompt",key:"prompt",width:200},{title:"模型",dataIndex:"model_name",key:"model_name",width:150,ellipsis:!0},{title:"响应",key:"response",width:220},{title:"媒体",key:"media",width:180,align:"center"},{title:"时间",dataIndex:"created_at",key:"created_at",width:100,customRender:({value:t})=>Je(t)},{title:"耗时",dataIndex:"duration_ms",key:"duration_ms",width:60,align:"right",customRender:({value:t})=>ce(t)},{title:"",key:"action",width:100,align:"center",fixed:"right"}];he([z,U,m],()=>{N.value=1,j(),se()}),he(S,()=>{D.value=[]});let pe=null;he(L,()=>{pe&&clearTimeout(pe),pe=setTimeout(()=>{N.value=1,j()},300)});const Ge=t=>{N.value=t.current,K.value=t.pageSize,fe(),j()},We=()=>{j(),Me()},Se=async t=>{T.value=!0,O.value="text",Z.value="响应预览",t.status==="failed"?$.value=t.error_message||"未知错误":$.value=t.response_text||"无响应"},qe=t=>{T.value=!0,O.value="text",Z.value="Prompt 预览",$.value=t.prompt||"无内容"},Qe=async()=>{try{await navigator.clipboard.writeText($.value),y.success("已复制到剪贴板")}catch{y.error("复制失败")}},Ke=async t=>{const e=B(t);if(e){if(e.type==="image")O.value="image";else if(e.type==="video")O.value="video";else{O.value="text",$.value=e.originalUrl||"无预览",T.value=!0;return}if(e.status==="downloaded"){const o=await de(e);o?(X.value=o,T.value=!0):y.error("预览加载失败")}else $.value="媒体未下载或下载失败,请查看详情并重试下载",O.value="text",T.value=!0}},Xe=()=>{T.value=!1,$.value="",X.value="",O.value="text",Z.value="快速预览"},Ze=(t,e)=>{I.value=t,xe.value=e},et=()=>{if(I.value.length===0){y.warning("请先选择要删除的记录");return}Ye(I.value)},fe=()=>{I.value=[],xe.value=[]},tt=async()=>{try{const t=await fetch("/v1/models",{headers:r.getHeaders()});if(t.ok){const e=await t.json();V.value=e.data||[],V.value.length>0&&!S.value&&(S.value=V.value[0].id)}}catch(t){console.error("获取模型列表失败",t)}},at=t=>new Promise((e,o)=>{const C=new FileReader;C.readAsDataURL(t),C.onload=()=>e(C.result),C.onerror=o}),lt=t=>["image/png","image/jpeg","image/gif","image/webp"].includes(t.type)?(D.value.length>=10&&y.error("最多上传 10 张图片"),!1):(y.error("仅支持 PNG, JPEG, GIF, WebP 格式"),!1),st=async t=>{const e=t.file;if(e.status==="removed"){D.value=D.value.filter(o=>o.uid!==e.uid);return}try{const o=await at(e.originFileObj||e);D.value.push({uid:e.uid,name:e.name,base64:o})}catch{y.error("图片读取失败")}},ze=()=>{if(!S.value){y.warning("请选择模型");return}if(!H.value.trim()){y.warning("请输入提示词");return}let t;if(D.value.length>0){t=[{type:"text",text:H.value}];for(const o of D.value)t.push({type:"image_url",image_url:{url:o.base64}})}else t=H.value;const e={model:S.value,messages:[{role:"user",content:t}],stream:re.value};ue.value&&(e.reasoning=!0),fetch("/v1/chat/completions",{method:"POST",headers:{...r.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{}),y.success("请求已发送"),H.value="",D.value=[],it(),setTimeout(()=>{Pe(),Re()},1e3)},nt=async t=>{try{await fetch("/admin/history",{method:"DELETE",headers:{...r.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({ids:[t]})})}catch{}},ot=t=>{const e=t.model_id||t.model_name;e&&(S.value=e),t.prompt&&(H.value=t.prompt),D.value=[];const o=t.status==="failed";ze(),o&&nt(t.id)},Pe=async()=>{try{const t=new URLSearchParams({page:N.value,pageSize:K.value});z.value&&z.value!=="all"&&t.append("status",z.value),U.value&&t.append("model",U.value),L.value&&t.append("search",L.value),m.value&&m.value.length===2&&(t.append("startDate",m.value[0].format("YYYY-MM-DD")),t.append("endDate",m.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history?${t.toString()}`,{headers:r.getHeaders()});if(e.ok){const o=await e.json();k.value=o.items||[],Y.value=o.total||0,Ce()}}catch{}},Re=async()=>{try{const t=new URLSearchParams;m.value&&m.value.length===2&&(t.append("startDate",m.value[0].format("YYYY-MM-DD")),t.append("endDate",m.value[1].format("YYYY-MM-DD")));const e=await fetch(`/admin/history/stats?${t.toString()}`,{headers:r.getHeaders()});e.ok&&(F.value=await e.json())}catch{}},it=()=>{G||(G=setInterval(()=>{Pe(),Re()},5e3))},rt=()=>{G&&(clearInterval(G),G=null)};return wt(()=>{ae=()=>{te.value=window.innerWidth<=768},window.addEventListener("resize",ae),j(),se(),Me(),tt()}),kt(()=>{rt(),ae&&window.removeEventListener("resize",ae)}),(t,e)=>{const o=_("a-select-option"),C=_("a-select"),me=_("a-textarea"),W=_("a-checkbox"),P=_("a-button"),ut=_("a-upload-dragger"),E=_("a-tag"),ge=_("a-card"),dt=_("a-range-picker"),A=_("a-divider"),ct=_("a-input-search"),ye=_("a-tooltip"),vt=_("a-space"),pt=_("a-table"),J=_("a-descriptions-item"),ft=_("a-descriptions"),mt=_("a-spin"),gt=_("a-drawer"),yt=_("a-modal");return n(),u(b,null,[a(ge,{title:"发送请求",bordered:!1,style:{"margin-bottom":"24px"}},{default:l(()=>[i("div",Rt,[i("div",Tt,[i("div",$t,[e[10]||(e[10]=i("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"模型",-1)),a(C,{value:S.value,"onUpdate:value":e[0]||(e[0]=s=>S.value=s),style:{width:"100%"},size:"small",placeholder:"选择模型","show-search":""},{default:l(()=>[(n(!0),u(b,null,q(V.value,s=>(n(),x(o,{key:s.id,value:s.id},{default:l(()=>[c(v(s.id),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),i("div",jt,[e[11]||(e[11]=i("div",{style:{"font-size":"12px",color:"#8c8c8c","margin-bottom":"4px"}},"提示词",-1)),a(me,{value:H.value,"onUpdate:value":e[1]||(e[1]=s=>H.value=s),placeholder:"输入提示词",rows:3,size:"small"},null,8,["value"])]),i("div",Ut,[a(W,{checked:re.value,"onUpdate:checked":e[2]||(e[2]=s=>re.value=s)},{default:l(()=>[...e[12]||(e[12]=[c("流式响应",-1)])]),_:1},8,["checked"]),a(W,{checked:ue.value,"onUpdate:checked":e[3]||(e[3]=s=>ue.value=s)},{default:l(()=>[...e[13]||(e[13]=[c("返回思考",-1)])]),_:1},8,["checked"]),a(P,{type:"primary",onClick:ze,disabled:!S.value},{icon:l(()=>[a(h(bt))]),default:l(()=>[e[14]||(e[14]=c(" 发送 ",-1))]),_:1},8,["disabled"])])]),Fe.value?(n(),u("div",Lt,[i("div",It," 附加图片 ("+v(D.value.length)+"/10) ",1),a(ut,{"file-list":[],multiple:!0,"before-upload":lt,onChange:st,accept:".png,.jpg,.jpeg,.gif,.webp","show-upload-list":!1},{default:l(()=>[i("p",Ht,[a(h(xt),{style:{"font-size":"20px",color:"#1890ff"}})]),e[15]||(e[15]=i("p",{style:{"font-size":"12px",margin:"2px 0 0 0",color:"#8c8c8c"}}," 点击或拖拽上传图片 ",-1))]),_:1}),D.value.length>0?(n(),u("div",Et,[(n(!0),u(b,null,q(D.value,s=>(n(),x(E,{key:s.uid,closable:"",onClose:f=>D.value=D.value.filter(R=>R.uid!==s.uid)},{default:l(()=>[a(h(we)),c(" "+v(s.name.slice(0,15))+v(s.name.length>15?"...":""),1)]),_:2},1032,["onClose"]))),128))])):M("",!0)])):M("",!0)])]),_:1}),a(ge,{title:"请求记录",bordered:!1},{extra:l(()=>[a(P,{type:"link",danger:"",size:"small",onClick:Ae,disabled:!m.value||m.value.length!==2},{icon:l(()=>[a(h(_e))]),default:l(()=>[e[16]||(e[16]=c(" 删除所选范围 ",-1))]),_:1},8,["disabled"])]),default:l(()=>[i("div",Nt,[a(dt,{value:m.value,"onUpdate:value":e[4]||(e[4]=s=>m.value=s),format:"YYYY-MM-DD",placeholder:["开始日期","结束日期"],size:"small",class:"stats-date-picker"},null,8,["value"]),a(A,{type:"vertical",style:{height:"32px",margin:"0 16px"}}),i("div",Ft,[i("div",Bt,[a(h(Te)),i("span",At,v(F.value.total),1),e[17]||(e[17]=i("span",{class:"stat-label"},"总数",-1))]),i("div",Jt,[a(h($e)),i("span",Vt,v(F.value.success),1),e[18]||(e[18]=i("span",{class:"stat-label"},"成功",-1))]),i("div",Gt,[a(h(je)),i("span",Wt,v(F.value.failed),1),e[19]||(e[19]=i("span",{class:"stat-label"},"失败",-1))]),i("div",qt,[a(h(Ue)),i("span",Qt,v(ce(F.value.avgDuration)),1),e[20]||(e[20]=i("span",{class:"stat-label"},"平均耗时",-1))])])])]),_:1}),a(ge,{bordered:!1,style:{"margin-top":"24px"}},{default:l(()=>[i("div",Kt,[i("div",Xt,[a(C,{value:z.value,"onUpdate:value":e[5]||(e[5]=s=>z.value=s),class:"toolbar-status-select",size:"small",placeholder:"状态"},{default:l(()=>[a(o,{value:"all"},{default:l(()=>[...e[21]||(e[21]=[c("全部状态",-1)])]),_:1}),a(o,{value:"success"},{default:l(()=>[...e[22]||(e[22]=[c("成功",-1)])]),_:1}),a(o,{value:"failed"},{default:l(()=>[...e[23]||(e[23]=[c("失败",-1)])]),_:1}),a(o,{value:"pending"},{default:l(()=>[...e[24]||(e[24]=[c("处理中",-1)])]),_:1})]),_:1},8,["value"]),a(C,{value:U.value,"onUpdate:value":e[6]||(e[6]=s=>U.value=s),class:"toolbar-model-select",size:"small",placeholder:"全部模型","allow-clear":"","show-search":""},{default:l(()=>[(n(!0),u(b,null,q(be.value,s=>(n(),x(o,{key:s,value:s},{default:l(()=>[c(v(s),1)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),a(P,{size:"small",onClick:We},{icon:l(()=>[a(h(Le))]),_:1}),I.value.length>0?(n(),x(P,{key:0,type:"primary",danger:"",size:"small",onClick:et},{icon:l(()=>[a(h(_e))]),default:l(()=>[c(" 删除选中 ("+v(I.value.length)+") ",1)]),_:1})):M("",!0)]),i("div",Zt,[a(ct,{value:L.value,"onUpdate:value":e[7]||(e[7]=s=>L.value=s),placeholder:"搜索 Prompt 或响应内容",size:"small","allow-clear":"",style:{width:"100%"}},null,8,["value"])])]),a(pt,{columns:Ve,"data-source":k.value,loading:g.value,"row-selection":{selectedRowKeys:I.value,onChange:Ze,columnWidth:40},pagination:{current:N.value,pageSize:K.value,total:Y.value,showSizeChanger:!0,showQuickJumper:!0,showTotal:s=>`共 ${s} 条`,pageSizeOptions:["20","50","100","200"]},"row-key":"id",size:"small",scroll:{x:1e3},onChange:Ge},{bodyCell:l(({column:s,record:f})=>[s.key==="prompt"?(n(),u("div",{key:0,class:"multiline-text clickable",onClick:R=>qe(f),title:"点击查看完整内容"},v(ve(f.prompt,120)),9,ea)):s.key==="response"?(n(),u(b,{key:1},[f.status==="failed"?(n(),u("div",{key:0,class:"multiline-text error-text clickable",onClick:R=>Se(f),title:"点击查看完整内容"},v(ve(f.error_message,120)||"错误"),9,ta)):(n(),u("div",{key:1,class:"multiline-text response-text clickable",onClick:R=>Se(f),title:"点击查看完整内容"},v(ve(f.response_text,120)||"-"),9,aa))],64)):s.key==="media"?(n(),u(b,{key:2},[Oe(f)?(n(),u("div",{key:0,class:"media-thumb-cell",onClick:R=>Ke(f),title:"点击查看大图"},[B(f).status==="downloaded"?(n(),u(b,{key:0},[B(f).type==="image"?(n(),u("img",{key:0,src:ne(B(f)),class:"thumb-img",loading:"lazy"},null,8,sa)):B(f).type==="video"?(n(),u("div",na,[a(h(Q))])):M("",!0)],64)):(n(),u("div",oa,[B(f).type==="image"?(n(),x(h(we),{key:0})):(n(),x(h(Q),{key:1}))])),f.responseMedia.length>1?(n(),u("span",ia," +"+v(f.responseMedia.length-1),1)):M("",!0)],8,la)):(n(),u("span",ra,"-"))],64)):s.key==="status"?(n(),x(E,{key:3,color:le[f.status]?.color||"#8c8c8c",size:"small"},{default:l(()=>[c(v(le[f.status]?.text||f.status),1)]),_:2},1032,["color"])):s.key==="action"?(n(),x(vt,{key:4,size:0},{default:l(()=>[a(ye,{title:"重发"},{default:l(()=>[a(P,{type:"link",size:"small",onClick:R=>ot(f)},{icon:l(()=>[a(h(ke))]),_:1},8,["onClick"])]),_:2},1024),a(ye,{title:"详情"},{default:l(()=>[a(P,{type:"link",size:"small",onClick:R=>De(f)},{icon:l(()=>[a(h(Ct))]),_:1},8,["onClick"])]),_:2},1024),a(ye,{title:"删除"},{default:l(()=>[a(P,{type:"link",size:"small",danger:"",onClick:R=>Ye([f.id])},{icon:l(()=>[a(h(_e))]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)):M("",!0)]),_:1},8,["data-source","loading","row-selection","pagination"])]),_:1}),a(gt,{open:oe.value,"onUpdate:open":e[8]||(e[8]=s=>oe.value=s),title:"请求详情",placement:"right",width:te.value?"100%":700,"destroy-on-close":!0},{default:l(()=>[a(mt,{spinning:ie.value},{default:l(()=>[d.value?(n(),u(b,{key:0},[a(ft,{column:te.value?1:2,size:"small",bordered:""},{default:l(()=>[a(J,{label:"请求 ID",span:2},{default:l(()=>[i("code",null,v(d.value.id),1)]),_:1}),a(J,{label:"时间"},{default:l(()=>[c(v(new Date(d.value.created_at).toLocaleString("zh-CN")),1)]),_:1}),a(J,{label:"状态"},{default:l(()=>[a(E,{color:le[d.value.status]?.color},{default:l(()=>[c(v(le[d.value.status]?.text||d.value.status),1)]),_:1},8,["color"])]),_:1}),a(J,{label:"模型",span:2},{default:l(()=>[c(v(d.value.model_name||d.value.model_id||"-"),1)]),_:1}),a(J,{label:"耗时"},{default:l(()=>[c(v(ce(d.value.duration_ms)),1)]),_:1}),a(J,{label:"流式"},{default:l(()=>[c(v(d.value.isStreaming?"是":"否"),1)]),_:1})]),_:1},8,["column"]),a(A,{orientation:"left"},{default:l(()=>[...e[25]||(e[25]=[c("Prompt",-1)])]),_:1}),i("div",ua,v(d.value.prompt||"无"),1),d.value.inputImages&&d.value.inputImages.length>0?(n(),u(b,{key:0},[a(A,{orientation:"left"},{default:l(()=>[...e[26]||(e[26]=[c("输入图片",-1)])]),_:1}),i("div",da,[(n(!0),u(b,null,q(d.value.inputImages,(s,f)=>(n(),u("span",{key:f,class:"media-item"},[a(E,null,{default:l(()=>[c(v(s.split("/").pop()),1)]),_:2},1024)]))),128))])],64)):M("",!0),a(A,{orientation:"left"},{default:l(()=>[...e[27]||(e[27]=[c("响应内容",-1)])]),_:1}),i("div",{class:Mt(["content-box",{"error-box":d.value.status==="failed"}])},[d.value.status==="failed"?(n(),u(b,{key:0},[c(v(d.value.error_message||"未知错误"),1)],64)):(n(),u(b,{key:1},[c(v(d.value.response_text||"无响应"),1)],64))],2),d.value.reasoning_content?(n(),u(b,{key:1},[a(A,{orientation:"left"},{default:l(()=>[...e[28]||(e[28]=[c("思考过程",-1)])]),_:1}),i("div",ca,v(d.value.reasoning_content),1)],64)):M("",!0),d.value.responseMedia&&d.value.responseMedia.length>0?(n(),u(b,{key:2},[a(A,{orientation:"left"},{default:l(()=>[c("媒体内容 ("+v(d.value.responseMedia.length)+")",1)]),_:1}),i("div",va,[(n(!0),u(b,null,q(d.value.responseMedia,(s,f)=>(n(),u("div",{key:f,class:"media-card-large"},[i("div",pa,[s.status==="downloaded"&&ne(s)?(n(),u(b,{key:0},[s.type==="image"?(n(),u("img",{key:0,src:ne(s),alt:"生成图片"},null,8,fa)):s.type==="video"?(n(),u("video",{key:1,src:ne(s),controls:""},null,8,ma)):M("",!0)],64)):(n(),u("div",ga,[s.type==="image"?(n(),x(h(we),{key:0})):s.type==="video"?(n(),x(h(Q),{key:1})):(n(),x(h(Te),{key:2})),i("div",ya,[s.status==="failed"?(n(),x(E,{key:0,color:"red"},{default:l(()=>[...e[29]||(e[29]=[c("下载失败",-1)])]),_:1})):s.status==="external"?(n(),x(E,{key:1,color:"blue"},{default:l(()=>[...e[30]||(e[30]=[c("外部链接",-1)])]),_:1})):s.status==="pending"?(n(),x(E,{key:2,color:"orange"},{default:l(()=>[...e[31]||(e[31]=[c("待下载",-1)])]),_:1})):M("",!0)]),s.status==="failed"?(n(),x(P,{key:3,type:"primary",size:"small",onClick:R=>Be(d.value.id,f)},{icon:l(()=>[a(h(Le))]),default:l(()=>[e[32]||(e[32]=c(" 重试下载 ",-1))]),_:1},8,["onClick"])):M("",!0)]))])]))),128))])],64)):M("",!0)],64)):M("",!0)]),_:1},8,["spinning"])]),_:1},8,["open","width"]),a(yt,{open:T.value,"onUpdate:open":e[9]||(e[9]=s=>T.value=s),footer:null,width:te.value?"95%":O.value==="image"||O.value==="video"?"90%":"70%",centered:"",onCancel:Xe},{title:l(()=>[i("div",ha,[i("span",null,v(Z.value),1),O.value==="text"?(n(),x(P,{key:0,type:"text",size:"small",onClick:Qe},{icon:l(()=>[a(h(Dt))]),default:l(()=>[e[33]||(e[33]=c(" 复制全文 ",-1))]),_:1})):M("",!0)])]),default:l(()=>[O.value==="text"?(n(),u("div",_a,v($.value),1)):O.value==="image"?(n(),u("div",wa,[i("img",{src:X.value,alt:"预览图片"},null,8,ka)])):O.value==="video"?(n(),u("div",ba,[i("video",{src:X.value,controls:"",autoplay:""},null,8,xa)])):M("",!0)]),_:1},8,["open","width"])],64)}}},Da=ht(Ca,[["__scopeId","data-v-095eec66"]]);export{Da as default}; diff --git a/webui/src/components/tools/request.vue b/webui/src/components/tools/request.vue index 596053c..173a5d6 100644 --- a/webui/src/components/tools/request.vue +++ b/webui/src/components/tools/request.vue @@ -15,7 +15,8 @@ import { RocketOutlined, RedoOutlined, InboxOutlined, - LoadingOutlined + LoadingOutlined, + CopyOutlined } from '@ant-design/icons-vue'; import { message, Modal } from 'ant-design-vue'; @@ -52,6 +53,7 @@ const previewModalVisible = ref(false); const previewContent = ref(''); const previewMediaType = ref('text'); // text, image, video const previewMediaUrl = ref(''); +const previewTitle = ref('快速预览'); // 媒体数据缓存 (blob URLs) const mediaCache = ref({}); @@ -466,6 +468,7 @@ const handleRefresh = () => { const previewResponse = async (record) => { previewModalVisible.value = true; previewMediaType.value = 'text'; + previewTitle.value = '响应预览'; if (record.status === 'failed') { previewContent.value = record.error_message || '未知错误'; } else { @@ -473,6 +476,24 @@ const previewResponse = async (record) => { } }; +// 快速预览 Prompt 内容 +const previewPrompt = (record) => { + previewModalVisible.value = true; + previewMediaType.value = 'text'; + previewTitle.value = 'Prompt 预览'; + previewContent.value = record.prompt || '无内容'; +}; + +// 复制预览内容到剪贴板 +const copyPreviewContent = async () => { + try { + await navigator.clipboard.writeText(previewContent.value); + message.success('已复制到剪贴板'); + } catch (e) { + message.error('复制失败'); + } +}; + // 快速预览媒体 const previewMedia = async (record) => { const media = getFirstMedia(record); @@ -510,6 +531,7 @@ const closePreview = () => { previewContent.value = ''; previewMediaUrl.value = ''; previewMediaType.value = 'text'; + previewTitle.value = '快速预览'; }; // 多选变化 @@ -641,6 +663,20 @@ const sendRequest = () => { }, 1000); }; +// 静默删除记录(不弹确认框) +const silentDeleteRecord = async (id) => { + try { + await fetch('/admin/history', { + method: 'DELETE', + headers: { + ...settingsStore.getHeaders(), + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ ids: [id] }) + }); + } catch (e) { /* 静默失败 */ } +}; + // 从历史记录重发 const resendFromRecord = (record) => { const modelId = record.model_id || record.model_name; @@ -651,7 +687,15 @@ const resendFromRecord = (record) => { sendPrompt.value = record.prompt; } sendImageList.value = []; + + // 如果原记录是失败状态(没有生成回复或图片),重发后删除旧记录 + const shouldDelete = record.status === 'failed'; + sendRequest(); + + if (shouldDelete) { + silentDeleteRecord(record.id); + } }; // === 自动刷新 === @@ -877,9 +921,9 @@ onUnmounted(() => { @change="handleTableChange" >