wi-chat 0.6.1 → 0.6.2

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.
Files changed (59) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +273 -261
  3. package/dist/core/useChat.d.ts +61 -12
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +33 -33
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +6 -6
  8. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  9. package/dist/mobile-ui/index.cjs +1 -1
  10. package/dist/mobile-ui/index.js +104 -104
  11. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +5 -5
  12. package/dist/page-context/index.js +2 -4
  13. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
  14. package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
  15. package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
  16. package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
  17. package/dist/parser/answerCom/actionExecute/parseHostAction.d.ts +3 -2
  18. package/dist/parser/answerCom/actionExecute/types.d.ts +3 -3
  19. package/dist/parser/index.cjs +2 -2
  20. package/dist/parser/index.d.ts +2 -2
  21. package/dist/parser/index.js +216 -258
  22. package/dist/parser/registry.d.ts +1 -1
  23. package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
  24. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +3 -3
  25. package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
  26. package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +3 -3
  27. package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
  28. package/dist/renderers/index.cjs +1 -1
  29. package/dist/renderers/index.js +484 -498
  30. package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
  31. package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
  32. package/dist/renderers/style.css +1 -1
  33. package/dist/request/index.cjs +2 -2
  34. package/dist/request/index.js +6 -13
  35. package/dist/request/ws.d.ts +3 -3
  36. package/dist/right-panel/RightPanel.vue.d.ts +6 -6
  37. package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
  38. package/dist/right-panel/RightPanelTabs.vue.d.ts +5 -5
  39. package/dist/right-panel/index.cjs +1 -1
  40. package/dist/right-panel/index.js +397 -416
  41. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
  42. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
  43. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
  44. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
  45. package/dist/theme/index.js +2 -4
  46. package/dist/tools/index.cjs +2 -2
  47. package/dist/tools/index.js +10 -19
  48. package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
  49. package/dist/tools/useAutoScroll.d.ts +3 -3
  50. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
  51. package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
  52. package/dist/web-ui/chat/ChatContainer.vue.d.ts +6 -6
  53. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  54. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +5 -5
  55. package/dist/web-ui/index.cjs +1 -1
  56. package/dist/web-ui/index.js +630 -635
  57. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +7 -7
  58. package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
  59. package/package.json +2 -1
@@ -1,20 +1,20 @@
1
1
  import { RightPanelTab, RightPanelToolItem, UseRightPanelReturn } from '../../types';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 当前标签页 */
5
5
  tab: RightPanelTab;
6
6
  /** 面板状态机句柄(地址栏跳转 / 插入标签页) */
7
7
  panel: UseRightPanelReturn;
8
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
9
  "tool-click": (item: RightPanelToolItem) => void;
10
10
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
11
  /** 当前标签页 */
12
12
  tab: RightPanelTab;
13
13
  /** 面板状态机句柄(地址栏跳转 / 插入标签页) */
14
14
  panel: UseRightPanelReturn;
15
- }>>> & {
15
+ }>>> & Readonly<{
16
16
  "onTool-click"?: (item: RightPanelToolItem) => any;
17
- }, {}, {}>;
17
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
18
18
  export default _default;
19
19
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
20
20
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,21 +1,21 @@
1
1
  import { RightPanelWebRuntime } from './useWebview';
2
2
  import { RightPanelTab, UseRightPanelReturn } from '../../types';
3
3
 
4
- declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
5
5
  /** 当前标签页(url / 标题 / 刷新计数) */
6
6
  tab: RightPanelTab;
7
7
  /** 面板状态机句柄(导航 / 历史 / 刷新 / 状态回写) */
8
8
  panel: UseRightPanelReturn;
9
9
  /** 强制指定运行时;缺省在 Electron 且 webview 可用时用 webview,否则 iframe */
10
10
  runtime?: RightPanelWebRuntime;
11
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
12
12
  /** 当前标签页(url / 标题 / 刷新计数) */
13
13
  tab: RightPanelTab;
14
14
  /** 面板状态机句柄(导航 / 历史 / 刷新 / 状态回写) */
15
15
  panel: UseRightPanelReturn;
16
16
  /** 强制指定运行时;缺省在 Electron 且 webview 可用时用 webview,否则 iframe */
17
17
  runtime?: RightPanelWebRuntime;
18
- }>>>, {}, {}>;
18
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
19
19
  export default _default;
20
20
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
21
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,16 +1,16 @@
1
1
  import { RightPanelTab, UseRightPanelReturn } from '../types';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 当前标签页(地址与加载态来源) */
5
5
  tab: RightPanelTab;
6
6
  /** 面板状态机句柄(导航 / 历史 / 刷新) */
7
7
  panel: UseRightPanelReturn;
8
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
9
  /** 当前标签页(地址与加载态来源) */
10
10
  tab: RightPanelTab;
11
11
  /** 面板状态机句柄(导航 / 历史 / 刷新) */
12
12
  panel: UseRightPanelReturn;
13
- }>>>, {}, {}>;
13
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
14
14
  export default _default;
15
15
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
16
16
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,6 +1,6 @@
1
1
  import { RightPanelToolItem } from '../types';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 工具入口列表;空数组时整块不渲染 */
5
5
  tools: RightPanelToolItem[];
6
6
  /** 区块标题,传空串则只渲染卡片网格 */
@@ -10,7 +10,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
10
10
  }>, {
11
11
  title: string;
12
12
  columns: number;
13
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
13
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
14
  "tool-click": (item: RightPanelToolItem) => void;
15
15
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
16
16
  /** 工具入口列表;空数组时整块不渲染 */
@@ -22,12 +22,12 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
22
22
  }>, {
23
23
  title: string;
24
24
  columns: number;
25
- }>>> & {
25
+ }>>> & Readonly<{
26
26
  "onTool-click"?: (item: RightPanelToolItem) => any;
27
- }, {
27
+ }>, {
28
28
  title: string;
29
29
  columns: number;
30
- }, {}>;
30
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
31
31
  export default _default;
