wi-chat 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { Component } from 'vue';
2
2
  import { AiAnswerReport, AiAnswerValues } from './answer';
3
3
  import { StreamChunk } from './sse';
4
4
  import { KnowledgeRenderOptions } from './answerCom/knowledgeStream/types';
5
- import { FrontReplyOptions } from './answerCom/actionExecute/types';
5
+ import { ActionExecuteOptions } from './answerCom/actionExecute/types';
6
6
 
7
7
  /**
8
8
  * 一个回答类型的解析器:实时流 chunk 应用与历史 report 归一化的双链路收敛单元。
@@ -56,14 +56,14 @@ export interface AnswerParseOptions extends KnowledgeRenderOptions {
56
56
  */
57
57
  parsers?: AnswerParser[];
58
58
  /**
59
- * front_reply 帧处理配置(action_execute 指令:host 执行器 + wait_reply 回包通道)。
59
+ * action_execute 指令处理配置(只用于 `executor === 'agent'` 的指令:agent 下发、宿主执行)。
60
60
  * useChat 会自动注入 reply(sendWsMessage),宿主通常只需提供 execute;
61
- * 未提供时 host 指令一律回失败帧,确认卡片仍会正常展示(提交时提示回传失败)。
61
+ * `executor === 'host'` 的 collect_clarifications 走确认卡片,不需要宿主注入执行器。
62
62
  */
63
- frontReply?: FrontReplyOptions;
63
+ actionExecute?: ActionExecuteOptions;
64
64
  }