32
32
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
33
33
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,7 +1,6 @@
1
1
  import "wi-chat/style.css";
2
2
  const i = "#5b7fff", n = (r, e) => {
3
- if (typeof window > "u")
4
- return;
3
+ if (typeof window > "u") return;
5
4
  const t = e ?? document.documentElement;
6
5
  return getComputedStyle(t).getPropertyValue(r).trim() || void 0;
7
6
  }, s = {
@@ -24,8 +23,7 @@ const i = "#5b7fff", n = (r, e) => {
24
23
  return r;
25
24
  }
26
25
  }, d = (r = {}, e) => {
27
- if (typeof window > "u")
28
- return !1;
26
+ if (typeof window > "u") return !1;
29
27
  const t = e ?? document.documentElement, { primary: a, hostPrimaryVar: c = "--el-color-primary" } = r, o = a ?? n(c, t) ?? n("--wi-chat-primary", t) ?? i;
30
28
  return t.style.setProperty("--wi-chat-primary", o), !0;
31
29
  };
@@ -1,4 +1,4 @@
1
- "use strict";var N=Object.create;var A=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var X=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of J(t))!V.call(e,c)&&c!==o&&A(e,c,{get:()=>t[c],enumerable:!(n=z(t,c))||n.enumerable});return e};var D=(e,t,o)=>(o=e!=null?N(Z(e)):{},X(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("wi-chat/style.css");const w=require("vue"),P=require("wi-chat/parser"),Y=require("@mdit/plugin-katex"),M=require("highlight.js"),E=require("markdown-it"),_=e=>new E().utils.escapeHtml(e),O=e=>_(e).replace(/"/g,"&quot;").replace(/'/g,"&#39;"),K=e=>!e||e.includes("get_image_full")?e:e.replace("get_image","get_image_full"),j=e=>{const{langPrefix:t="language-",imagePreview:o=!0,showCodeLang:n=!0,imageSrcResolver:c,imageDownload:l=!0,tableDownload:r=!0}=e,a='<button type="button" class="wi-md-table-download" title="下载 Excel" aria-label="下载表格为 Excel"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg></button>',d=new E({linkify:!0,typographer:!0,breaks:!0,html:!0,langPrefix:t,highlight:(s,u)=>{if(u&&M.getLanguage(u))try{return M.highlight(s,{language:u}).value}catch{return _(s)}return _(s)}}).use(Y.katex,{delimiters:"dollars"});return d.renderer.rules.fence=(s,u,m,y,g)=>{var v;const f=s[u],p=f.info.trim().split(/\s+/)[0].toLowerCase(),k=((v=m.highlight)==null?void 0:v.call(m,f.content,p,""))||_(f.content);return`
1
+ "use strict";var N=Object.create;var A=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var X=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of J(t))!V.call(e,c)&&c!==o&&A(e,c,{get:()=>t[c],enumerable:!(n=z(t,c))||n.enumerable});return e};var D=(e,t,o)=>(o=e!=null?N(Z(e)):{},X(t||!e||!e.__esModule?A(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("wi-chat/style.css");const w=require("vue"),P=require("wi-chat/parser"),Y=require("@mdit/plugin-katex"),M=require("highlight.js"),E=require("markdown-it"),_=e=>new E().utils.escapeHtml(e),O=e=>_(e).replace(/"/g,"&quot;").replace(/'/g,"&#39;"),K=e=>!e||e.includes("get_image_full")?e:e.replace("get_image","get_image_full"),j=e=>{const{langPrefix:t="language-",imagePreview:o=!0,showCodeLang:n=!0,imageSrcResolver:c,imageDownload:l=!0,tableDownload:r=!0}=e,a='<button type="button" class="wi-md-table-download" title="下载 Excel" aria-label="下载表格为 Excel"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg></button>',d=new E({linkify:!0,typographer:!0,breaks:!0,html:!0,langPrefix:t,highlight:(s,u)=>{if(u&&M.getLanguage(u))try{return M.highlight(s,{language:u}).value}catch{return _(s)}return _(s)}}).use(Y.katex,{delimiters:"dollars"});return d.renderer.rules.fence=(s,u,m,y,f)=>{var v;const g=s[u],p=g.info.trim().split(/\s+/)[0].toLowerCase(),k=((v=m.highlight)==null?void 0:v.call(m,g.content,p,""))||_(g.content);return`
2
2
  <div class="wi-md-block">
3
3
  <div class="wi-md-block-header">
4
4
  <div class="wi-md-block-header-left">${n&&p?`<span class="wi-md-lang">${_(p)}</span>`:""}</div>
@@ -13,5 +13,5 @@
13
13
  </div>
14
14
  <pre class="wi-md-code"><code class="${m.langPrefix}${_(p)}">${k}</code></pre>
15
15
  </div>
16
- `.trim()},d.renderer.rules.table_open=()=>r?'<div class="wi-md-table-wrap"><table class="wi-md-table">':'<table class="wi-md-table">',d.renderer.rules.table_close=()=>r?`</table>${a}</div>`:"</table>",d.renderer.rules.ordered_list_open=(s,u,m,y,g)=>(s[u].attrJoin("class","wi-md-list wi-md-list-ordered"),g.renderToken(s,u,m)),d.renderer.rules.bullet_list_open=(s,u,m,y,g)=>(s[u].attrJoin("class","wi-md-list wi-md-list-bullet"),g.renderToken(s,u,m)),d.renderer.rules.list_item_open=(s,u,m,y,g)=>(s[u].attrJoin("class","wi-md-list-item"),g.renderToken(s,u,m)),d.renderer.rules.image=(s,u,m,y,g)=>{const f=s[u],p=f.attrGet("src")||"",k=f.attrGet("alt")||f.content||"",S=f.attrGet("title")||"",v=[`src="${O(p)}"`,`alt="${O(k)}"`,S?`title="${O(S)}"`:""].filter(Boolean).join(" ");if(!o)return`<img ${v} />`;const x=c?c(p):K(p),h=l?'<span class="wi-md-image-download" title="下载图片" role="button" aria-label="下载图片"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg></span>':"";return`<span class="wi-md-image-wrap" data-src="${O(x)}"><img ${v} loading="lazy" />${h}</span>`},d},Q=".wi-markdown";let W=0;const q=()=>{const e="data-wi-md-scope",t=`wi-md-scope-${++W}`;return{attr:e,id:t,selector:`[${e}="${t}"]`}},ee=/^(background|padding|margin|width|height|min-width|min-height|max-width|max-height|overflow|display|position|inset|top|right|bottom|left|border|box-shadow|flex|gap|justify-content|align-items)/i,te=e=>e.replace(/(^|[{};,])(\s*)(?:html|body|:root)(?![\w-])\s*\{([^}]*)\}/gi,(t,o,n,c)=>{const l=c.split(";").map(r=>r.trim()).filter(r=>r&&!ee.test(r)).join(";");return l?`${o}${n}:scope{${l}}`:""}),oe=(e,t)=>{const o=[];let n=e.replace(/<style\b([^>]*)>([\s\S]*?)<\/style\s*>/gi,(c,l,r)=>{const a=/^\s*@scope\b/i.test(r)?`<style${l}>${r}</style>`:`<style${l}>@scope (${t}) {${te(r)}}</style>`;return o.push(a),`\0wi-md-style-${o.length-1}\0`});return n=n.replace(/<\/?style\b[^>]*>/gi,""),n=n.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<\/?script\b[^>]*>/gi,""),n=n.replace(/<link\b[^>]*>/gi,""),n.replace(/\u0000wi-md-style-(\d+)\u0000/g,(c,l)=>o[Number(l)])};let B=null;const ne=()=>(B||(B=j({})),B),re=e=>(e.langPrefix===void 0||e.langPrefix==="language-")&&(e.imagePreview===void 0||e.imagePreview)&&(e.showCodeLang===void 0||e.showCodeLang)&&(e.imageDownload===void 0||e.imageDownload)&&(e.tableDownload===void 0||e.tableDownload)&&!e.imageSrcResolver,I=(e,t={})=>{const o=re(t)?ne():j(t);return oe(o.render(e),t.styleScope||Q)};let T=null;const U=()=>{T&&(w.render(null,T),T.remove(),T=null)},F=async(e,t,o)=>{U();const n=t&&t.length?t.includes(e)?t:[e,...t.filter(d=>d!==e)]:[e],c=Math.max(o??n.indexOf(e),0),l=document.createElement("div");document.body.appendChild(l),T=l;const{ElImageViewer:r}=await import("element-plus");if(T!==l)return;const a=w.createVNode(r,{urlList:n,initialIndex:Math.min(c,n.length-1),onClose:U,hideOnClickModal:!0,teleported:!0});w.render(a,l)},le=e=>{fetch(e).then(t=>t.blob()).then(t=>{var c;const o=URL.createObjectURL(t),n=document.createElement("a");n.href=o,n.download=((c=e.split("/").pop())==null?void 0:c.split("?")[0])||"image",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}).catch(()=>{const t=document.createElement("a");t.href=e,t.download="",t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)})},G=async(e,t)=>{try{const o=await import("xlsx"),n=o.utils.table_to_sheet(e),c=o.utils.book_new();o.utils.book_append_sheet(c,n,"查询结果");const l=o.write(c,{bookType:"xlsx",type:"array"}),r=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),a=URL.createObjectURL(r),d=document.createElement("a");d.href=a,d.download=`${t||"表格"}_${new Date().toISOString().slice(0,10)}.xlsx`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(a)}catch(o){console.error("[downloadTableAsExcel] 表格导出 Excel 失败:",o)}},ae=["data-wi-md-scope","innerHTML"],ce=w.defineComponent({__name:"MarkdownContent",props:{source:{default:""},renderOptions:{default:()=>({})}},setup(e){const t=e,o=w.ref(),n=q(),c=w.computed(()=>I(t.source,{...t.renderOptions,styleScope:n.selector})),l=async(a,d)=>{try{await navigator.clipboard.writeText(d)}catch{const s=document.createElement("textarea");s.value=d,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()}a.classList.add("wi-md-copied"),window.setTimeout(()=>a.classList.remove("wi-md-copied"),1500)},r=a=>{var f,p,k,S,v,x;const d=a.target,s=d.closest(".wi-md-copy");if(s){a.preventDefault();const h=((p=(f=s.closest(".wi-md-block"))==null?void 0:f.querySelector(".wi-md-code code"))==null?void 0:p.textContent)||"";l(s,h);return}const u=d.closest(".wi-md-toggle");if(u){a.preventDefault(),(k=u.closest(".wi-md-block"))==null||k.classList.toggle("wi-md-collapsed");return}const m=d.closest(".wi-md-image-download");if(m){a.preventDefault(),a.stopPropagation();const h=(S=m.closest(".wi-md-image-wrap"))==null?void 0:S.dataset.src;h&&le(h);return}const y=d.closest(".wi-md-table-download");if(y){a.preventDefault(),a.stopPropagation();const h=(v=y.closest(".wi-md-table-wrap"))==null?void 0:v.querySelector("table");h&&G(h);return}const g=d.closest(".wi-md-image-wrap img");if(g){a.preventDefault();const h=g.closest(".wi-md-image-wrap"),C=(h==null?void 0:h.dataset.src)||g.src||"";if(!C)return;const L=Array.from(((x=o.value)==null?void 0:x.querySelectorAll(".wi-md-image-wrap"))??[]).map(R=>{var i;return R.dataset.src||((i=R.querySelector("img"))==null?void 0:i.getAttribute("src"))||""}).filter(Boolean);F(C,L.length>1?L:void 0,L.indexOf(C))}};return w.onBeforeUnmount(U),(a,d)=>(w.openBlock(),w.createElementBlock("div",{ref_key:"rootEl",ref:o,class:"wi-markdown","data-wi-md-scope":w.unref(n).id,innerHTML:c.value,onClick:r},null,8,ae))}}),se=48,ie=48,de=async()=>{await w.nextTick(),await new Promise(e=>requestAnimationFrame(()=>e()))},ue=e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,0)},me=e=>{const t=w.ref(!1),o=w.ref(!0);let n,c,l,r=!1,a=0,d,s={preserveScroll:!0},u=!1,m=!1;const y=i=>i.scrollHeight-i.scrollTop-i.clientHeight<=se,g=i=>i.scrollTop<=ie,f=i=>{const b=e.value;if(!b)return;const $=b.scrollHeight>a;a=b.scrollHeight,i&&$&&o.value&&(b.scrollTop=b.scrollHeight);const H=y(b);o.value=H,t.value=!H},p=()=>f(!1),k=()=>{r||(r=!0,ue(()=>{r=!1,f(!0)}))},S=()=>{n==null||n(),n=void 0,c==null||c.disconnect(),c=void 0,l==null||l.disconnect(),l=void 0},v=async()=>{await de();const i=e.value;i&&(i.scrollTop=i.scrollHeight,a=i.scrollHeight,o.value=!0,t.value=!1)},x=async()=>{if(!o.value){t.value=!0;return}await v()},h=()=>{const i=e.value;i&&(i.scrollTop=0),a=0,o.value=!0,t.value=!1},C=async i=>{const b=e.value,$=b?b.scrollHeight:0;try{await i()}finally{await w.nextTick(),e.value&&$&&(e.value.scrollTop+=e.value.scrollHeight-$,a=e.value.scrollHeight)}},L=(i,b={preserveScroll:!0})=>{d=i,s=b},R=async()=>{const i=e.value;if(!i||(p(),!d||u))return;const b=g(i);if(b&&!m){m=!0,u=!0;try{(s==null?void 0:s.preserveScroll)!==!1?await C(d):await d()}finally{u=!1,g(i)||(m=!1)}}else b||(m=!1)};return w.watch(e,i=>{S(),i&&(i.addEventListener("scroll",R,{passive:!0}),n=()=>i.removeEventListener("scroll",R),typeof MutationObserver<"u"&&(c=new MutationObserver(k),c.observe(i,{childList:!0,subtree:!0,characterData:!0})),typeof ResizeObserver<"u"&&(l=new ResizeObserver(k),l.observe(i)),a=0,p())},{immediate:!0,flush:"post"}),w.getCurrentInstance()&&w.onUnmounted(()=>S()),{showScrollToBottom:t,forceScrollToBottom:v,requestScrollToBottom:x,syncScrollState:p,resetScrollState:h,onReachTop:L,preserveScrollPosition:C}},we=async(e,t={})=>{if(typeof window>"u"||typeof document>"u")return;const o=e.attachContent||{},n=e.name||o.file_name||"download";if(o.raw){const l=URL.createObjectURL(o.raw),r=document.createElement("a");r.href=l,r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(l);return}if(!o.fileId)return;const c=P.resolveAttachDownloadUrl(o.fileId,t.baseURL,t.getFileUrl);if(c)try{const l=await fetch(c,{credentials:"include"});if(!l.ok)throw new Error(`Download failed with status ${l.status}`);const r=URL.createObjectURL(await l.blob()),a=document.createElement("a");a.href=r,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)}catch(l){console.error("[downloadAttachment] fetch blob 失败,降级为直接链接触发:",l);const r=document.createElement("a");r.href=c,r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r)}};Object.defineProperty(exports,"consumeStream",{enumerable:!0,get:()=>P.consumeStream});exports.MarkdownContent=ce;exports.closeImagePreview=U;exports.createStyleScope=q;exports.downloadAttachment=we;exports.downloadTableAsExcel=G;exports.openImagePreview=F;exports.renderMarkdown=I;exports.useAutoScroll=me;
16
+ `.trim()},d.renderer.rules.table_open=()=>r?'<div class="wi-md-table-wrap"><table class="wi-md-table">':'<table class="wi-md-table">',d.renderer.rules.table_close=()=>r?`</table>${a}</div>`:"</table>",d.renderer.rules.ordered_list_open=(s,u,m,y,f)=>(s[u].attrJoin("class","wi-md-list wi-md-list-ordered"),f.renderToken(s,u,m)),d.renderer.rules.bullet_list_open=(s,u,m,y,f)=>(s[u].attrJoin("class","wi-md-list wi-md-list-bullet"),f.renderToken(s,u,m)),d.renderer.rules.list_item_open=(s,u,m,y,f)=>(s[u].attrJoin("class","wi-md-list-item"),f.renderToken(s,u,m)),d.renderer.rules.image=(s,u,m,y,f)=>{const g=s[u],p=g.attrGet("src")||"",k=g.attrGet("alt")||g.content||"",S=g.attrGet("title")||"",v=[`src="${O(p)}"`,`alt="${O(k)}"`,S?`title="${O(S)}"`:""].filter(Boolean).join(" ");if(!o)return`<img ${v} />`;const x=c?c(p):K(p),h=l?'<span class="wi-md-image-download" title="下载图片" role="button" aria-label="下载图片"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg></span>':"";return`<span class="wi-md-image-wrap" data-src="${O(x)}"><img ${v} loading="lazy" />${h}</span>`},d},Q=".wi-markdown";let W=0;const q=()=>{const e="data-wi-md-scope",t=`wi-md-scope-${++W}`;return{attr:e,id:t,selector:`[${e}="${t}"]`}},ee=/^(background|padding|margin|width|height|min-width|min-height|max-width|max-height|overflow|display|position|inset|top|right|bottom|left|border|box-shadow|flex|gap|justify-content|align-items)/i,te=e=>e.replace(/(^|[{};,])(\s*)(?:html|body|:root)(?![\w-])\s*\{([^}]*)\}/gi,(t,o,n,c)=>{const l=c.split(";").map(r=>r.trim()).filter(r=>r&&!ee.test(r)).join(";");return l?`${o}${n}:scope{${l}}`:""}),oe=(e,t)=>{const o=[];let n=e.replace(/<style\b([^>]*)>([\s\S]*?)<\/style\s*>/gi,(c,l,r)=>{const a=/^\s*@scope\b/i.test(r)?`<style${l}>${r}</style>`:`<style${l}>@scope (${t}) {${te(r)}}</style>`;return o.push(a),`\0wi-md-style-${o.length-1}\0`});return n=n.replace(/<\/?style\b[^>]*>/gi,""),n=n.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<\/?script\b[^>]*>/gi,""),n=n.replace(/<link\b[^>]*>/gi,""),n.replace(/\u0000wi-md-style-(\d+)\u0000/g,(c,l)=>o[Number(l)])};let B=null;const ne=()=>(B||(B=j({})),B),re=e=>(e.langPrefix===void 0||e.langPrefix==="language-")&&(e.imagePreview===void 0||e.imagePreview)&&(e.showCodeLang===void 0||e.showCodeLang)&&(e.imageDownload===void 0||e.imageDownload)&&(e.tableDownload===void 0||e.tableDownload)&&!e.imageSrcResolver,I=(e,t={})=>{const o=re(t)?ne():j(t);return oe(o.render(e),t.styleScope||Q)};let T=null;const U=()=>{T&&(w.render(null,T),T.remove(),T=null)},F=async(e,t,o)=>{U();const n=t&&t.length?t.includes(e)?t:[e,...t.filter(d=>d!==e)]:[e],c=Math.max(o??n.indexOf(e),0),l=document.createElement("div");document.body.appendChild(l),T=l;const{ElImageViewer:r}=await import("element-plus");if(T!==l)return;const a=w.createVNode(r,{urlList:n,initialIndex:Math.min(c,n.length-1),onClose:U,hideOnClickModal:!0,teleported:!0});w.render(a,l)},le=e=>{fetch(e).then(t=>t.blob()).then(t=>{var c;const o=URL.createObjectURL(t),n=document.createElement("a");n.href=o,n.download=((c=e.split("/").pop())==null?void 0:c.split("?")[0])||"image",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}).catch(()=>{const t=document.createElement("a");t.href=e,t.download="",t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)})},G=async(e,t)=>{try{const o=await import("xlsx"),n=o.utils.table_to_sheet(e),c=o.utils.book_new();o.utils.book_append_sheet(c,n,"查询结果");const l=o.write(c,{bookType:"xlsx",type:"array"}),r=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),a=URL.createObjectURL(r),d=document.createElement("a");d.href=a,d.download=`${t||"表格"}_${new Date().toISOString().slice(0,10)}.xlsx`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(a)}catch(o){console.error("[downloadTableAsExcel] 表格导出 Excel 失败:",o)}},ae=["data-wi-md-scope","innerHTML"],ce=w.defineComponent({__name:"MarkdownContent",props:{source:{default:""},renderOptions:{default:()=>({})}},setup(e){const t=e,o=w.ref(),n=q(),c=w.computed(()=>I(t.source,{...t.renderOptions,styleScope:n.selector})),l=async(a,d)=>{try{await navigator.clipboard.writeText(d)}catch{const s=document.createElement("textarea");s.value=d,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select(),document.execCommand("copy"),s.remove()}a.classList.add("wi-md-copied"),window.setTimeout(()=>a.classList.remove("wi-md-copied"),1500)},r=a=>{var g,p,k,S,v,x;const d=a.target,s=d.closest(".wi-md-copy");if(s){a.preventDefault();const h=((p=(g=s.closest(".wi-md-block"))==null?void 0:g.querySelector(".wi-md-code code"))==null?void 0:p.textContent)||"";l(s,h);return}const u=d.closest(".wi-md-toggle");if(u){a.preventDefault(),(k=u.closest(".wi-md-block"))==null||k.classList.toggle("wi-md-collapsed");return}const m=d.closest(".wi-md-image-download");if(m){a.preventDefault(),a.stopPropagation();const h=(S=m.closest(".wi-md-image-wrap"))==null?void 0:S.dataset.src;h&&le(h);return}const y=d.closest(".wi-md-table-download");if(y){a.preventDefault(),a.stopPropagation();const h=(v=y.closest(".wi-md-table-wrap"))==null?void 0:v.querySelector("table");h&&G(h);return}const f=d.closest(".wi-md-image-wrap img");if(f){a.preventDefault();const h=f.closest(".wi-md-image-wrap"),C=(h==null?void 0:h.dataset.src)||f.src||"";if(!C)return;const L=Array.from(((x=o.value)==null?void 0:x.querySelectorAll(".wi-md-image-wrap"))??[]).map(R=>{var i;return R.dataset.src||((i=R.querySelector("img"))==null?void 0:i.getAttribute("src"))||""}).filter(Boolean);F(C,L.length>1?L:void 0,L.indexOf(C))}};return w.onBeforeUnmount(U),(a,d)=>(w.openBlock(),w.createElementBlock("div",{ref_key:"rootEl",ref:o,class:"wi-markdown","data-wi-md-scope":w.unref(n).id,innerHTML:c.value,onClick:r},null,8,ae))}}),se=48,ie=48,de=async()=>{await w.nextTick(),await new Promise(e=>requestAnimationFrame(()=>e()))},ue=e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,0)},me=e=>{const t=w.ref(!1),o=w.ref(!0);let n,c,l,r=!1,a=0,d,s={preserveScroll:!0},u=!1,m=!1;const y=i=>i.scrollHeight-i.scrollTop-i.clientHeight<=se,f=i=>i.scrollTop<=ie,g=i=>{const b=e.value;if(!b)return;const $=b.scrollHeight>a;a=b.scrollHeight,i&&$&&o.value&&(b.scrollTop=b.scrollHeight);const H=y(b);o.value=H,t.value=!H},p=()=>g(!1),k=()=>{r||(r=!0,ue(()=>{r=!1,g(!0)}))},S=()=>{n==null||n(),n=void 0,c==null||c.disconnect(),c=void 0,l==null||l.disconnect(),l=void 0},v=async()=>{await de();const i=e.value;i&&(i.scrollTop=i.scrollHeight,a=i.scrollHeight,o.value=!0,t.value=!1)},x=async()=>{if(!o.value){t.value=!0;return}await v()},h=()=>{const i=e.value;i&&(i.scrollTop=0),a=0,o.value=!0,t.value=!1,m=!1,u=!1},C=async i=>{const b=e.value,$=b?b.scrollHeight:0;try{await i()}finally{await w.nextTick(),e.value&&$&&(e.value.scrollTop+=e.value.scrollHeight-$,a=e.value.scrollHeight)}},L=(i,b={preserveScroll:!0})=>{d=i,s=b},R=async()=>{const i=e.value;if(!i||(p(),!d||u))return;const b=f(i);if(b&&!m){m=!0,u=!0;try{(s==null?void 0:s.preserveScroll)!==!1?await C(d):await d()}finally{u=!1,f(i)||(m=!1)}}else b||(m=!1)};return w.watch(e,i=>{S(),i&&(i.addEventListener("scroll",R,{passive:!0}),n=()=>i.removeEventListener("scroll",R),typeof MutationObserver<"u"&&(c=new MutationObserver(k),c.observe(i,{childList:!0,subtree:!0,characterData:!0})),typeof ResizeObserver<"u"&&(l=new ResizeObserver(k),l.observe(i)),a=0,p())},{immediate:!0,flush:"post"}),w.getCurrentInstance()&&w.onUnmounted(()=>S()),{showScrollToBottom:t,forceScrollToBottom:v,requestScrollToBottom:x,syncScrollState:p,resetScrollState:h,onReachTop:L,preserveScrollPosition:C}},we=async(e,t={})=>{if(typeof window>"u"||typeof document>"u")return;const o=e.attachContent||{},n=e.name||o.file_name||"download";if(o.raw){const l=URL.createObjectURL(o.raw),r=document.createElement("a");r.href=l,r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(l);return}if(!o.fileId)return;const c=P.resolveAttachDownloadUrl(o.fileId,t.baseURL,t.getFileUrl);if(c)try{const l=await fetch(c,{credentials:"include"});if(!l.ok)throw new Error(`Download failed with status ${l.status}`);const r=URL.createObjectURL(await l.blob()),a=document.createElement("a");a.href=r,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)}catch(l){console.error("[downloadAttachment] fetch blob 失败,降级为直接链接触发:",l);const r=document.createElement("a");r.href=c,r.download=n,document.body.appendChild(r),r.click(),document.body.removeChild(r)}};Object.defineProperty(exports,"consumeStream",{enumerable:!0,get:()=>P.consumeStream});exports.MarkdownContent=ce;exports.closeImagePreview=U;exports.createStyleScope=q;exports.downloadAttachment=we;exports.downloadTableAsExcel=G;exports.openImagePreview=F;exports.renderMarkdown=I;exports.useAutoScroll=me;
17
17
  //# sourceMappingURL=index.cjs.map