65
65
  /**
66
- * 实时流 chunk 分发:按「内置(deepThinking → knowledgeStream → iframePage → recordset → outputFile → actionExecute)+ options.parsers」
66
+ * 实时流 chunk 分发:按「内置(deepThinking → knowledgeStream → iframePage → recordset → outputFile → collectClarifications → agentAction)+ options.parsers」
67
67
  * 顺序把 chunk **广播**给每个 parser——`applyChunk` 返回 true 表示已消费,但不再中断后续遍历,
68
68
  * 返回全部消费者 id。
69
69
  * 自定义 parser 声明了与内置相同的 `answerType` 且实现 `applyChunk` 时,同类型内置会被**自动替换**
@@ -0,0 +1,19 @@
1
+ import { AiAnswerReport, AgentActionValue } from 'wi-chat/parser';
2
+
3
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
+ /** 本卡片对应的回答报告(values 为解析器产出的执行过程) */
5
+ report: AiAnswerReport<AgentActionValue>;
6
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
7
+ /** 本卡片对应的回答报告(values 为解析器产出的执行过程) */
8
+ report: AiAnswerReport<AgentActionValue>;
9
+ }>>>, {}, {}>;
10
+ export default _default;
11
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
12
+ type __VLS_TypePropsToRuntimeProps<T> = {
13
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
14
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
15
+ } : {
16
+ type: import('vue').PropType<T[K]>;
17
+ required: true;
18
+ };
19
+ };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("wi-chat/style.css");const e=require("vue"),N=require("wi-chat/parser"),T=require("wi-chat/tools"),K=require("@iframe-resizer/vue/iframe-resizer.vue"),se=[{...N.knowledgeStreamParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>De))},{...N.iframePageParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>It))},{...N.outputFileParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>gt))},{...N.actionExecuteParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>vn))}],X=o=>{const l=s=>{const a={};for(const n of s)!n.answerType||!n.component||(a[n.answerType]=n.component);return a};return{...l(se),...l(o??[])}},ie=o=>(e.pushScopeId("data-v-efad55c8"),o=o(),e.popScopeId(),o),ce={class:"flex justify-start"},ue={class:"ai-answer-bubble"},de={key:0,class:"ai-answer-bubble__error"},pe={class:"ai-answer-bubble__body"},fe={key:0,class:"ai-answer-bubble__status"},_e={key:2,class:"ai-answer-bubble__status"},me={key:3,class:"ai-answer-bubble__loading"},ve=ie(()=>e.createElementVNode("span",{class:"ai-answer-bubble__pulse"},null,-1)),we=e.defineComponent({__name:"AiAnswerBubble",props:{answer:{},error:{type:Boolean,default:!1},stopped:{type:Boolean,default:!1},contentMap:{default:()=>X()}},setup(o){const l=o,s=e.computed(()=>{var n,c;return((c=(n=l.answer)==null?void 0:n.answer)==null?void 0:c.reports)??[]}),a=e.computed(()=>s.value.filter(n=>l.contentMap[n.answer_type]));return(n,c)=>(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",ue,[n.error?(e.openBlock(),e.createElementBlock("div",de,"回答加载失败")):a.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,E)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.contentMap[f.answer_type]),{key:E,report:f},null,8,["report"]))),128))]),n.stopped?(e.openBlock(),e.createElementBlock("div",fe,"回答已停止")):e.createCommentVNode("",!0)],64)):n.stopped?(e.openBlock(),e.createElementBlock("div",_e,"回答已停止")):s.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",me,[ve,e.createTextVNode("正在思考...")]))])]))}}),D=(o,l)=>{const s=o.__vccOpts||o;for(const[a,n]of l)s[a]=n;return s},ye=D(we,[["__scopeId","data-v-efad55c8"]]),ke=o=>(e.pushScopeId("data-v-de333356"),o=o(),e.popScopeId(),o),he=["data-wi-md-scope"],Ee=["aria-expanded"],ge=ke(()=>e.createElementVNode("span",{class:"deep-thinking__title"},"深度思考",-1)),be={class:"deep-thinking__count"},Ve={class:"deep-thinking__list"},Be={class:"deep-thinking__index"},Se=["innerHTML"],Ne=e.defineComponent({__name:"DeepThinkingSteps",props:{steps:{},expanded:{type:Boolean}},emits:["update:expanded"],setup(o,{emit:l}){const s=o,a=l,n={imageDownload:!1,tableDownload:!1},c=T.createStyleScope(),f={...n,styleScope:c.selector},E=new Map,w=u=>{let _=E.get(u);return _===void 0&&(E.size>500&&E.clear(),_=T.renderMarkdown(u,f),E.set(u,_)),_},v=e.computed(()=>s.steps.map(w));return(u,_)=>v.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:"deep-thinking","data-wi-md-scope":e.unref(c).id},[e.createElementVNode("button",{type:"button",class:"deep-thinking__header","aria-expanded":u.expanded,onClick:_[0]||(_[0]=y=>a("update:expanded",!u.expanded))},[ge,e.createElementVNode("span",be,e.toDisplayString(v.value.length),1),e.createElementVNode("span",null,e.toDisplayString(u.expanded?"收起":"展开"),1)],8,Ee),e.withDirectives(e.createElementVNode("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(y,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"deep-thinking__item"},[e.createElementVNode("span",Be,e.toDisplayString(V+1),1),e.createElementVNode("div",{class:"markdown-it",innerHTML:y},null,8,Se)]))),128))],512),[[e.vShow,u.expanded]])],8,he)):e.createCommentVNode("",!0)}}),Ce=D(Ne,[["__scopeId","data-v-de333356"]]),Ie=["data-wi-md-scope"],$e=["innerHTML"],xe=e.defineComponent({__name:"KnowledgeStreamResult",props:{report:{}},setup(o){const l=o,s={imageDownload:!1,tableDownload:!0},a=T.createStyleScope(),n={...s,styleScope:a.selector},c=v=>{var V;const _=v.target.closest(".wi-md-table-download");if(!_)return;v.preventDefault(),v.stopPropagation();const y=(V=_.closest(".wi-md-table-wrap"))==null?void 0:V.querySelector("table");y&&T.downloadTableAsExcel(y)},f=new Map,E=v=>{let u=f.get(v);return u===void 0&&(f.size>300&&f.clear(),u=T.renderMarkdown(v,n),f.set(v,u)),u},w=e.computed(()=>(l.report.values||[]).map(v=>E(v.answer||"")));return(v,u)=>(e.openBlock(),e.createElementBlock("div",{class:"knowledge-result","data-wi-md-scope":e.unref(a).id,onClick:c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(_,y)=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"markdown-it",innerHTML:_},null,8,$e))),128))],8,Ie))}}),G=D(xe,[["__scopeId","data-v-857bc0d2"]]),De=Object.freeze(Object.defineProperty({__proto__:null,default:G},Symbol.toStringTag,{value:"Module"})),W=Symbol("wi-chat-output-file-config"),Oe=o=>{e.provide(W,o)},Te=new Set(["png","jpg","jpeg","gif","webp","bmp","svg","ico"]),Le=new Set(["mp3","wav","ogg","m4a","aac","flac"]),Me=new Set(["mp4","webm","mov","avi","mkv"]),Pe=new Set(["doc","docx","xls","xlsx","ppt","pptx"]),Fe=new Set(["html","htm"]),Ue=new Set(["js","mjs","cjs","ts","tsx","jsx","vue","py","java","c","h","cpp","hpp","cs","go","rs","php","rb","sh","bash","bat","ps1","css","scss","less"]),je=new Set(["txt","text","md","markdown","json","csv","log","xml","yaml","yml","ini","conf","env","toml","sql"]),Re=20,x=new Map,R=new Map,Ae=(o,l)=>{if(!x.has(o)&&x.size>=Re){const s=x.keys().next().value;s!==void 0&&x.delete(s)}x.set(o,l)},ze=o=>{const l=o.lastIndexOf(".");return l>=0?o.slice(l+1).toLowerCase():""},qe=o=>Te.has(o)?"image":o==="pdf"?"pdf":Fe.has(o)?"html":Le.has(o)?"audio":Me.has(o)?"video":Pe.has(o)?"office":Ue.has(o)?"code":je.has(o)?"text":"unknown",Ke=o=>{const l=e.getCurrentInstance()?e.inject(W,{}):{},s=e.computed(()=>{var g;const i=e.toValue(o);return((g=i==null?void 0:i.values)==null?void 0:g.file_id)??(i==null?void 0:i.file_id)??""}),a=e.computed(()=>{var g;const i=e.toValue(o);return((g=i==null?void 0:i.values)==null?void 0:g.file_name)??(i==null?void 0:i.file_name)??"未命名文件"}),n=e.computed(()=>ze(a.value)),c=e.computed(()=>qe(n.value)),f=e.ref(!1),E=e.ref(!1),w=e.ref(""),v=e.ref(!1),u=e.ref(""),_=e.ref(""),y=e.ref(null),V=e.computed(()=>y.value?N.formatFileSize(y.value.size):""),B=()=>{_.value&&typeof URL<"u"&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(_.value),_.value=""},I=async()=>{const i=s.value,g=a.value;if(!i)throw new Error("缺少文件 id,无法加载文件");const b=i||g,P=x.get(b);if(P)return P;let $=R.get(b);return $||($=(async()=>{var F,U;if(l.loadFile)return l.loadFile(i);const C=(F=l.getFileUrl)==null?void 0:F.call(l,i);if(!C)throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");const p=await fetch(C,{headers:(U=l.getHeaders)==null?void 0:U.call(l)});if(!p.ok)throw new Error(`文件加载失败(HTTP ${p.status})`);return p.blob()})().then(C=>(Ae(b,C),C)).finally(()=>R.delete(b)),R.set(b,$)),$},k=async()=>{E.value=!0,w.value="",v.value=!1,u.value="",B();try{const i=await I();y.value=i;const g=c.value;if(g==="office"){v.value=!0;return}if(g==="image"||g==="pdf"||g==="audio"||g==="video"){typeof URL<"u"&&typeof URL.createObjectURL=="function"&&(_.value=URL.createObjectURL(i));return}const b=await i.text();if(b.includes("\0")){v.value=!0;return}u.value=b}catch(i){w.value=i instanceof Error?i.message:String(i)}finally{E.value=!1}},h=async()=>{if(l.openPreview){l.openPreview({fileId:s.value,fileName:a.value,loadFile:I,download:M});return}f.value=!0,await k()},L=()=>{f.value=!1,E.value=!1,w.value="",v.value=!1,u.value="",B()},M=async()=>{try{const i=y.value??await I();if(y.value=i,l.downloadFile){l.downloadFile({fileId:s.value,fileName:a.value,blob:i});return}if(typeof document>"u"||typeof URL>"u")return;const g=URL.createObjectURL(i),b=document.createElement("a");b.href=g,b.download=a.value,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(g)}catch(i){w.value=i instanceof Error?i.message:String(i),!f.value&&!l.openPreview&&(f.value=!0)}},O=i=>{i.key==="Escape"&&f.value&&L()};return e.watch(f,i=>{typeof window>"u"||(i?window.addEventListener("keydown",O):window.removeEventListener("keydown",O))}),e.onBeforeUnmount(()=>{typeof window<"u"&&window.removeEventListener("keydown",O),B()}),{fileId:s,fileName:a,extension:n,previewKind:c,fileSize:V,visible:f,loading:E,error:w,unsupported:v,textContent:u,objectUrl:_,open:h,close:L,download:M}},z=o=>(e.pushScopeId("data-v-f61a91b5"),o=o(),e.popScopeId(),o),He={class:"wi-output-file"},Xe=["aria-label"],Ge=z(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M7 2.5h7l4 4V21.5H7z"}),e.createElementVNode("path",{d:"M14 2.5v4h4"})],-1)),We=[Ge],Ye={class:"wi-output-file__info"},Je=["title"],Ze={class:"wi-output-file__meta"},Qe={class:"wi-output-file__ext"},et={key:0,class:"wi-output-file__size"},tt=z(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M12 3v12"}),e.createElementVNode("path",{d:"m7 10 5 5 5-5"}),e.createElementVNode("path",{d:"M5 21h14"})],-1)),nt=[tt],ot=["aria-label"],rt={class:"wi-output-file-drawer__head"},lt={class:"wi-output-file-drawer__title"},at={class:"wi-output-file-drawer__ext"},st=["title"],it={key:0,class:"wi-output-file-drawer__size"},ct={class:"wi-output-file-drawer__actions"},ut={class:"wi-output-file-drawer__body"},dt={key:0,class:"wi-output-file-drawer__state"},pt={key:1,class:"wi-output-file-drawer__state is-error"},ft={key:2,class:"wi-output-file-drawer__state"},_t=z(()=>e.createElementVNode("p",null,"该文件类型暂不支持在线预览,请下载后查看。",-1)),mt=["src","alt"],vt=["src","title"],wt=["srcdoc","title"],yt=["src"],kt=["src"],ht={key:8,class:"wi-output-file-drawer__text"},Et=e.defineComponent({__name:"OutputFile",props:{report:{}},setup(o){const l=o,{fileName:s,extension:a,previewKind:n,fileSize:c,visible:f,loading:E,error:w,unsupported:v,textContent:u,objectUrl:_,open:y,close:V,download:B}=Ke(()=>l.report);return(I,k)=>(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",{class:"wi-output-file__card",role:"button",tabindex:"0","aria-label":`预览文件 ${e.unref(s)}`,onClick:k[1]||(k[1]=(...h)=>e.unref(y)&&e.unref(y)(...h)),onKeydown:[k[2]||(k[2]=e.withKeys((...h)=>e.unref(y)&&e.unref(y)(...h),["enter"])),k[3]||(k[3]=e.withKeys(e.withModifiers((...h)=>e.unref(y)&&e.unref(y)(...h),["prevent"]),["space"]))]},[e.createElementVNode("span",{class:e.normalizeClass(["wi-output-file__icon",`is-${e.unref(n)}`])},We,2),e.createElementVNode("div",Ye,[e.createElementVNode("div",{class:"wi-output-file__name",title:e.unref(s)},e.toDisplayString(e.unref(s)),9,Je),e.createElementVNode("div",Ze,[e.createElementVNode("span",Qe,e.toDisplayString(e.unref(a).toUpperCase()||"FILE"),1),e.unref(c)?(e.openBlock(),e.createElementBlock("span",et,e.toDisplayString(e.unref(c)),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("button",{type:"button",class:"wi-output-file__download",title:"下载文件","aria-label":"下载文件",onClick:k[0]||(k[0]=e.withModifiers((...h)=>e.unref(B)&&e.unref(B)(...h),["stop"]))},nt)],40,Xe),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"wi-output-file-fade"},{default:e.withCtx(()=>[e.unref(f)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wi-output-file-mask",onClick:k[8]||(k[8]=e.withModifiers((...h)=>e.unref(V)&&e.unref(V)(...h),["self"]))},[e.createElementVNode("aside",{class:"wi-output-file-drawer",role:"dialog","aria-modal":"true","aria-label":`预览文件 ${e.unref(s)}`},[e.createElementVNode("header",rt,[e.createElementVNode("div",lt,[e.createElementVNode("span",at,e.toDisplayString(e.unref(a).toUpperCase()||"FILE"),1),e.createElementVNode("div",{class:"wi-output-file-drawer__name",title:e.unref(s)},e.toDisplayString(e.unref(s)),9,st),e.unref(c)?(e.openBlock(),e.createElementBlock("div",it,e.toDisplayString(e.unref(c)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ct,[e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[4]||(k[4]=(...h)=>e.unref(B)&&e.unref(B)(...h))},"下载"),e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn wi-output-file-drawer__btn--close",title:"关闭","aria-label":"关闭预览",onClick:k[5]||(k[5]=(...h)=>e.unref(V)&&e.unref(V)(...h))}," × ")])]),e.createElementVNode("div",ut,[e.unref(E)?(e.openBlock(),e.createElementBlock("div",dt,"文件加载中…")):e.unref(w)?(e.openBlock(),e.createElementBlock("div",pt,[e.createElementVNode("p",null,e.toDisplayString(e.unref(w)),1),e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[6]||(k[6]=(...h)=>e.unref(B)&&e.unref(B)(...h))},"下载文件")])):e.unref(v)?(e.openBlock(),e.createElementBlock("div",ft,[_t,e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[7]||(k[7]=(...h)=>e.unref(B)&&e.unref(B)(...h))},"下载文件")])):e.unref(n)==="image"&&e.unref(_)?(e.openBlock(),e.createElementBlock("img",{key:3,class:"wi-output-file-drawer__image",src:e.unref(_),alt:e.unref(s)},null,8,mt)):e.unref(n)==="pdf"&&e.unref(_)?(e.openBlock(),e.createElementBlock("iframe",{key:4,class:"wi-output-file-drawer__frame",src:e.unref(_),title:e.unref(s)},null,8,vt)):e.unref(n)==="html"?(e.openBlock(),e.createElementBlock("iframe",{key:5,class:"wi-output-file-drawer__frame",srcdoc:e.unref(u),sandbox:"allow-scripts allow-forms allow-modals",title:e.unref(s)},null,8,wt)):e.unref(n)==="audio"&&e.unref(_)?(e.openBlock(),e.createElementBlock("audio",{key:6,class:"wi-output-file-drawer__media",src:e.unref(_),controls:""},null,8,yt)):e.unref(n)==="video"&&e.unref(_)?(e.openBlock(),e.createElementBlock("video",{key:7,class:"wi-output-file-drawer__media",src:e.unref(_),controls:""},null,8,kt)):(e.openBlock(),e.createElementBlock("pre",ht,e.toDisplayString(e.unref(u)),1))])],8,ot)])):e.createCommentVNode("",!0)]),_:1})]))]))}}),Y=D(Et,[["__scopeId","data-v-f61a91b5"]]),gt=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"})),bt=()=>{var l,s;const o=(s=(l=window==null?void 0:window.globalConfig)==null?void 0:l.WebApiUrl)==null?void 0:s.MainUrl;return typeof o=="string"?o:""},Vt=()=>window.location.origin+window.location.pathname,A="access-session",Bt=()=>{const o=window.location.pathname.split("/").filter(l=>!!l).join("-");return o?`${o}-`:""},St=()=>{const o=`${Bt()}${A}`,l=[];for(let a=0;a<localStorage.length;a++){const n=localStorage.key(a);!n||!n.endsWith(A)||n.slice(0,n.lastIndexOf(":"))!=="wi admin"&&(n.endsWith(`x-${A}`)||l.push(n))}const s=l.find(a=>a.endsWith(o))??l[0];if(!s)return"";try{const a=localStorage.getItem(s);if(!a||a==="undefined")return"";const n=JSON.parse(a);return n==null?"":String(n)}catch{return""}},J=Symbol("wi-chat-iframe-page-config"),Nt=o=>{e.provide(J,o)},Z=(o,l)=>{const s=(l==null?void 0:l.mainUrl)!==void 0?String(e.toValue(l.mainUrl)):bt(),a=(l==null?void 0:l.token)!==void 0?String(e.toValue(l.token)):St();return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g,s).replace(/\{\{\s*SERVE_URL\s*\}\}/g,Vt()).replace(/\{\{\s*token\s*\}\}/g,a)},Q=o=>{const l=e.getCurrentInstance()?e.inject(J,{}):{},s=e.computed(()=>{var f;const n=e.toValue(o),c=((f=n==null?void 0:n.values)==null?void 0:f.url)??(n==null?void 0:n.url)??"";return c?l.resolveUrl?l.resolveUrl(c):Z(c,l):""}),a=e.computed(()=>{var c;const n=e.toValue(o);return((c=n==null?void 0:n.values)==null?void 0:c.srcdoc)??(n==null?void 0:n.srcdoc)??""});return{url:s,srcdoc:a}},H="data-wi-iframe-resizer-child",ee=o=>{if(!o)return!1;let l=null;try{l=o.contentDocument}catch{return!1}if(!l)return!1;const s=l.head||l.documentElement;if(!s)return!1;const a=l.defaultView;if(a!=null&&a.parentIframe||a!=null&&a.parentIFrame||l.querySelector(`script[${H}]`))return!1;const n=l.createElement("script");return n.textContent=N.IFRAME_RESIZER_CHILD_SCRIPT,n.setAttribute(H,""),s.appendChild(n),!0},Ct=e.defineComponent({__name:"IframePage",props:{report:{}},setup(o){const l=o,{url:s,srcdoc:a}=Q(()=>l.report),n=c=>{ee(c.target)};return(c,f)=>e.unref(s)?(e.openBlock(),e.createBlock(K,{key:0,class:"iframe-page__frame iframe-page__frame--url",license:"GPLv3",src:e.unref(s),width:"100%","warning-timeout":0,onLoad:n},null,8,["src"])):e.unref(a)?(e.openBlock(),e.createBlock(K,{key:1,class:"iframe-page iframe-page--srcdoc",license:"GPLv3",srcdoc:e.unref(a),width:"100%",frameborder:"no",border:"0",marginwidth:"0",marginheight:"0",scrolling:"no"},null,8,["srcdoc"])):e.createCommentVNode("",!0)}}),te=D(Ct,[["__scopeId","data-v-f4c94a4e"]]),It=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),q=o=>(e.pushScopeId("data-v-74053305"),o=o(),e.popScopeId(),o),$t={class:"wi-clarify__header"},xt={class:"wi-clarify__heading"},Dt=q(()=>e.createElementVNode("div",{class:"wi-clarify__eyebrow"},"需要补充信息",-1)),Ot={class:"wi-clarify__title"},Tt={key:0,class:"wi-clarify__desc"},Lt={class:"wi-clarify__status"},Mt={class:"wi-clarify__progress"},Pt={class:"wi-clarify__progress-track"},Ft={key:0,class:"wi-clarify__panel"},Ut={class:"wi-clarify__question"},jt={key:0,class:"wi-clarify__question-desc"},Rt={key:1,class:"wi-clarify__binding"},At={key:2,class:"wi-clarify__options"},zt=["onClick"],qt={class:"wi-clarify__option-indicator"},Kt={key:3,class:"wi-clarify__date"},Ht=["for"],Xt=["id","value"],Gt={class:"wi-clarify__text"},Wt={key:0,class:"wi-clarify__or"},Yt=q(()=>e.createElementVNode("span",null,"或者,用自己的话说明",-1)),Jt=[Yt],Zt=["for"],Qt=["id","value","placeholder"],en={class:"wi-clarify__dots","aria-label":"确认问题导航"},tn=["aria-label","onClick"],nn={class:"wi-clarify__footer"},on=q(()=>e.createElementVNode("span",{class:"wi-clarify__confirm-text"},"取消后本次操作将停止等待这些回答",-1)),rn={class:"wi-clarify__actions"},ln={class:"wi-clarify__actions"},an=["disabled"],sn={key:1,class:"wi-clarify__result"},cn={class:"wi-clarify__result-icon"},un={class:"wi-clarify__result-body"},dn={key:0,class:"wi-clarify__summary"},pn={key:1},fn={key:2},_n={key:2,class:"wi-clarify__feedback"},mn=e.defineComponent({__name:"ClarificationCard",props:{report:{}},setup(o){const l=o,s={requestId:"",title:"需要补充信息",description:"",items:[],status:"expired",resultMessage:"本次补充信息已失效(回答已结束)"},a=e.computed(()=>l.report.values??s),n=e.computed(()=>a.value.items??[]),c=e.ref(0),f=e.reactive({}),E=e.ref(!1),w=e.ref(""),v=()=>{Object.keys(f).forEach(t=>delete f[t]),n.value.forEach(t=>{const r={structuredValue:void 0,structuredValues:[],textValue:""};t.default!==void 0&&(t.input.type==="multi_select"?r.structuredValues=Array.isArray(t.default)?[...t.default]:[]:t.input.type==="text"?r.textValue=String(t.default):r.structuredValue=t.default),f[t.id]=r}),c.value=0};e.watch(()=>{var t;return(t=a.value)==null?void 0:t.requestId},v,{immediate:!0});const u=t=>(f[t]||(f[t]={structuredValue:void 0,structuredValues:[],textValue:""}),f[t]),_=e.computed(()=>{var t,r,d;return((t=a.value)==null?void 0:t.status)==="submitted"?"已提交":((r=a.value)==null?void 0:r.status)==="cancelled"?"已取消":((d=a.value)==null?void 0:d.status)==="expired"?"已失效":"等待回答"}),y=t=>{try{const r=JSON.stringify(t);return r===void 0?String(t):r}catch{return String(t)}},V=(t,r)=>y(t)===y(r),B=(t,r)=>{const d=u(t.id);return t.input.type==="multi_select"?d.structuredValues.some(m=>V(m,r)):V(d.structuredValue,r)},I=(t,r)=>{const d=u(t.id);if(d.textValue="",t.input.type==="multi_select"){const m=d.structuredValues.findIndex(S=>V(S,r));m>=0?d.structuredValues.splice(m,1):d.structuredValues.push(r);return}d.structuredValue=r},k=t=>{var r;return((r=t.target)==null?void 0:r.value)??""},h=(t,r)=>{const d=u(t.id);d.textValue=k(r),t.input.type!=="text"&&(d.structuredValue=void 0,d.structuredValues.splice(0))},L=(t,r)=>{const d=u(t.id);d.structuredValue=k(r),d.textValue=""},M=t=>{const r=u(t.id).structuredValue;return r==null?"":String(r)},O=t=>{var r;return((r=t.input.textInput)==null?void 0:r.placeholder)??t.input.placeholder??(t.input.type==="text"?"请输入需要补充的信息":"例如:使用阀门,或者说明你的具体要求")},i=t=>{const r=t.binding;if(!r)return"";const d=r.actionName?`动作:${r.actionName}`:"",m=r.parameterPath?`参数:${r.parameterPath}`:"";return[d,m].filter(Boolean).join(" · ")},g=t=>{const r=u(t.id);return t.input.type==="multi_select"?r.structuredValues.length>0:t.input.type==="single_select"?r.structuredValue!==void 0:t.input.type==="date"?!!r.structuredValue:!1},b=t=>!!u(t.id).textValue.trim()||g(t),P=t=>!t.required||b(t)?!0:(w.value=`请回答“${t.question}”`,!1),$=()=>{w.value="",c.value=Math.max(0,c.value-1)},C=()=>{!p.value||!P(p.value)||(w.value="",c.value=Math.min(n.value.length-1,c.value+1))},p=e.computed(()=>n.value[c.value]),F=(t,r)=>t.input.type==="date"?String(r??""):(Array.isArray(r)?r:[r]).map(m=>{var j;const S=(j=t.input.options)==null?void 0:j.find(ae=>V(ae.value,m));return(S==null?void 0:S.label)??String(m??"")}).filter(Boolean).join("、"),U=t=>{const r=u(t.id),d=r.textValue.trim();if(t.input.type==="text"||d||!g(t))return{id:t.id,mode:"text",value:d,displayText:d};const m=t.input.type==="multi_select"?[...r.structuredValues]:r.structuredValue;return{id:t.id,mode:"structured",value:m,displayText:F(t,m)}},oe=()=>{const t=n.value.findIndex(d=>d.required&&!b(d));if(t>=0){c.value=t,w.value=`请回答“${n.value[t].question}”`;return}w.value="";const r=n.value.map(U);N.submitClarification(a.value.requestId,r)||(w.value="本次补充信息已经处理")},re=()=>{E.value=!1,w.value="",N.cancelClarification(a.value.requestId)||(w.value="本次补充信息已经处理")},le=t=>{var r;return((r=n.value.find(d=>d.id===t))==null?void 0:r.question)??t};return(t,r)=>{var d;return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["wi-clarify",`is-${a.value.status}`])},[e.createElementVNode("header",$t,[e.createElementVNode("div",xt,[Dt,e.createElementVNode("h3",Ot,e.toDisplayString(a.value.title),1),a.value.description?(e.openBlock(),e.createElementBlock("p",Tt,e.toDisplayString(a.value.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("span",Lt,e.toDisplayString(_.value),1)]),a.value.status==="pending"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Mt,[e.createElementVNode("span",null,"问题 "+e.toDisplayString(c.value+1)+" / "+e.toDisplayString(n.value.length),1),e.createElementVNode("div",Pt,[e.createElementVNode("span",{style:e.normalizeStyle({width:`${(c.value+1)/n.value.length*100}%`})},null,4)])]),p.value?(e.openBlock(),e.createElementBlock("div",Ft,[e.createElementVNode("div",Ut,[e.createElementVNode("span",{class:e.normalizeClass(p.value.required?"wi-clarify__required":"wi-clarify__optional")},e.toDisplayString(p.value.required?"必填":"选填"),3),e.createElementVNode("h4",null,e.toDisplayString(p.value.question),1)]),p.value.description?(e.openBlock(),e.createElementBlock("p",jt,e.toDisplayString(p.value.description),1)):e.createCommentVNode("",!0),i(p.value)?(e.openBlock(),e.createElementBlock("div",Rt,e.toDisplayString(i(p.value)),1)):e.createCommentVNode("",!0),p.value.input.type==="single_select"||p.value.input.type==="multi_select"?(e.openBlock(),e.createElementBlock("div",At,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value.input.options,(m,S)=>(e.openBlock(),e.createElementBlock("button",{key:S,type:"button",class:e.normalizeClass(["wi-clarify__option",{"is-selected":B(p.value,m.value)}]),onClick:j=>I(p.value,m.value)},[e.createElementVNode("span",qt,e.toDisplayString(B(p.value,m.value)?"✓":""),1),e.createElementVNode("span",null,e.toDisplayString(m.label),1)],10,zt))),128))])):p.value.input.type==="date"?(e.openBlock(),e.createElementBlock("div",Kt,[e.createElementVNode("label",{for:`wi-clarify-date-${p.value.id}`},"选择日期",8,Ht),e.createElementVNode("input",{id:`wi-clarify-date-${p.value.id}`,type:"date",value:M(p.value),onInput:r[0]||(r[0]=m=>L(p.value,m))},null,40,Xt)])):e.createCommentVNode("",!0),e.createElementVNode("div",Gt,[p.value.input.type!=="text"?(e.openBlock(),e.createElementBlock("div",Wt,Jt)):e.createCommentVNode("",!0),e.createElementVNode("label",{for:`wi-clarify-text-${p.value.id}`},e.toDisplayString(p.value.input.type==="text"?"你的回答":"自然语言回答"),9,Zt),e.createElementVNode("textarea",{id:`wi-clarify-text-${p.value.id}`,value:u(p.value.id).textValue,placeholder:O(p.value),rows:"3",onInput:r[1]||(r[1]=m=>h(p.value,m))},null,40,Qt)])])):e.createCommentVNode("",!0),e.createElementVNode("div",en,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(m,S)=>(e.openBlock(),e.createElementBlock("button",{key:m.id,type:"button","aria-label":`查看第 ${S+1} 个问题`,class:e.normalizeClass({"is-active":S===c.value,"is-answered":b(m)}),onClick:j=>c.value=S},null,10,tn))),128))]),e.createElementVNode("footer",nn,[E.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[on,e.createElementVNode("div",rn,[e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--secondary",onClick:r[2]||(r[2]=m=>E.value=!1)}," 继续填写 "),e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--danger",onClick:re},"确认取消")])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{type:"button",class:"wi-clarify__cancel",onClick:r[3]||(r[3]=m=>E.value=!0)},"取消"),e.createElementVNode("div",ln,[e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--secondary",disabled:c.value===0,onClick:$}," 上一项 ",8,an),c.value<n.value.length-1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-clarify__btn wi-clarify__btn--primary",onClick:C}," 下一项 ")):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"wi-clarify__btn wi-clarify__btn--primary",onClick:oe},"提交全部"))])],64))])],64)):(e.openBlock(),e.createElementBlock("div",sn,[e.createElementVNode("div",cn,e.toDisplayString(a.value.status==="submitted"?"✓":a.value.status==="cancelled"?"—":"!"),1),e.createElementVNode("div",un,[e.createElementVNode("h4",null,e.toDisplayString(a.value.resultMessage||_.value),1),a.value.status==="submitted"&&((d=a.value.answers)!=null&&d.length)?(e.openBlock(),e.createElementBlock("div",dn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.answers,m=>(e.openBlock(),e.createElementBlock("div",{key:m.id},[e.createElementVNode("span",null,e.toDisplayString(le(m.id)),1),e.createElementVNode("strong",null,e.toDisplayString(m.displayText||"未填写"),1)]))),128))])):a.value.status==="cancelled"?(e.openBlock(),e.createElementBlock("p",pn,"本次确认未提交,工作流将收到取消结果。")):(e.openBlock(),e.createElementBlock("p",fn,"该确认项已失效,无法再提交。"))])])),w.value?(e.openBlock(),e.createElementBlock("div",_n,e.toDisplayString(w.value),1)):e.createCommentVNode("",!0)],2)}}}),ne=D(mn,[["__scopeId","data-v-74053305"]]),vn=Object.freeze(Object.defineProperty({__proto__:null,default:ne},Symbol.toStringTag,{value:"Module"}));exports.AiAnswerBubble=ye;exports.ClarificationCard=ne;exports.DeepThinkingSteps=Ce;exports.IframePage=te;exports.KnowledgeStreamResult=G;exports.OutputFile=Y;exports.createAnswerContentMap=X;exports.injectIframeResizerChild=ee;exports.provideIframePageConfig=Nt;exports.provideOutputFileConfig=Oe;exports.resolveIframePlaceholders=Z;exports.useIframePage=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("wi-chat/style.css");const e=require("vue"),N=require("wi-chat/parser"),T=require("wi-chat/tools"),K=require("@iframe-resizer/vue/iframe-resizer.vue"),ie=[{...N.knowledgeStreamParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>Te))},{...N.iframePageParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>xt))},{...N.outputFileParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>Vt))},{...N.collectClarificationsParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>yn))},{...N.agentActionParser,component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>$n))}],X=o=>{const a=s=>{const t={};for(const r of s)!r.answerType||!r.component||(t[r.answerType]=r.component);return t};return{...a(ie),...a(o??[])}},ue=o=>(e.pushScopeId("data-v-efad55c8"),o=o(),e.popScopeId(),o),de={class:"flex justify-start"},pe={class:"ai-answer-bubble"},_e={key:0,class:"ai-answer-bubble__error"},fe={class:"ai-answer-bubble__body"},me={key:0,class:"ai-answer-bubble__status"},ve={key:2,class:"ai-answer-bubble__status"},we={key:3,class:"ai-answer-bubble__loading"},ye=ue(()=>e.createElementVNode("span",{class:"ai-answer-bubble__pulse"},null,-1)),ke=e.defineComponent({__name:"AiAnswerBubble",props:{answer:{},error:{type:Boolean,default:!1},stopped:{type:Boolean,default:!1},contentMap:{default:()=>X()}},setup(o){const a=o,s=e.computed(()=>{var r,c;return((c=(r=a.answer)==null?void 0:r.answer)==null?void 0:c.reports)??[]}),t=e.computed(()=>s.value.filter(r=>a.contentMap[r.answer_type]));return(r,c)=>(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",pe,[r.error?(e.openBlock(),e.createElementBlock("div",_e,"回答加载失败")):t.value.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(p,h)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.contentMap[p.answer_type]),{key:h,report:p},null,8,["report"]))),128))]),r.stopped?(e.openBlock(),e.createElementBlock("div",me,"回答已停止")):e.createCommentVNode("",!0)],64)):r.stopped?(e.openBlock(),e.createElementBlock("div",ve,"回答已停止")):s.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",we,[ye,e.createTextVNode("正在思考...")]))])]))}}),$=(o,a)=>{const s=o.__vccOpts||o;for(const[t,r]of a)s[t]=r;return s},he=$(ke,[["__scopeId","data-v-efad55c8"]]),ge=o=>(e.pushScopeId("data-v-de333356"),o=o(),e.popScopeId(),o),Ee=["data-wi-md-scope"],be=["aria-expanded"],Ve=ge(()=>e.createElementVNode("span",{class:"deep-thinking__title"},"深度思考",-1)),Se={class:"deep-thinking__count"},Be={class:"deep-thinking__list"},Ne={class:"deep-thinking__index"},Ce=["innerHTML"],$e=e.defineComponent({__name:"DeepThinkingSteps",props:{steps:{},expanded:{type:Boolean}},emits:["update:expanded"],setup(o,{emit:a}){const s=o,t=a,r={imageDownload:!1,tableDownload:!1},c=T.createStyleScope(),p={...r,styleScope:c.selector},h=new Map,v=u=>{let f=h.get(u);return f===void 0&&(h.size>500&&h.clear(),f=T.renderMarkdown(u,p),h.set(u,f)),f},w=e.computed(()=>s.steps.map(v));return(u,f)=>w.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:"deep-thinking","data-wi-md-scope":e.unref(c).id},[e.createElementVNode("button",{type:"button",class:"deep-thinking__header","aria-expanded":u.expanded,onClick:f[0]||(f[0]=y=>t("update:expanded",!u.expanded))},[Ve,e.createElementVNode("span",Se,e.toDisplayString(w.value.length),1),e.createElementVNode("span",null,e.toDisplayString(u.expanded?"收起":"展开"),1)],8,be),e.withDirectives(e.createElementVNode("div",Be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(y,V)=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"deep-thinking__item"},[e.createElementVNode("span",Ne,e.toDisplayString(V+1),1),e.createElementVNode("div",{class:"markdown-it",innerHTML:y},null,8,Ce)]))),128))],512),[[e.vShow,u.expanded]])],8,Ee)):e.createCommentVNode("",!0)}}),Ie=$($e,[["__scopeId","data-v-de333356"]]),xe=["data-wi-md-scope"],De=["innerHTML"],Oe=e.defineComponent({__name:"KnowledgeStreamResult",props:{report:{}},setup(o){const a=o,s={imageDownload:!1,tableDownload:!0},t=T.createStyleScope(),r={...s,styleScope:t.selector},c=w=>{var V;const f=w.target.closest(".wi-md-table-download");if(!f)return;w.preventDefault(),w.stopPropagation();const y=(V=f.closest(".wi-md-table-wrap"))==null?void 0:V.querySelector("table");y&&T.downloadTableAsExcel(y)},p=new Map,h=w=>{let u=p.get(w);return u===void 0&&(p.size>300&&p.clear(),u=T.renderMarkdown(w,r),p.set(w,u)),u},v=e.computed(()=>(a.report.values||[]).map(w=>h(w.answer||"")));return(w,u)=>(e.openBlock(),e.createElementBlock("div",{class:"knowledge-result","data-wi-md-scope":e.unref(t).id,onClick:c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(f,y)=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"markdown-it",innerHTML:f},null,8,De))),128))],8,xe))}}),G=$(Oe,[["__scopeId","data-v-857bc0d2"]]),Te=Object.freeze(Object.defineProperty({__proto__:null,default:G},Symbol.toStringTag,{value:"Module"})),W=Symbol("wi-chat-output-file-config"),Pe=o=>{e.provide(W,o)},Me=new Set(["png","jpg","jpeg","gif","webp","bmp","svg","ico"]),Ae=new Set(["mp3","wav","ogg","m4a","aac","flac"]),Le=new Set(["mp4","webm","mov","avi","mkv"]),Ue=new Set(["doc","docx","xls","xlsx","ppt","pptx"]),je=new Set(["html","htm"]),Fe=new Set(["js","mjs","cjs","ts","tsx","jsx","vue","py","java","c","h","cpp","hpp","cs","go","rs","php","rb","sh","bash","bat","ps1","css","scss","less"]),Re=new Set(["txt","text","md","markdown","json","csv","log","xml","yaml","yml","ini","conf","env","toml","sql"]),ze=20,D=new Map,F=new Map,qe=(o,a)=>{if(!D.has(o)&&D.size>=ze){const s=D.keys().next().value;s!==void 0&&D.delete(s)}D.set(o,a)},Ke=o=>{const a=o.lastIndexOf(".");return a>=0?o.slice(a+1).toLowerCase():""},He=o=>Me.has(o)?"image":o==="pdf"?"pdf":je.has(o)?"html":Ae.has(o)?"audio":Le.has(o)?"video":Ue.has(o)?"office":Fe.has(o)?"code":Re.has(o)?"text":"unknown",Xe=o=>{const a=e.getCurrentInstance()?e.inject(W,{}):{},s=e.computed(()=>{var E;const i=e.toValue(o);return((E=i==null?void 0:i.values)==null?void 0:E.file_id)??(i==null?void 0:i.file_id)??""}),t=e.computed(()=>{var E;const i=e.toValue(o);return((E=i==null?void 0:i.values)==null?void 0:E.file_name)??(i==null?void 0:i.file_name)??"未命名文件"}),r=e.computed(()=>Ke(t.value)),c=e.computed(()=>He(r.value)),p=e.ref(!1),h=e.ref(!1),v=e.ref(""),w=e.ref(!1),u=e.ref(""),f=e.ref(""),y=e.ref(null),V=e.computed(()=>y.value?N.formatFileSize(y.value.size):""),S=()=>{f.value&&typeof URL<"u"&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(f.value),f.value=""},I=async()=>{const i=s.value,E=t.value;if(!i)throw new Error("缺少文件 id,无法加载文件");const b=i||E,A=D.get(b);if(A)return A;let x=F.get(b);return x||(x=(async()=>{var L,U;if(a.loadFile)return a.loadFile(i);const C=(L=a.getFileUrl)==null?void 0:L.call(a,i);if(!C)throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");const _=await fetch(C,{headers:(U=a.getHeaders)==null?void 0:U.call(a)});if(!_.ok)throw new Error(`文件加载失败(HTTP ${_.status})`);return _.blob()})().then(C=>(qe(b,C),C)).finally(()=>F.delete(b)),F.set(b,x)),x},k=async()=>{h.value=!0,v.value="",w.value=!1,u.value="",S();try{const i=await I();y.value=i;const E=c.value;if(E==="office"){w.value=!0;return}if(E==="image"||E==="pdf"||E==="audio"||E==="video"){typeof URL<"u"&&typeof URL.createObjectURL=="function"&&(f.value=URL.createObjectURL(i));return}const b=await i.text();if(b.includes("\0")){w.value=!0;return}u.value=b}catch(i){v.value=i instanceof Error?i.message:String(i)}finally{h.value=!1}},g=async()=>{if(a.openPreview){a.openPreview({fileId:s.value,fileName:t.value,loadFile:I,download:M});return}p.value=!0,await k()},P=()=>{p.value=!1,h.value=!1,v.value="",w.value=!1,u.value="",S()},M=async()=>{try{const i=y.value??await I();if(y.value=i,a.downloadFile){a.downloadFile({fileId:s.value,fileName:t.value,blob:i});return}if(typeof document>"u"||typeof URL>"u")return;const E=URL.createObjectURL(i),b=document.createElement("a");b.href=E,b.download=t.value,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(E)}catch(i){v.value=i instanceof Error?i.message:String(i),!p.value&&!a.openPreview&&(p.value=!0)}},O=i=>{i.key==="Escape"&&p.value&&P()};return e.watch(p,i=>{typeof window>"u"||(i?window.addEventListener("keydown",O):window.removeEventListener("keydown",O))}),e.onBeforeUnmount(()=>{typeof window<"u"&&window.removeEventListener("keydown",O),S()}),{fileId:s,fileName:t,extension:r,previewKind:c,fileSize:V,visible:p,loading:h,error:v,unsupported:w,textContent:u,objectUrl:f,open:g,close:P,download:M}},z=o=>(e.pushScopeId("data-v-f61a91b5"),o=o(),e.popScopeId(),o),Ge={class:"wi-output-file"},We=["aria-label"],Ye=z(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M7 2.5h7l4 4V21.5H7z"}),e.createElementVNode("path",{d:"M14 2.5v4h4"})],-1)),Je=[Ye],Ze={class:"wi-output-file__info"},Qe=["title"],et={class:"wi-output-file__meta"},tt={class:"wi-output-file__ext"},nt={key:0,class:"wi-output-file__size"},ot=z(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M12 3v12"}),e.createElementVNode("path",{d:"m7 10 5 5 5-5"}),e.createElementVNode("path",{d:"M5 21h14"})],-1)),rt=[ot],at=["aria-label"],lt={class:"wi-output-file-drawer__head"},st={class:"wi-output-file-drawer__title"},ct={class:"wi-output-file-drawer__ext"},it=["title"],ut={key:0,class:"wi-output-file-drawer__size"},dt={class:"wi-output-file-drawer__actions"},pt={class:"wi-output-file-drawer__body"},_t={key:0,class:"wi-output-file-drawer__state"},ft={key:1,class:"wi-output-file-drawer__state is-error"},mt={key:2,class:"wi-output-file-drawer__state"},vt=z(()=>e.createElementVNode("p",null,"该文件类型暂不支持在线预览,请下载后查看。",-1)),wt=["src","alt"],yt=["src","title"],kt=["srcdoc","title"],ht=["src"],gt=["src"],Et={key:8,class:"wi-output-file-drawer__text"},bt=e.defineComponent({__name:"OutputFile",props:{report:{}},setup(o){const a=o,{fileName:s,extension:t,previewKind:r,fileSize:c,visible:p,loading:h,error:v,unsupported:w,textContent:u,objectUrl:f,open:y,close:V,download:S}=Xe(()=>a.report);return(I,k)=>(e.openBlock(),e.createElementBlock("div",Ge,[e.createElementVNode("div",{class:"wi-output-file__card",role:"button",tabindex:"0","aria-label":`预览文件 ${e.unref(s)}`,onClick:k[1]||(k[1]=(...g)=>e.unref(y)&&e.unref(y)(...g)),onKeydown:[k[2]||(k[2]=e.withKeys((...g)=>e.unref(y)&&e.unref(y)(...g),["enter"])),k[3]||(k[3]=e.withKeys(e.withModifiers((...g)=>e.unref(y)&&e.unref(y)(...g),["prevent"]),["space"]))]},[e.createElementVNode("span",{class:e.normalizeClass(["wi-output-file__icon",`is-${e.unref(r)}`])},Je,2),e.createElementVNode("div",Ze,[e.createElementVNode("div",{class:"wi-output-file__name",title:e.unref(s)},e.toDisplayString(e.unref(s)),9,Qe),e.createElementVNode("div",et,[e.createElementVNode("span",tt,e.toDisplayString(e.unref(t).toUpperCase()||"FILE"),1),e.unref(c)?(e.openBlock(),e.createElementBlock("span",nt,e.toDisplayString(e.unref(c)),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("button",{type:"button",class:"wi-output-file__download",title:"下载文件","aria-label":"下载文件",onClick:k[0]||(k[0]=e.withModifiers((...g)=>e.unref(S)&&e.unref(S)(...g),["stop"]))},rt)],40,We),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"wi-output-file-fade"},{default:e.withCtx(()=>[e.unref(p)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"wi-output-file-mask",onClick:k[8]||(k[8]=e.withModifiers((...g)=>e.unref(V)&&e.unref(V)(...g),["self"]))},[e.createElementVNode("aside",{class:"wi-output-file-drawer",role:"dialog","aria-modal":"true","aria-label":`预览文件 ${e.unref(s)}`},[e.createElementVNode("header",lt,[e.createElementVNode("div",st,[e.createElementVNode("span",ct,e.toDisplayString(e.unref(t).toUpperCase()||"FILE"),1),e.createElementVNode("div",{class:"wi-output-file-drawer__name",title:e.unref(s)},e.toDisplayString(e.unref(s)),9,it),e.unref(c)?(e.openBlock(),e.createElementBlock("div",ut,e.toDisplayString(e.unref(c)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",dt,[e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[4]||(k[4]=(...g)=>e.unref(S)&&e.unref(S)(...g))},"下载"),e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn wi-output-file-drawer__btn--close",title:"关闭","aria-label":"关闭预览",onClick:k[5]||(k[5]=(...g)=>e.unref(V)&&e.unref(V)(...g))}," × ")])]),e.createElementVNode("div",pt,[e.unref(h)?(e.openBlock(),e.createElementBlock("div",_t,"文件加载中…")):e.unref(v)?(e.openBlock(),e.createElementBlock("div",ft,[e.createElementVNode("p",null,e.toDisplayString(e.unref(v)),1),e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[6]||(k[6]=(...g)=>e.unref(S)&&e.unref(S)(...g))},"下载文件")])):e.unref(w)?(e.openBlock(),e.createElementBlock("div",mt,[vt,e.createElementVNode("button",{type:"button",class:"wi-output-file-drawer__btn",onClick:k[7]||(k[7]=(...g)=>e.unref(S)&&e.unref(S)(...g))},"下载文件")])):e.unref(r)==="image"&&e.unref(f)?(e.openBlock(),e.createElementBlock("img",{key:3,class:"wi-output-file-drawer__image",src:e.unref(f),alt:e.unref(s)},null,8,wt)):e.unref(r)==="pdf"&&e.unref(f)?(e.openBlock(),e.createElementBlock("iframe",{key:4,class:"wi-output-file-drawer__frame",src:e.unref(f),title:e.unref(s)},null,8,yt)):e.unref(r)==="html"?(e.openBlock(),e.createElementBlock("iframe",{key:5,class:"wi-output-file-drawer__frame",srcdoc:e.unref(u),sandbox:"allow-scripts allow-forms allow-modals",title:e.unref(s)},null,8,kt)):e.unref(r)==="audio"&&e.unref(f)?(e.openBlock(),e.createElementBlock("audio",{key:6,class:"wi-output-file-drawer__media",src:e.unref(f),controls:""},null,8,ht)):e.unref(r)==="video"&&e.unref(f)?(e.openBlock(),e.createElementBlock("video",{key:7,class:"wi-output-file-drawer__media",src:e.unref(f),controls:""},null,8,gt)):(e.openBlock(),e.createElementBlock("pre",Et,e.toDisplayString(e.unref(u)),1))])],8,at)])):e.createCommentVNode("",!0)]),_:1})]))]))}}),Y=$(bt,[["__scopeId","data-v-f61a91b5"]]),Vt=Object.freeze(Object.defineProperty({__proto__:null,default:Y},Symbol.toStringTag,{value:"Module"})),St=()=>{var a,s;const o=(s=(a=window==null?void 0:window.globalConfig)==null?void 0:a.WebApiUrl)==null?void 0:s.MainUrl;return typeof o=="string"?o:""},Bt=()=>window.location.origin+window.location.pathname,R="access-session",Nt=()=>{const o=window.location.pathname.split("/").filter(a=>!!a).join("-");return o?`${o}-`:""},Ct=()=>{const o=`${Nt()}${R}`,a=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);!r||!r.endsWith(R)||r.slice(0,r.lastIndexOf(":"))!=="wi admin"&&(r.endsWith(`x-${R}`)||a.push(r))}const s=a.find(t=>t.endsWith(o))??a[0];if(!s)return"";try{const t=localStorage.getItem(s);if(!t||t==="undefined")return"";const r=JSON.parse(t);return r==null?"":String(r)}catch{return""}},J=Symbol("wi-chat-iframe-page-config"),$t=o=>{e.provide(J,o)},Z=(o,a)=>{const s=(a==null?void 0:a.mainUrl)!==void 0?String(e.toValue(a.mainUrl)):St(),t=(a==null?void 0:a.token)!==void 0?String(e.toValue(a.token)):Ct();return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g,s).replace(/\{\{\s*SERVE_URL\s*\}\}/g,Bt()).replace(/\{\{\s*token\s*\}\}/g,t)},Q=o=>{const a=e.getCurrentInstance()?e.inject(J,{}):{},s=e.computed(()=>{var p;const r=e.toValue(o),c=((p=r==null?void 0:r.values)==null?void 0:p.url)??(r==null?void 0:r.url)??"";return c?a.resolveUrl?a.resolveUrl(c):Z(c,a):""}),t=e.computed(()=>{var c;const r=e.toValue(o);return((c=r==null?void 0:r.values)==null?void 0:c.srcdoc)??(r==null?void 0:r.srcdoc)??""});return{url:s,srcdoc:t}},H="data-wi-iframe-resizer-child",ee=o=>{if(!o)return!1;let a=null;try{a=o.contentDocument}catch{return!1}if(!a)return!1;const s=a.head||a.documentElement;if(!s)return!1;const t=a.defaultView;if(t!=null&&t.parentIframe||t!=null&&t.parentIFrame||a.querySelector(`script[${H}]`))return!1;const r=a.createElement("script");return r.textContent=N.IFRAME_RESIZER_CHILD_SCRIPT,r.setAttribute(H,""),s.appendChild(r),!0},It=e.defineComponent({__name:"IframePage",props:{report:{}},setup(o){const a=o,{url:s,srcdoc:t}=Q(()=>a.report),r=c=>{ee(c.target)};return(c,p)=>e.unref(s)?(e.openBlock(),e.createBlock(K,{key:0,class:"iframe-page__frame iframe-page__frame--url",license:"GPLv3",src:e.unref(s),width:"100%","warning-timeout":0,onLoad:r},null,8,["src"])):e.unref(t)?(e.openBlock(),e.createBlock(K,{key:1,class:"iframe-page iframe-page--srcdoc",license:"GPLv3",srcdoc:e.unref(t),width:"100%",frameborder:"no",border:"0",marginwidth:"0",marginheight:"0",scrolling:"no"},null,8,["srcdoc"])):e.createCommentVNode("",!0)}}),te=$(It,[["__scopeId","data-v-f4c94a4e"]]),xt=Object.freeze(Object.defineProperty({__proto__:null,default:te},Symbol.toStringTag,{value:"Module"})),q=o=>(e.pushScopeId("data-v-74053305"),o=o(),e.popScopeId(),o),Dt={class:"wi-clarify__header"},Ot={class:"wi-clarify__heading"},Tt=q(()=>e.createElementVNode("div",{class:"wi-clarify__eyebrow"},"需要补充信息",-1)),Pt={class:"wi-clarify__title"},Mt={key:0,class:"wi-clarify__desc"},At={class:"wi-clarify__status"},Lt={class:"wi-clarify__progress"},Ut={class:"wi-clarify__progress-track"},jt={key:0,class:"wi-clarify__panel"},Ft={class:"wi-clarify__question"},Rt={key:0,class:"wi-clarify__question-desc"},zt={key:1,class:"wi-clarify__binding"},qt={key:2,class:"wi-clarify__options"},Kt=["onClick"],Ht={class:"wi-clarify__option-indicator"},Xt={key:3,class:"wi-clarify__date"},Gt=["for"],Wt=["id","value"],Yt={class:"wi-clarify__text"},Jt={key:0,class:"wi-clarify__or"},Zt=q(()=>e.createElementVNode("span",null,"或者,用自己的话说明",-1)),Qt=[Zt],en=["for"],tn=["id","value","placeholder"],nn={class:"wi-clarify__dots","aria-label":"确认问题导航"},on=["aria-label","onClick"],rn={class:"wi-clarify__footer"},an=q(()=>e.createElementVNode("span",{class:"wi-clarify__confirm-text"},"取消后本次操作将停止等待这些回答",-1)),ln={class:"wi-clarify__actions"},sn={class:"wi-clarify__actions"},cn=["disabled"],un={key:1,class:"wi-clarify__result"},dn={class:"wi-clarify__result-icon"},pn={class:"wi-clarify__result-body"},_n={key:0,class:"wi-clarify__summary"},fn={key:1},mn={key:2},vn={key:2,class:"wi-clarify__feedback"},wn=e.defineComponent({__name:"ClarificationCard",props:{report:{}},setup(o){const a=o,s={requestId:"",title:"需要补充信息",description:"",items:[],status:"expired",resultMessage:"本次补充信息已失效(回答已结束)"},t=e.computed(()=>a.report.values??s),r=e.computed(()=>t.value.items??[]),c=e.ref(0),p=e.reactive({}),h=e.ref(!1),v=e.ref(""),w=()=>{Object.keys(p).forEach(n=>delete p[n]),r.value.forEach(n=>{const l={structuredValue:void 0,structuredValues:[],textValue:""};n.default!==void 0&&(n.input.type==="multi_select"?l.structuredValues=Array.isArray(n.default)?[...n.default]:[]:n.input.type==="text"?l.textValue=String(n.default):l.structuredValue=n.default),p[n.id]=l}),c.value=0};e.watch(()=>{var n;return(n=t.value)==null?void 0:n.requestId},w,{immediate:!0});const u=n=>(p[n]||(p[n]={structuredValue:void 0,structuredValues:[],textValue:""}),p[n]),f=e.computed(()=>{var n,l,d;return((n=t.value)==null?void 0:n.status)==="submitted"?"已提交":((l=t.value)==null?void 0:l.status)==="cancelled"?"已取消":((d=t.value)==null?void 0:d.status)==="expired"?"已失效":"等待回答"}),y=n=>{try{const l=JSON.stringify(n);return l===void 0?String(n):l}catch{return String(n)}},V=(n,l)=>y(n)===y(l),S=(n,l)=>{const d=u(n.id);return n.input.type==="multi_select"?d.structuredValues.some(m=>V(m,l)):V(d.structuredValue,l)},I=(n,l)=>{const d=u(n.id);if(d.textValue="",n.input.type==="multi_select"){const m=d.structuredValues.findIndex(B=>V(B,l));m>=0?d.structuredValues.splice(m,1):d.structuredValues.push(l);return}d.structuredValue=l},k=n=>{var l;return((l=n.target)==null?void 0:l.value)??""},g=(n,l)=>{const d=u(n.id);d.textValue=k(l),n.input.type!=="text"&&(d.structuredValue=void 0,d.structuredValues.splice(0))},P=(n,l)=>{const d=u(n.id);d.structuredValue=k(l),d.textValue=""},M=n=>{const l=u(n.id).structuredValue;return l==null?"":String(l)},O=n=>{var l;return((l=n.input.textInput)==null?void 0:l.placeholder)??n.input.placeholder??(n.input.type==="text"?"请输入需要补充的信息":"例如:使用阀门,或者说明你的具体要求")},i=n=>{const l=n.binding;if(!l)return"";const d=l.actionName?`动作:${l.actionName}`:"",m=l.parameterPath?`参数:${l.parameterPath}`:"";return[d,m].filter(Boolean).join(" · ")},E=n=>{const l=u(n.id);return n.input.type==="multi_select"?l.structuredValues.length>0:n.input.type==="single_select"?l.structuredValue!==void 0:n.input.type==="date"?!!l.structuredValue:!1},b=n=>!!u(n.id).textValue.trim()||E(n),A=n=>!n.required||b(n)?!0:(v.value=`请回答“${n.question}”`,!1),x=()=>{v.value="",c.value=Math.max(0,c.value-1)},C=()=>{!_.value||!A(_.value)||(v.value="",c.value=Math.min(r.value.length-1,c.value+1))},_=e.computed(()=>r.value[c.value]),L=(n,l)=>n.input.type==="date"?String(l??""):(Array.isArray(l)?l:[l]).map(m=>{var j;const B=(j=n.input.options)==null?void 0:j.find(ce=>V(ce.value,m));return(B==null?void 0:B.label)??String(m??"")}).filter(Boolean).join("、"),U=n=>{const l=u(n.id),d=l.textValue.trim();if(n.input.type==="text"||d||!E(n))return{id:n.id,mode:"text",value:d,displayText:d};const m=n.input.type==="multi_select"?[...l.structuredValues]:l.structuredValue;return{id:n.id,mode:"structured",value:m,displayText:L(n,m)}},ae=()=>{const n=r.value.findIndex(d=>d.required&&!b(d));if(n>=0){c.value=n,v.value=`请回答“${r.value[n].question}”`;return}v.value="";const l=r.value.map(U);N.submitClarification(t.value.requestId,l)||(v.value="本次补充信息已经处理")},le=()=>{h.value=!1,v.value="",N.cancelClarification(t.value.requestId)||(v.value="本次补充信息已经处理")},se=n=>{var l;return((l=r.value.find(d=>d.id===n))==null?void 0:l.question)??n};return(n,l)=>{var d;return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["wi-clarify",`is-${t.value.status}`])},[e.createElementVNode("header",Dt,[e.createElementVNode("div",Ot,[Tt,e.createElementVNode("h3",Pt,e.toDisplayString(t.value.title),1),t.value.description?(e.openBlock(),e.createElementBlock("p",Mt,e.toDisplayString(t.value.description),1)):e.createCommentVNode("",!0)]),e.createElementVNode("span",At,e.toDisplayString(f.value),1)]),t.value.status==="pending"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Lt,[e.createElementVNode("span",null,"问题 "+e.toDisplayString(c.value+1)+" / "+e.toDisplayString(r.value.length),1),e.createElementVNode("div",Ut,[e.createElementVNode("span",{style:e.normalizeStyle({width:`${(c.value+1)/r.value.length*100}%`})},null,4)])]),_.value?(e.openBlock(),e.createElementBlock("div",jt,[e.createElementVNode("div",Ft,[e.createElementVNode("span",{class:e.normalizeClass(_.value.required?"wi-clarify__required":"wi-clarify__optional")},e.toDisplayString(_.value.required?"必填":"选填"),3),e.createElementVNode("h4",null,e.toDisplayString(_.value.question),1)]),_.value.description?(e.openBlock(),e.createElementBlock("p",Rt,e.toDisplayString(_.value.description),1)):e.createCommentVNode("",!0),i(_.value)?(e.openBlock(),e.createElementBlock("div",zt,e.toDisplayString(i(_.value)),1)):e.createCommentVNode("",!0),_.value.input.type==="single_select"||_.value.input.type==="multi_select"?(e.openBlock(),e.createElementBlock("div",qt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value.input.options,(m,B)=>(e.openBlock(),e.createElementBlock("button",{key:B,type:"button",class:e.normalizeClass(["wi-clarify__option",{"is-selected":S(_.value,m.value)}]),onClick:j=>I(_.value,m.value)},[e.createElementVNode("span",Ht,e.toDisplayString(S(_.value,m.value)?"✓":""),1),e.createElementVNode("span",null,e.toDisplayString(m.label),1)],10,Kt))),128))])):_.value.input.type==="date"?(e.openBlock(),e.createElementBlock("div",Xt,[e.createElementVNode("label",{for:`wi-clarify-date-${_.value.id}`},"选择日期",8,Gt),e.createElementVNode("input",{id:`wi-clarify-date-${_.value.id}`,type:"date",value:M(_.value),onInput:l[0]||(l[0]=m=>P(_.value,m))},null,40,Wt)])):e.createCommentVNode("",!0),e.createElementVNode("div",Yt,[_.value.input.type!=="text"?(e.openBlock(),e.createElementBlock("div",Jt,Qt)):e.createCommentVNode("",!0),e.createElementVNode("label",{for:`wi-clarify-text-${_.value.id}`},e.toDisplayString(_.value.input.type==="text"?"你的回答":"自然语言回答"),9,en),e.createElementVNode("textarea",{id:`wi-clarify-text-${_.value.id}`,value:u(_.value.id).textValue,placeholder:O(_.value),rows:"3",onInput:l[1]||(l[1]=m=>g(_.value,m))},null,40,tn)])])):e.createCommentVNode("",!0),e.createElementVNode("div",nn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(m,B)=>(e.openBlock(),e.createElementBlock("button",{key:m.id,type:"button","aria-label":`查看第 ${B+1} 个问题`,class:e.normalizeClass({"is-active":B===c.value,"is-answered":b(m)}),onClick:j=>c.value=B},null,10,on))),128))]),e.createElementVNode("footer",rn,[h.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[an,e.createElementVNode("div",ln,[e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--secondary",onClick:l[2]||(l[2]=m=>h.value=!1)}," 继续填写 "),e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--danger",onClick:le},"确认取消")])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{type:"button",class:"wi-clarify__cancel",onClick:l[3]||(l[3]=m=>h.value=!0)},"取消"),e.createElementVNode("div",sn,[e.createElementVNode("button",{type:"button",class:"wi-clarify__btn wi-clarify__btn--secondary",disabled:c.value===0,onClick:x}," 上一项 ",8,cn),c.value<r.value.length-1?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-clarify__btn wi-clarify__btn--primary",onClick:C}," 下一项 ")):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"wi-clarify__btn wi-clarify__btn--primary",onClick:ae},"提交全部"))])],64))])],64)):(e.openBlock(),e.createElementBlock("div",un,[e.createElementVNode("div",dn,e.toDisplayString(t.value.status==="submitted"?"✓":t.value.status==="cancelled"?"—":"!"),1),e.createElementVNode("div",pn,[e.createElementVNode("h4",null,e.toDisplayString(t.value.resultMessage||f.value),1),t.value.status==="submitted"&&((d=t.value.answers)!=null&&d.length)?(e.openBlock(),e.createElementBlock("div",_n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value.answers,m=>(e.openBlock(),e.createElementBlock("div",{key:m.id},[e.createElementVNode("span",null,e.toDisplayString(se(m.id)),1),e.createElementVNode("strong",null,e.toDisplayString(m.displayText||"未填写"),1)]))),128))])):t.value.status==="cancelled"?(e.openBlock(),e.createElementBlock("p",fn,"本次确认未提交,工作流将收到取消结果。")):(e.openBlock(),e.createElementBlock("p",mn,"该确认项已失效,无法再提交。"))])])),v.value?(e.openBlock(),e.createElementBlock("div",vn,e.toDisplayString(v.value),1)):e.createCommentVNode("",!0)],2)}}}),ne=$(wn,[["__scopeId","data-v-74053305"]]),yn=Object.freeze(Object.defineProperty({__proto__:null,default:ne},Symbol.toStringTag,{value:"Module"})),oe=o=>(e.pushScopeId("data-v-14805363"),o=o(),e.popScopeId(),o),kn={class:"wi-agent-action__head"},hn={class:"wi-agent-action__icon","aria-hidden":"true"},gn={class:"wi-agent-action__title"},En=oe(()=>e.createElementVNode("span",{class:"wi-agent-action__label"},"执行操作",-1)),bn={class:"wi-agent-action__name"},Vn={class:"wi-agent-action__chip"},Sn={class:"wi-agent-action__message"},Bn={key:0,class:"wi-agent-action__args"},Nn=oe(()=>e.createElementVNode("summary",null,"查看参数",-1)),Cn=e.defineComponent({__name:"AgentActionStatus",props:{report:{}},setup(o){const a=o,s={id:"",name:"",arguments:{},status:"unknown",message:"执行状态未知(回答已结束)"},t=e.computed(()=>a.report.values??s),r=e.computed(()=>t.value.status==="running"?"●":t.value.status==="success"?"✓":t.value.status==="error"?"!":"?"),c=e.computed(()=>t.value.status==="running"?"执行中":t.value.status==="success"?"已完成":t.value.status==="error"?"执行失败":"状态未知"),p=e.computed(()=>{const v=t.value.arguments;return!!v&&typeof v=="object"&&Object.keys(v).length>0}),h=e.computed(()=>JSON.stringify(t.value.arguments??{},null,2));return(v,w)=>(e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["wi-agent-action",`is-${t.value.status}`])},[e.createElementVNode("header",kn,[e.createElementVNode("span",hn,e.toDisplayString(r.value),1),e.createElementVNode("div",gn,[En,e.createElementVNode("code",bn,e.toDisplayString(t.value.name||"未知操作"),1)]),e.createElementVNode("span",Vn,e.toDisplayString(c.value),1)]),e.createElementVNode("p",Sn,e.toDisplayString(t.value.message||c.value),1),p.value?(e.openBlock(),e.createElementBlock("details",Bn,[Nn,e.createElementVNode("pre",null,e.toDisplayString(h.value),1)])):e.createCommentVNode("",!0)],2))}}),re=$(Cn,[["__scopeId","data-v-14805363"]]),$n=Object.freeze(Object.defineProperty({__proto__:null,default:re},Symbol.toStringTag,{value:"Module"}));exports.AgentActionStatus=re;exports.AiAnswerBubble=he;exports.ClarificationCard=ne;exports.DeepThinkingSteps=Ie;exports.IframePage=te;exports.KnowledgeStreamResult=G;exports.OutputFile=Y;exports.createAnswerContentMap=X;exports.injectIframeResizerChild=ee;exports.provideIframePageConfig=$t;exports.provideOutputFileConfig=Pe;exports.resolveIframePlaceholders=Z;exports.useIframePage=Q;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -11,3 +11,4 @@ export { default as IframePage } from './iframePage/IframePage.vue';
11
11
  export { injectIframeResizerChild, provideIframePageConfig, resolveIframePlaceholders, useIframePage } from './iframePage/useIframePage';
12
12
  export type { IframePageConfig, UseIframePageReturn } from './iframePage/useIframePage';
13
13
  export { default as ClarificationCard } from './clarification/ClarificationCard.vue';
14
+ export { default as AgentActionStatus } from './agentAction/AgentActionStatus.vue';