@@ -47,8 +47,7 @@ const C = (e) => new A().utils.escapeHtml(e), $ = (e) => C(e).replace(/"/g, "&qu
47
47
  `alt="${$(y)}"`,
48
48
  k ? `title="${$(k)}"` : ""
49
49
  ].filter(Boolean).join(" ");
50
- if (!o)
51
- return `<img ${v} />`;
50
+ if (!o) return `<img ${v} />`;
52
51
  const S = d ? d(p) : K(p), w = l ? '<span class="wi-md-image-download" title="下载图片" role="button" aria-label="下载图片"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg></span>' : "";
53
52
  return `<span class="wi-md-image-wrap" data-src="${$(S)}"><img ${v} loading="lazy" />${w}</span>`;
54
53
  }, i;
@@ -81,8 +80,7 @@ const O = () => {
81
80
  const n = t && t.length ? t.includes(e) ? t : [e, ...t.filter((i) => i !== e)] : [e], d = Math.max(o ?? n.indexOf(e), 0), l = document.createElement("div");
82
81
  document.body.appendChild(l), _ = l;
83
82
  const { ElImageViewer: r } = await import("element-plus");
84
- if (_ !== l)
85
- return;
83
+ if (_ !== l) return;
86
84
  const a = j(r, {
87
85
  urlList: n,
88
86
  initialIndex: Math.min(d, n.length - 1),
@@ -156,8 +154,7 @@ const O = () => {
156
154
  if (f) {
157
155
  a.preventDefault();
158
156
  const w = f.closest(".wi-md-image-wrap"), x = (w == null ? void 0 : w.dataset.src) || f.src || "";
159
- if (!x)
160
- return;
157
+ if (!x) return;
161
158
  const L = Array.from(((S = o.value) == null ? void 0 : S.querySelectorAll(".wi-md-image-wrap")) ?? []).map((T) => {
162
159
  var s;
163
160
  return T.dataset.src || ((s = T.querySelector("img")) == null ? void 0 : s.getAttribute("src")) || "";
@@ -183,8 +180,7 @@ const O = () => {
183
180
  let n, d, l, r = !1, a = 0, i, c = { preserveScroll: !0 }, u = !1, m = !1;
184
181
  const b = (s) => s.scrollHeight - s.scrollTop - s.clientHeight <= ue, f = (s) => s.scrollTop <= me, h = (s) => {
185
182
  const g = e.value;
186
- if (!g)
187
- return;
183
+ if (!g) return;
188
184
  const R = g.scrollHeight > a;
189
185
  a = g.scrollHeight, s && R && o.value && (g.scrollTop = g.scrollHeight);
190
186
  const H = b(g);
@@ -207,7 +203,7 @@ const O = () => {
207
203
  await v();
208
204
  }, w = () => {
209
205
  const s = e.value;
210
- s && (s.scrollTop = 0), a = 0, o.value = !0, t.value = !1;
206
+ s && (s.scrollTop = 0), a = 0, o.value = !0, t.value = !1, m = !1, u = !1;
211
207
  }, x = async (s) => {
212
208
  const g = e.value, R = g ? g.scrollHeight : 0;
213
209
  try {
@@ -219,8 +215,7 @@ const O = () => {
219
215
  i = s, c = g;
220
216
  }, T = async () => {
221
217
  const s = e.value;
222
- if (!s || (p(), !i || u))
223
- return;
218
+ if (!s || (p(), !i || u)) return;
224
219
  const g = f(s);
225
220
  if (g && !m) {
226
221
  m = !0, u = !0;
@@ -229,8 +224,7 @@ const O = () => {
229
224
  } finally {
230
225
  u = !1, f(s) || (m = !1);
231
226
  }
232
- } else
233
- g || (m = !1);
227
+ } else g || (m = !1);
234
228
  };
235
229
  return J(
236
230
  e,
@@ -248,22 +242,19 @@ const O = () => {
248
242
  preserveScrollPosition: x
249
243
  };
250
244
  }, xe = async (e, t = {}) => {
251
- if (typeof window > "u" || typeof document > "u")
252
- return;
245
+ if (typeof window > "u" || typeof document > "u") return;
253
246
  const o = e.attachContent || {}, n = e.name || o.file_name || "download";
254
247
  if (o.raw) {
255
248
  const l = URL.createObjectURL(o.raw), r = document.createElement("a");
256
249
  r.href = l, r.download = n, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(l);
257
250
  return;
258
251
  }
259
- if (!o.fileId)
260
- return;
252
+ if (!o.fileId) return;
261
253
  const d = X(o.fileId, t.baseURL, t.getFileUrl);
262
254
  if (d)
263
255
  try {
264
256
  const l = await fetch(d, { credentials: "include" });
265
- if (!l.ok)
266
- throw new Error(`Download failed with status ${l.status}`);
257
+ if (!l.ok) throw new Error(`Download failed with status ${l.status}`);
267
258
  const r = URL.createObjectURL(await l.blob()), a = document.createElement("a");
268
259
  a.href = r, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(r);
269
260
  } catch (l) {
@@ -1,21 +1,21 @@
1
1
  import { MarkdownRenderOptions } from './renderMarkdown';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  source: string;
5
5
  renderOptions?: MarkdownRenderOptions;
6
6
  }>, {
7
7
  source: string;
8
8
  renderOptions: () => {};
9
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
9
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
10
10
  source: string;
11
11
  renderOptions?: MarkdownRenderOptions;
12
12
  }>, {
13
13
  source: string;
14
14
  renderOptions: () => {};
15
- }>>>, {
15
+ }>>> & Readonly<{}>, {
16
16
  source: string;
17
- renderOptions: {};
18
- }, {}>;
17
+ renderOptions: MarkdownRenderOptions;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
19
19
  export default _default;
20
20
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
21
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -11,7 +11,7 @@ export interface OnReachTopOptions {
11
11
  * useAutoScroll 返回值
12
12
  */
13
13
  export interface UseAutoScrollReturn {
14
- /** 是否显示"回到底部"按钮(内容有溢出、且距底部超过阈值时为 true) */
14
+ /** 是否显示"回到底部"按钮(距底部超过阈值时为 true;内容不足一屏时恒为 false) */
15
15
  showScrollToBottom: Ref<boolean>;
16
16
  /** 强制滚动到底部:等待渲染完成(nextTick + 一帧)后执行,并重置自动滚动状态为开启 */
17
17
  forceScrollToBottom: () => Promise<void>;
@@ -20,8 +20,8 @@ export interface UseAutoScrollReturn {
20
20
  /** 立即按当前滚动位置重算状态(内容被整体替换后外部可主动调用;观察器已自动触发,一般不用手调) */
21
21
  syncScrollState: () => void;
22
22
  /**
23
- * 重置滚动状态:滚动位置归零、重新开启自动滚动、隐藏按钮。
24
- * 用于「整表替换」场景(如切换会话时消息被清空),避免上一会话的按钮状态/上翻态滞留。
23
+ * 重置滚动状态:滚动位置归零、重新开启自动滚动、隐藏按钮,并清空触顶状态。
24
+ * 用于「整表替换」场景(如切换会话时消息被清空),避免上一会话的按钮状态 / 上翻态 / 触顶态滞留。
25
25
  */
26
26
  resetScrollState: () => void;
27
27
  /** 注册"滚动触顶"回调(触发一次后需离开顶部区域才能再次触发;触发期间防重入),供向上翻页加载更早历史 */
@@ -1,6 +1,6 @@
1
1
  import { ChatAttachment } from 'wi-chat/parser';
2
2
 
3
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 附件数据对象 */
5
5
  item: ChatAttachment<any>;
6
6
  /** 是否可点击 */
@@ -19,7 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
19
19
  downloadable: any;
20
20
  baseURL: string;
21
21
  getFileUrl: any;
22
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
23
  click: (item: ChatAttachment<any>) => void;
24
24
  remove: (item: ChatAttachment<any>) => void;
25
25
  download: (item: ChatAttachment<any>) => void;
@@ -42,17 +42,17 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
42
42
  downloadable: any;
43
43
  baseURL: string;
44
44
  getFileUrl: any;
45
- }>>> & {
45
+ }>>> & Readonly<{
46
+ onRemove?: (item: ChatAttachment<any>) => any;
46
47
  onClick?: (item: ChatAttachment<any>) => any;
47
48
  onDownload?: (item: ChatAttachment<any>) => any;
48
- onRemove?: (item: ChatAttachment<any>) => any;
49
- }, {
49
+ }>, {
50
50
  baseURL: string;
51
51
  clickable: boolean;
52
52
  removable: boolean;
53
53
  downloadable: boolean;
54
54
  getFileUrl: (fileId: string) => string;
55
- }, {}>, {
55
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
56
56
  icon?(_: {
57
57
  item: ChatAttachment<any>;
58
58
  }): any;
@@ -1,6 +1,6 @@
1
1
  import { AttachmentItem } from './types';
2
2
 
3
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 附件列表,支持标准 AttachmentItem 对象数组或原生 File 对象数组 */
5
5
  items?: any[];
6
6
  /** 是否支持删除,默认 false */
@@ -20,7 +20,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
20
20
  clickable: boolean;
21
21
  baseURL: string;
22
22
  getFileUrl: any;
23
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
24
24
  remove: (index: number, item: AttachmentItem<any>) => void;
25
25
  click: (item: AttachmentItem<any>, index: number) => void;
26
26
  download: (item: AttachmentItem<any>, index: number) => void;
@@ -44,18 +44,18 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
44
44
  clickable: boolean;
45
45
  baseURL: string;
46
46
  getFileUrl: any;
47
- }>>> & {
47
+ }>>> & Readonly<{
48
+ onRemove?: (index: number, item: AttachmentItem<any>) => any;
48
49
  onClick?: (item: AttachmentItem<any>, index: number) => any;
49
50
  onDownload?: (item: AttachmentItem<any>, index: number) => any;
50
- onRemove?: (index: number, item: AttachmentItem<any>) => any;
51
- }, {
51
+ }>, {
52
52
  items: any[];
53
53
  baseURL: string;
54
54
  clickable: boolean;
55
55
  removable: boolean;
56
56
  downloadable: boolean;
57
57
  getFileUrl: (fileId: string) => string;
58
- }, {}>, {
58
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
59
59
  icon?(_: {
60
60
  item: AttachmentItem<any>;
61
61
  }): any;
@@ -2,7 +2,7 @@ import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
2
2
  import { OutputFileConfig } from 'wi-chat/renderers';
3
3
  import { ChatAgentItem, ChatSubmitPayload } from './types';
4
4
 
5
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
+ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
6
6
  /** 当前分组消息列表 */
7
7
  messages: Message[];
8
8
  /** 自定义回答类型 parser */
@@ -53,7 +53,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
53
53
  emptyTitle: string;
54
54
  emptyDescription: string;
55
55
  disabled: boolean;
56
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
56
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
57
57
  "update:question": (value: string) => void;
58
58
  "update:incPrevQuestion": (value: "Y" | "N") => void;
59
59
  submit: (payload: ChatSubmitPayload) => void;
@@ -112,15 +112,15 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
112
112
  emptyTitle: string;
113
113
  emptyDescription: string;
114
114
  disabled: boolean;
115
- }>>> & {
115
+ }>>> & Readonly<{
116
116
  onSubmit?: (payload: ChatSubmitPayload) => any;
117
+ onStop?: () => any;
117
118
  onLoadOlder?: () => any;
118
119
  onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
119
- onStop?: () => any;
120
120
  onSelectAgent?: (agent: ChatAgentItem) => any;
121
121
  "onUpdate:incPrevQuestion"?: (value: "Y" | "N") => any;
122
122
  "onUpdate:question"?: (value: string) => any;
123
- }, {
123
+ }>, {
124
124
  placeholder: string;
125
125
  question: string;
126
126
  parsers: AnswerParser<any>[];
@@ -136,7 +136,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
136
136
  currentAgent: ChatAgentItem;
137
137
  session: string;
138
138
  hasMore: boolean;
139
- }, {}>, {
139
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>, {
140
140
  messages?(_: {}): any;
141
141
  "above-input"?(_: {}): any;
142
142
  }>;
@@ -1,7 +1,7 @@
1
1
  import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
2
2
  import { OutputFileConfig } from 'wi-chat/renderers';
3
3
 
4
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
5
  /** 当前分组消息列表 */
6
6
  messages: Message[];
7
7
  /** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
@@ -25,12 +25,12 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
25
25
  loading: boolean;
26
26
  emptyTitle: string;
27
27
  emptyDescription: string;
28
- }>, {
28
+ }>>, {
29
29
  /** 强制滚动到底部 */
30
30
  forceScrollToBottom: () => Promise<void>;
31
31
  /** 自动滚动开启时请求滚动到底部 */
32
32
  requestScrollToBottom: () => Promise<void>;
33
- }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
33
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
34
34
  loadOlder: () => void;
35
35
  updateThinkingExpanded: (message: AssistantMessage, expanded: boolean) => void;
36
36
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -57,17 +57,17 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
57
57
  loading: boolean;
58
58
  emptyTitle: string;
59
59
  emptyDescription: string;
60
- }>>> & {
60
+ }>>> & Readonly<{
61
61
  onLoadOlder?: () => any;
62
62
  onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
63
- }, {
63
+ }>, {
64
64
  parsers: AnswerParser[];
65
65
  baseURL: string;
66
66
  loading: boolean;
67
67
  getFileUrl: (fileId: string) => string;
68
68
  emptyTitle: string;
69
69
  emptyDescription: string;
70
- }, {}>;
70
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
71
71
  export default _default;
72
72
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
73
73
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,6 +1,6 @@
1
1
  import { ChatEnvOption, ChatEnvType } from './types';
2
2
 
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  /** 当前选中的运行环境(v-model) */
5
5
  modelValue?: ChatEnvType;
6
6
  /** 选项列表;不传时使用内置的「本地电脑 / 云电脑」两项 */
@@ -17,7 +17,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
17
17
  disabled: boolean;
18
18
  size: string;
19
19
  showHint: boolean;
20
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
21
  "update:modelValue": (value: ChatEnvType) => void;
22
22
  change: (option: ChatEnvOption) => void;
23
23
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -37,16 +37,16 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
37
37
  disabled: boolean;
38
38
  size: string;
39
39
  showHint: boolean;
40
- }>>> & {
40
+ }>>> & Readonly<{
41
41
  onChange?: (option: ChatEnvOption) => any;
42
42
  "onUpdate:modelValue"?: (value: ChatEnvType) => any;
43
- }, {
43
+ }>, {
44
44
  options: ChatEnvOption[];
45
45
  size: 'default' | 'small';
46
46
  disabled: boolean;
47
47
  modelValue: ChatEnvType;
48
48
  showHint: boolean;
49
- }, {}>;
49
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
50
50
  export default _default;
51
51
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
52
52
  type __VLS_TypePropsToRuntimeProps<T> = {