wi-chat 0.4.0 → 0.5.1

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 (70) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +129 -123
  3. package/dist/core/useChat.d.ts +11 -3
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +5 -3
  6. package/dist/index.js +102 -74
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
  8. package/dist/mobile-ui/index.cjs +1 -1
  9. package/dist/mobile-ui/index.d.ts +1 -1
  10. package/dist/mobile-ui/index.js +89 -82
  11. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  12. package/dist/mobile-ui/style.css +1 -1
  13. package/dist/page-context/extArgs.d.ts +46 -0
  14. package/dist/page-context/index.cjs +2 -0
  15. package/dist/page-context/index.d.ts +18 -0
  16. package/dist/page-context/index.js +48 -0
  17. package/dist/page-context/state.d.ts +10 -0
  18. package/dist/page-context/types.d.ts +218 -0
  19. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  20. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  21. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  22. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  23. package/dist/parser/index.cjs +2 -2
  24. package/dist/parser/index.d.ts +9 -0
  25. package/dist/parser/index.js +537 -251
  26. package/dist/parser/registry.d.ts +8 -1
  27. package/dist/parser/title.d.ts +27 -0
  28. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  29. package/dist/renderers/index.cjs +1 -1
  30. package/dist/renderers/index.d.ts +1 -0
  31. package/dist/renderers/index.js +641 -354
  32. package/dist/renderers/style.css +1 -1
  33. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  34. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  35. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  36. package/dist/right-panel/icons.d.ts +48 -0
  37. package/dist/right-panel/index.cjs +2 -0
  38. package/dist/right-panel/index.d.ts +43 -0
  39. package/dist/right-panel/index.js +1004 -0
  40. package/dist/right-panel/panels/index.d.ts +7 -0
  41. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  42. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  43. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  44. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  45. package/dist/right-panel/panels/web/index.d.ts +4 -0
  46. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  47. package/dist/right-panel/registry.d.ts +24 -0
  48. package/dist/right-panel/runtime.d.ts +45 -0
  49. package/dist/right-panel/scope.d.ts +34 -0
  50. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  51. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  52. package/dist/right-panel/style.css +1 -0
  53. package/dist/right-panel/types.d.ts +363 -0
  54. package/dist/right-panel/useRightPanel.d.ts +39 -0
  55. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  56. package/dist/tools/index.cjs +4 -4
  57. package/dist/tools/index.d.ts +1 -1
  58. package/dist/tools/index.js +200 -165
  59. package/dist/tools/markdown/index.d.ts +1 -1
  60. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  61. package/dist/tools/useAutoScroll.d.ts +11 -3
  62. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  63. package/dist/web-ui/chat/ChatContainer.vue.d.ts +3 -3
  64. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  65. package/dist/web-ui/index.cjs +1 -1
  66. package/dist/web-ui/index.d.ts +1 -1
  67. package/dist/web-ui/index.js +403 -392
  68. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  69. package/dist/web-ui/style.css +1 -1
  70. package/package.json +13 -6
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
 
2
2
  export { AuthExpiredError, isCancelError, createRequest, pwdEncrypt, login, createChatApi, fileToBase64, formDataToJson, buildChatWsUrl, resolveMessageData, sendPayloadInChunks, openChatWebSocketStream } from 'wi-chat/request';
3
3
  export type { RequestOptions, RequestClient, LoginParams, LoginResult, HistoryGroup, HistoryGroupsResult, HistoryDetailItem, AgentEntryItem, ChatApi, FileJsonValue, ChatWsStreamOptions, WsChunkSender } from 'wi-chat/request';
4
- export { normalizeAnswer, applyAnswerChunk, normalizeAnswerReport, RoleEnum, nextLocalMessageId, parseSseLine, createLineSplitter, consumeStream, IMAGE_EXTENSIONS, formatFileSize, isImageAttachment, resolveRemoteFileUrl, resolveAttachDownloadUrl, resolveAttachPreviewUrl, parseRealtimeAttachment, parseHistoryAttachment, extractHistoryAttachments, normalizeAttachment, createEmptyAnswerValues, applyKnowledgeStreamChunk, normalizeKnowledgeStreamReport, knowledgeStreamParser, IFRAME_RESIZER_CHILD_SCRIPT, injectIframeResizerScript, applyIframePageChunk, normalizeIframePageReport, iframePageParser, RECORDSET_ANSWER_TYPE, readRecordsetPayload, applyRecordsetChunk, normalizeRecordsetReport, recordsetParser, OUTPUT_FILE_ANSWER_TYPE, readOutputFilePayload, applyOutputFileChunk, normalizeOutputFileReport, outputFileParser, applyDeepThinkingChunk, collectDeepThinkingSteps, collectThinkingSteps, deepThinkingParser, extractAttachmentsFromHistory, getHistoryGroups, createHistoryGroup, deleteHistoryGroup, setHistoryGroupTitle, loadGroupMessages, loadGroupMessagesByStep } from 'wi-chat/parser';
5
- export type { AiAnswerReport, AiAnswerValues, AnswerParser, AnswerParseOptions, Role, UserMessage, AssistantMessage, Message, StreamChunk, LineSplitter, ChatAttachment, FileAttachContent, AttachmentType, KnowledgeStreamValue, BeforeKnowledgeRender, KnowledgeRenderOptions, IframePageValue, RecordsetColumn, RecordsetValue, OutputFileValue, ExecProcessItem, GroupMessagesProgress } from 'wi-chat/parser';
4
+ export { normalizeAnswer, applyAnswerChunk, normalizeAnswerReport, RoleEnum, nextLocalMessageId, parseSseLine, createLineSplitter, consumeStream, IMAGE_EXTENSIONS, formatFileSize, isImageAttachment, resolveRemoteFileUrl, resolveAttachDownloadUrl, resolveAttachPreviewUrl, parseRealtimeAttachment, parseHistoryAttachment, extractHistoryAttachments, normalizeAttachment, createEmptyAnswerValues, applyKnowledgeStreamChunk, normalizeKnowledgeStreamReport, knowledgeStreamParser, IFRAME_RESIZER_CHILD_SCRIPT, injectIframeResizerScript, applyIframePageChunk, normalizeIframePageReport, iframePageParser, RECORDSET_ANSWER_TYPE, readRecordsetPayload, applyRecordsetChunk, normalizeRecordsetReport, recordsetParser, OUTPUT_FILE_ANSWER_TYPE, readOutputFilePayload, applyOutputFileChunk, normalizeOutputFileReport, outputFileParser, ACTION_EXECUTE_ANSWER_TYPE, applyActionExecuteChunk, normalizeActionExecuteReport, actionExecuteParser, createFailureResult, normalizeActionResult, parseActionExecuteCommand, wrapActionFrame, normalizeActionDefinition, parseClarificationArguments, nextClarificationRequestId, registerClarification, hasPendingClarification, submitClarification, cancelClarification, clearPendingClarifications, applyDeepThinkingChunk, collectDeepThinkingSteps, collectThinkingSteps, deepThinkingParser, extractAttachmentsFromHistory, getHistoryGroups, createHistoryGroup, deleteHistoryGroup, setHistoryGroupTitle, loadGroupMessages, loadGroupMessagesByStep, buildChatTitle, CHAT_TITLE_MAX_LENGTH } from 'wi-chat/parser';
5
+ export type { AiAnswerReport, AiAnswerValues, AnswerParser, AnswerParseOptions, Role, UserMessage, AssistantMessage, Message, StreamChunk, LineSplitter, ChatAttachment, FileAttachContent, AttachmentType, KnowledgeStreamValue, BeforeKnowledgeRender, KnowledgeRenderOptions, IframePageValue, RecordsetColumn, RecordsetValue, OutputFileValue, ExecProcessItem, GroupMessagesProgress, ActionExecutor, ActionDefinition, ActionExecuteCommand, ActionResult, WaitReplyPayload, FrontReplyOptions, ParsedClarificationArguments, ClarificationInputType, ClarificationAnswerMode, ClarificationOption, ClarificationBinding, ClarificationInput, ClarificationItem, ClarificationAnswer, ClarificationStatus, ClarificationViewModel } from 'wi-chat/parser';
6
+ export { PAGE_CONTEXT_EXT_ARGS_KEY, PAGE_CONTEXT_SCHEMA_VERSION, createPageContext, toPageContextExtArgs, parsePageContextExtArgs, isAgentPageContext, AGENT_TABLE_STATE_ROW_LIMIT, normalizeAgentPageState } from 'wi-chat/page-context';
7
+ export type { PageContextExtArgs, CreatePageContextOptions, AgentSchemaBase, AgentStringSchemaOption, AgentStringSchema, AgentNumberSchema, AgentBooleanSchema, AgentParameterSchema, AgentSchemaProperties, AgentObjectSchema, AgentArraySchema, AgentActionExecution, AgentAction, AgentNavigationScalarSchema, AgentNavigationArraySchema, AgentNavigationValueSchema, AgentNavigationSchemaProperties, AgentNavigationObjectSchema, AgentNavigationParameterSchemas, AgentRouteNavigationMeta, AgentNavigationParameterValues, AgentMenu, AgentNavigationContext, AgentTableColumnType, AgentTableColumn, AgentTableStateInput, AgentTableState, AgentPageState, AgentPageContext } from 'wi-chat/page-context';
6
8
  export { DEFAULT_PRIMARY, createChatTheme, applyTheme } from 'wi-chat/theme';
7
9
  export type { ChatThemeOptions, ChatThemeTokens } from 'wi-chat/theme';
8
10
  export { useChat, useHistory, useAgent, useChatSession } from 'wi-chat/core';
9
11
  export type { SubmitQuestionOptions, UseChatOptions, UseChatReturn, UseHistoryOptions, UseHistoryReturn, UseAgentOptions, UseAgentReturn, UseChatSessionAgentOptions, UseChatSessionChatOptions, UseChatSessionErrorScope, UseChatSessionHistoryOptions, UseChatSessionOptions, UseChatSessionReturn } from 'wi-chat/core';
10
- export { renderMarkdown, openImagePreview, closeImagePreview, downloadAttachment, useAutoScroll } from 'wi-chat/tools';
12
+ export { renderMarkdown, createStyleScope, openImagePreview, closeImagePreview, downloadAttachment, useAutoScroll } from 'wi-chat/tools';
11
13
  export type { MarkdownRenderOptions, DownloadAttachmentOptions, OnReachTopOptions, UseAutoScrollReturn } from 'wi-chat/tools';
package/dist/index.js CHANGED
@@ -1,81 +1,109 @@
1
1
  import "wi-chat/style.css";
2
- import { AuthExpiredError as a, buildChatWsUrl as o, createChatApi as s, createRequest as l, fileToBase64 as n, formDataToJson as p, isCancelError as i, login as m, openChatWebSocketStream as c, pwdEncrypt as u, resolveMessageData as h, sendPayloadInChunks as d } from "wi-chat/request";
3
- import { IFRAME_RESIZER_CHILD_SCRIPT as R, IMAGE_EXTENSIONS as S, OUTPUT_FILE_ANSWER_TYPE as y, RECORDSET_ANSWER_TYPE as g, RoleEnum as E, applyAnswerChunk as P, applyDeepThinkingChunk as C, applyIframePageChunk as T, applyKnowledgeStreamChunk as I, applyOutputFileChunk as k, applyRecordsetChunk as w, collectDeepThinkingSteps as f, collectThinkingSteps as F, consumeStream as _, createEmptyAnswerValues as x, createHistoryGroup as z, createLineSplitter as H, deepThinkingParser as D, deleteHistoryGroup as M, extractAttachmentsFromHistory as v, extractHistoryAttachments as G, formatFileSize as U, getHistoryGroups as L, iframePageParser as O, injectIframeResizerScript as N, isImageAttachment as W, knowledgeStreamParser as Y, loadGroupMessages as b, loadGroupMessagesByStep as B, nextLocalMessageId as K, normalizeAnswer as j, normalizeAnswerReport as q, normalizeAttachment as J, normalizeIframePageReport as V, normalizeKnowledgeStreamReport as X, normalizeOutputFileReport as Z, normalizeRecordsetReport as Q, outputFileParser as $, parseHistoryAttachment as ee, parseRealtimeAttachment as re, parseSseLine as te, readOutputFilePayload as ae, readRecordsetPayload as oe, recordsetParser as se, resolveAttachDownloadUrl as le, resolveAttachPreviewUrl as ne, resolveRemoteFileUrl as pe, setHistoryGroupTitle as ie } from "wi-chat/parser";
4
- import { DEFAULT_PRIMARY as ce, applyTheme as ue, createChatTheme as he } from "wi-chat/theme";
5
- import { useAgent as Ae, useChat as Re, useChatSession as Se, useHistory as ye } from "wi-chat/core";
6
- import { closeImagePreview as Ee, downloadAttachment as Pe, openImagePreview as Ce, renderMarkdown as Te, useAutoScroll as Ie } from "wi-chat/tools";
2
+ import { AuthExpiredError as a, buildChatWsUrl as o, createChatApi as i, createRequest as n, fileToBase64 as s, formDataToJson as l, isCancelError as p, login as c, openChatWebSocketStream as m, pwdEncrypt as u, resolveMessageData as A, sendPayloadInChunks as E } from "wi-chat/request";
3
+ import { ACTION_EXECUTE_ANSWER_TYPE as T, CHAT_TITLE_MAX_LENGTH as g, IFRAME_RESIZER_CHILD_SCRIPT as h, IMAGE_EXTENSIONS as d, OUTPUT_FILE_ANSWER_TYPE as R, RECORDSET_ANSWER_TYPE as P, RoleEnum as S, actionExecuteParser as _, applyActionExecuteChunk as y, applyAnswerChunk as I, applyDeepThinkingChunk as f, applyIframePageChunk as x, applyKnowledgeStreamChunk as k, applyOutputFileChunk as w, applyRecordsetChunk as z, buildChatTitle as F, cancelClarification as G, clearPendingClarifications as H, collectDeepThinkingSteps as M, collectThinkingSteps as N, consumeStream as O, createEmptyAnswerValues as L, createFailureResult as D, createHistoryGroup as U, createLineSplitter as v, deepThinkingParser as W, deleteHistoryGroup as X, extractAttachmentsFromHistory as Y, extractHistoryAttachments as b, formatFileSize as B, getHistoryGroups as K, hasPendingClarification as q, iframePageParser as V, injectIframeResizerScript as j, isImageAttachment as J, knowledgeStreamParser as Z, loadGroupMessages as Q, loadGroupMessagesByStep as $, nextClarificationRequestId as ee, nextLocalMessageId as te, normalizeActionDefinition as re, normalizeActionExecuteReport as ae, normalizeActionResult as oe, normalizeAnswer as ie, normalizeAnswerReport as ne, normalizeAttachment as se, normalizeIframePageReport as le, normalizeKnowledgeStreamReport as pe, normalizeOutputFileReport as ce, normalizeRecordsetReport as me, outputFileParser as ue, parseActionExecuteCommand as Ae, parseClarificationArguments as Ee, parseHistoryAttachment as Ce, parseRealtimeAttachment as Te, parseSseLine as ge, readOutputFilePayload as he, readRecordsetPayload as de, recordsetParser as Re, registerClarification as Pe, resolveAttachDownloadUrl as Se, resolveAttachPreviewUrl as _e, resolveRemoteFileUrl as ye, setHistoryGroupTitle as Ie, submitClarification as fe, wrapActionFrame as xe } from "wi-chat/parser";
4
+ import { AGENT_TABLE_STATE_ROW_LIMIT as we, PAGE_CONTEXT_EXT_ARGS_KEY as ze, PAGE_CONTEXT_SCHEMA_VERSION as Fe, createPageContext as Ge, isAgentPageContext as He, normalizeAgentPageState as Me, parsePageContextExtArgs as Ne, toPageContextExtArgs as Oe } from "wi-chat/page-context";
5
+ import { DEFAULT_PRIMARY as De, applyTheme as Ue, createChatTheme as ve } from "wi-chat/theme";
6
+ import { useAgent as Xe, useChat as Ye, useChatSession as be, useHistory as Be } from "wi-chat/core";
7
+ import { closeImagePreview as qe, createStyleScope as Ve, downloadAttachment as je, openImagePreview as Je, renderMarkdown as Ze, useAutoScroll as Qe } from "wi-chat/tools";
7
8
  export {
9
+ T as ACTION_EXECUTE_ANSWER_TYPE,
10
+ we as AGENT_TABLE_STATE_ROW_LIMIT,
8
11
  a as AuthExpiredError,
9
- ce as DEFAULT_PRIMARY,
10
- R as IFRAME_RESIZER_CHILD_SCRIPT,
11
- S as IMAGE_EXTENSIONS,
12
- y as OUTPUT_FILE_ANSWER_TYPE,
13
- g as RECORDSET_ANSWER_TYPE,
14
- E as RoleEnum,
15
- P as applyAnswerChunk,
16
- C as applyDeepThinkingChunk,
17
- T as applyIframePageChunk,
18
- I as applyKnowledgeStreamChunk,
19
- k as applyOutputFileChunk,
20
- w as applyRecordsetChunk,
21
- ue as applyTheme,
12
+ g as CHAT_TITLE_MAX_LENGTH,
13
+ De as DEFAULT_PRIMARY,
14
+ h as IFRAME_RESIZER_CHILD_SCRIPT,
15
+ d as IMAGE_EXTENSIONS,
16
+ R as OUTPUT_FILE_ANSWER_TYPE,
17
+ ze as PAGE_CONTEXT_EXT_ARGS_KEY,
18
+ Fe as PAGE_CONTEXT_SCHEMA_VERSION,
19
+ P as RECORDSET_ANSWER_TYPE,
20
+ S as RoleEnum,
21
+ _ as actionExecuteParser,
22
+ y as applyActionExecuteChunk,
23
+ I as applyAnswerChunk,
24
+ f as applyDeepThinkingChunk,
25
+ x as applyIframePageChunk,
26
+ k as applyKnowledgeStreamChunk,
27
+ w as applyOutputFileChunk,
28
+ z as applyRecordsetChunk,
29
+ Ue as applyTheme,
30
+ F as buildChatTitle,
22
31
  o as buildChatWsUrl,
23
- Ee as closeImagePreview,
24
- f as collectDeepThinkingSteps,
25
- F as collectThinkingSteps,
26
- _ as consumeStream,
27
- s as createChatApi,
28
- he as createChatTheme,
29
- x as createEmptyAnswerValues,
30
- z as createHistoryGroup,
31
- H as createLineSplitter,
32
- l as createRequest,
33
- D as deepThinkingParser,
34
- M as deleteHistoryGroup,
35
- Pe as downloadAttachment,
36
- v as extractAttachmentsFromHistory,
37
- G as extractHistoryAttachments,
38
- n as fileToBase64,
39
- p as formDataToJson,
40
- U as formatFileSize,
41
- L as getHistoryGroups,
42
- O as iframePageParser,
43
- N as injectIframeResizerScript,
44
- i as isCancelError,
45
- W as isImageAttachment,
46
- Y as knowledgeStreamParser,
47
- b as loadGroupMessages,
48
- B as loadGroupMessagesByStep,
49
- m as login,
50
- K as nextLocalMessageId,
51
- j as normalizeAnswer,
52
- q as normalizeAnswerReport,
53
- J as normalizeAttachment,
54
- V as normalizeIframePageReport,
55
- X as normalizeKnowledgeStreamReport,
56
- Z as normalizeOutputFileReport,
57
- Q as normalizeRecordsetReport,
58
- c as openChatWebSocketStream,
59
- Ce as openImagePreview,
60
- $ as outputFileParser,
61
- ee as parseHistoryAttachment,
62
- re as parseRealtimeAttachment,
63
- te as parseSseLine,
32
+ G as cancelClarification,
33
+ H as clearPendingClarifications,
34
+ qe as closeImagePreview,
35
+ M as collectDeepThinkingSteps,
36
+ N as collectThinkingSteps,
37
+ O as consumeStream,
38
+ i as createChatApi,
39
+ ve as createChatTheme,
40
+ L as createEmptyAnswerValues,
41
+ D as createFailureResult,
42
+ U as createHistoryGroup,
43
+ v as createLineSplitter,
44
+ Ge as createPageContext,
45
+ n as createRequest,
46
+ Ve as createStyleScope,
47
+ W as deepThinkingParser,
48
+ X as deleteHistoryGroup,
49
+ je as downloadAttachment,
50
+ Y as extractAttachmentsFromHistory,
51
+ b as extractHistoryAttachments,
52
+ s as fileToBase64,
53
+ l as formDataToJson,
54
+ B as formatFileSize,
55
+ K as getHistoryGroups,
56
+ q as hasPendingClarification,
57
+ V as iframePageParser,
58
+ j as injectIframeResizerScript,
59
+ He as isAgentPageContext,
60
+ p as isCancelError,
61
+ J as isImageAttachment,
62
+ Z as knowledgeStreamParser,
63
+ Q as loadGroupMessages,
64
+ $ as loadGroupMessagesByStep,
65
+ c as login,
66
+ ee as nextClarificationRequestId,
67
+ te as nextLocalMessageId,
68
+ re as normalizeActionDefinition,
69
+ ae as normalizeActionExecuteReport,
70
+ oe as normalizeActionResult,
71
+ Me as normalizeAgentPageState,
72
+ ie as normalizeAnswer,
73
+ ne as normalizeAnswerReport,
74
+ se as normalizeAttachment,
75
+ le as normalizeIframePageReport,
76
+ pe as normalizeKnowledgeStreamReport,
77
+ ce as normalizeOutputFileReport,
78
+ me as normalizeRecordsetReport,
79
+ m as openChatWebSocketStream,
80
+ Je as openImagePreview,
81
+ ue as outputFileParser,
82
+ Ae as parseActionExecuteCommand,
83
+ Ee as parseClarificationArguments,
84
+ Ce as parseHistoryAttachment,
85
+ Ne as parsePageContextExtArgs,
86
+ Te as parseRealtimeAttachment,
87
+ ge as parseSseLine,
64
88
  u as pwdEncrypt,
65
- ae as readOutputFilePayload,
66
- oe as readRecordsetPayload,
67
- se as recordsetParser,
68
- Te as renderMarkdown,
69
- le as resolveAttachDownloadUrl,
70
- ne as resolveAttachPreviewUrl,
71
- h as resolveMessageData,
72
- pe as resolveRemoteFileUrl,
73
- d as sendPayloadInChunks,
74
- ie as setHistoryGroupTitle,
75
- Ae as useAgent,
76
- Ie as useAutoScroll,
77
- Re as useChat,
78
- Se as useChatSession,
79
- ye as useHistory
89
+ he as readOutputFilePayload,
90
+ de as readRecordsetPayload,
91
+ Re as recordsetParser,
92
+ Pe as registerClarification,
93
+ Ze as renderMarkdown,
94
+ Se as resolveAttachDownloadUrl,
95
+ _e as resolveAttachPreviewUrl,
96
+ A as resolveMessageData,
97
+ ye as resolveRemoteFileUrl,
98
+ E as sendPayloadInChunks,
99
+ Ie as setHistoryGroupTitle,
100
+ fe as submitClarification,
101
+ Oe as toPageContextExtArgs,
102
+ Xe as useAgent,
103
+ Qe as useAutoScroll,
104
+ Ye as useChat,
105
+ be as useChatSession,
106
+ Be as useHistory,
107
+ xe as wrapActionFrame
80
108
  };
81
109
  //# sourceMappingURL=index.js.map
@@ -89,14 +89,14 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
89
89
  onStop?: () => any;
90
90
  "onUpdate:question"?: (value: string) => any;
91
91
  }, {
92
- parsers: AnswerParser<any>[];
92
+ placeholder: string;
93
93
  question: string;
94
+ parsers: AnswerParser<any>[];
94
95
  loading: boolean;
96
+ disabled: boolean;
95
97
  messages: Message[];
96
98
  emptyTitle: string;
97
99
  emptyDescription: string;
98
- placeholder: string;
99
- disabled: boolean;
100
100
  talking: boolean;
101
101
  session: string;
102
102
  hasMore: boolean;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("wi-chat/renderers"),e=require("vue"),B=require("vant"),I=require("wi-chat/tools"),S={class:"wi-mobile-inputbox"},T=e.defineComponent({__name:"Inputbox",props:{modelValue:{default:""},placeholder:{default:"请输入问题(Enter 发送)"},disabled:{type:Boolean,default:!1},disabledSend:{type:Boolean,default:!1},enterExact:{type:Boolean,default:!0},submitText:{default:"发送"},stopText:{default:"停止"},talking:{type:Boolean,default:!1},buttonType:{default:"primary"}},emits:["update:modelValue","submit","stop"],setup(r,{emit:u}){const a=r,o=u,i=()=>{if(a.talking){o("stop");return}a.disabled||a.disabledSend||o("submit")},m=t=>{t.isComposing||t.keyCode===229||!a.enterExact||a.talking||(t.preventDefault(),i())};return(t,l)=>(e.openBlock(),e.createElementBlock("div",S,[e.createVNode(e.unref(B.Field),{"model-value":t.modelValue,type:"textarea",rows:"2",autosize:"",placeholder:t.placeholder,disabled:t.disabled,"onUpdate:modelValue":l[0]||(l[0]=d=>o("update:modelValue",String(d??""))),onKeydown:e.withKeys(e.withModifiers(m,["exact"]),["enter"])},null,8,["model-value","placeholder","disabled","onKeydown"]),e.createVNode(e.unref(B.Button),{class:"wi-mobile-inputbox__btn",type:t.talking?"danger":t.buttonType,size:"small",disabled:t.disabled,onClick:i},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.talking?t.stopText:t.submitText),1)]),_:1},8,["type","disabled"])]))}}),h=(r,u)=>{const a=r.__vccOpts||r;for(const[o,i]of u)a[o]=i;return a},v=h(T,[["__scopeId","data-v-02f9c6a0"]]),V=r=>(e.pushScopeId("data-v-9400261b"),r=r(),e.popScopeId(),r),O={key:0,class:"wi-mobile-chat-messages__loading"},P={key:1,class:"wi-mobile-chat-messages__empty"},N=V(()=>e.createElementVNode("div",{class:"wi-mobile-chat-messages__empty-logo"},"WI",-1)),j={class:"wi-mobile-chat-messages__empty-title"},F={class:"wi-mobile-chat-messages__empty-description"},A={key:0,class:"wi-mobile-chat-messages__user"},D={class:"wi-mobile-chat-messages__user-wrapper"},q={key:0,class:"wi-mobile-chat-messages__attachments"},M={class:"wi-mobile-chat-messages__user-bubble"},$={key:1,class:"wi-mobile-chat-messages__assistant"},x=e.defineComponent({__name:"ChatMessagesView",props:{messages:{default:()=>[]},parsers:{default:()=>[]},outputFileConfig:{},loading:{type:Boolean,default:!1},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"}},emits:["loadOlder","updateThinkingExpanded"],setup(r,{expose:u,emit:a}){var _,w;const o=r,i=a;s.provideOutputFileConfig(o.outputFileConfig??{});const m=e.ref(),{showScrollToBottom:t,forceScrollToBottom:l,requestScrollToBottom:d,onReachTop:b}=I.useAutoScroll(m),E=e.computed(()=>s.createAnswerContentMap(o.parsers));let y=((_=o.messages[0])==null?void 0:_.id)??"",k=((w=o.messages[o.messages.length-1])==null?void 0:w.id)??"";return e.watch(()=>o.messages,()=>{var g,c;const p=((g=o.messages[0])==null?void 0:g.id)??"",f=((c=o.messages[o.messages.length-1])==null?void 0:c.id)??"",n=p!==y&&f===k;y=p,k=f,!n&&d()},{deep:!0}),b(()=>i("loadOlder")),u({forceScrollToBottom:l,requestScrollToBottom:d}),(p,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"scrollEl",ref:m,class:"wi-mobile-chat-messages"},[p.loading?(e.openBlock(),e.createElementBlock("div",O,"历史加载中...")):p.messages.length===0?(e.openBlock(),e.createElementBlock("div",P,[N,e.createElementVNode("div",j,e.toDisplayString(p.emptyTitle),1),e.createElementVNode("div",F,e.toDisplayString(p.emptyDescription),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.messages,n=>{var g;return e.openBlock(),e.createElementBlock(e.Fragment,{key:n.id},[n.role==="user"?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",D,[(g=n.attachments)!=null&&g.length?(e.openBlock(),e.createElementBlock("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.attachments,c=>(e.openBlock(),e.createElementBlock("span",{key:c.name,class:"wi-mobile-chat-messages__attachment"},e.toDisplayString(c.name),1))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",M,e.toDisplayString(n.content),1)])])):(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(s.DeepThinkingSteps),{steps:n.thinking.steps,expanded:n.thinking.expanded,"onUpdate:expanded":c=>i("updateThinkingExpanded",n,c)},null,8,["steps","expanded","onUpdate:expanded"]),e.createVNode(e.unref(s.AiAnswerBubble),{answer:n.answer,error:n.error,stopped:n.stopped,"content-map":E.value},null,8,["answer","error","stopped","content-map"])]))],64)}),128)),e.createVNode(e.Transition,{name:"wi-mobile-chat-messages-fade"},{default:e.withCtx(()=>[e.unref(t)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-mobile-chat-messages__bottom",onClick:f[0]||(f[0]=(...n)=>e.unref(l)&&e.unref(l)(...n))}," 回到底部 ")):e.createCommentVNode("",!0)]),_:1})],512))}}),C=h(x,[["__scopeId","data-v-9400261b"]]),K={class:"wi-mobile-chat-container"},R=e.defineComponent({__name:"ChatContainer",props:{messages:{default:()=>[]},parsers:{default:()=>[]},outputFileConfig:{},loading:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},session:{default:""},question:{default:""},placeholder:{default:"请输入问题,按 Enter 发送"},hasMore:{type:Boolean,default:!0},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"},disabled:{type:Boolean,default:!1}},emits:["update:question","submit","stop","loadOlder","updateThinkingExpanded"],setup(r,{emit:u}){const a=r,o=u,i=()=>{a.hasMore&&o("loadOlder")},m=()=>{o("submit",{text:a.question})};return(t,l)=>(e.openBlock(),e.createElementBlock("section",K,[e.renderSlot(t.$slots,"messages",{},()=>[e.createVNode(C,{messages:t.messages,parsers:t.parsers,"output-file-config":t.outputFileConfig,loading:t.loading,"empty-title":t.emptyTitle,"empty-description":t.emptyDescription,onLoadOlder:i,onUpdateThinkingExpanded:l[0]||(l[0]=(d,b)=>o("updateThinkingExpanded",d,b))},null,8,["messages","parsers","output-file-config","loading","empty-title","empty-description"])],!0),e.renderSlot(t.$slots,"above-input",{},void 0,!0),e.createVNode(v,{"model-value":t.question,placeholder:t.placeholder,disabled:t.disabled||!t.session,"disabled-send":!t.question.trim(),talking:t.talking,"onUpdate:modelValue":l[1]||(l[1]=d=>o("update:question",d)),onSubmit:m,onStop:l[2]||(l[2]=d=>o("stop"))},null,8,["model-value","placeholder","disabled","disabled-send","talking"])]))}}),U=h(R,[["__scopeId","data-v-9bd22d00"]]);Object.defineProperty(exports,"AiAnswerBubble",{enumerable:!0,get:()=>s.AiAnswerBubble});Object.defineProperty(exports,"DeepThinkingSteps",{enumerable:!0,get:()=>s.DeepThinkingSteps});Object.defineProperty(exports,"IframePage",{enumerable:!0,get:()=>s.IframePage});Object.defineProperty(exports,"KnowledgeStreamResult",{enumerable:!0,get:()=>s.KnowledgeStreamResult});Object.defineProperty(exports,"OutputFile",{enumerable:!0,get:()=>s.OutputFile});Object.defineProperty(exports,"createAnswerContentMap",{enumerable:!0,get:()=>s.createAnswerContentMap});Object.defineProperty(exports,"injectIframeResizerChild",{enumerable:!0,get:()=>s.injectIframeResizerChild});Object.defineProperty(exports,"provideIframePageConfig",{enumerable:!0,get:()=>s.provideIframePageConfig});Object.defineProperty(exports,"provideOutputFileConfig",{enumerable:!0,get:()=>s.provideOutputFileConfig});Object.defineProperty(exports,"resolveIframePlaceholders",{enumerable:!0,get:()=>s.resolveIframePlaceholders});Object.defineProperty(exports,"useIframePage",{enumerable:!0,get:()=>s.useIframePage});exports.ChatContainer=U;exports.ChatMessagesView=C;exports.Inputbox=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("wi-chat/renderers"),e=require("vue"),B=require("vant"),I=require("wi-chat/tools"),T={class:"wi-mobile-inputbox"},V=e.defineComponent({__name:"Inputbox",props:{modelValue:{default:""},placeholder:{default:"请输入问题(Enter 发送)"},disabled:{type:Boolean,default:!1},disabledSend:{type:Boolean,default:!1},enterExact:{type:Boolean,default:!0},submitText:{default:"发送"},stopText:{default:"停止"},talking:{type:Boolean,default:!1},buttonType:{default:"primary"}},emits:["update:modelValue","submit","stop"],setup(r,{emit:u}){const a=r,o=u,d=()=>{if(a.talking){o("stop");return}a.disabled||a.disabledSend||o("submit")},m=t=>{t.isComposing||t.keyCode===229||!a.enterExact||a.talking||(t.preventDefault(),d())};return(t,l)=>(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(e.unref(B.Field),{"model-value":t.modelValue,type:"textarea",rows:"2",autosize:"",placeholder:t.placeholder,disabled:t.disabled,"onUpdate:modelValue":l[0]||(l[0]=p=>o("update:modelValue",String(p??""))),onKeydown:e.withKeys(e.withModifiers(m,["exact"]),["enter"])},null,8,["model-value","placeholder","disabled","onKeydown"]),e.createVNode(e.unref(B.Button),{class:"wi-mobile-inputbox__btn",type:t.talking?"danger":t.buttonType,size:"small",disabled:t.disabled,onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.talking?t.stopText:t.submitText),1)]),_:1},8,["type","disabled"])]))}}),h=(r,u)=>{const a=r.__vccOpts||r;for(const[o,d]of u)a[o]=d;return a},v=h(V,[["__scopeId","data-v-02f9c6a0"]]),O=r=>(e.pushScopeId("data-v-04e966f6"),r=r(),e.popScopeId(),r),P={key:0,class:"wi-mobile-chat-messages__loading"},N={key:1,class:"wi-mobile-chat-messages__empty"},j=O(()=>e.createElementVNode("div",{class:"wi-mobile-chat-messages__empty-logo"},"WI",-1)),F={class:"wi-mobile-chat-messages__empty-title"},A={class:"wi-mobile-chat-messages__empty-description"},D={key:0,class:"wi-mobile-chat-messages__user"},q={class:"wi-mobile-chat-messages__user-wrapper"},M={key:0,class:"wi-mobile-chat-messages__attachments"},$={class:"wi-mobile-chat-messages__user-bubble"},x={key:1,class:"wi-mobile-chat-messages__assistant"},K=e.defineComponent({__name:"ChatMessagesView",props:{messages:{default:()=>[]},parsers:{default:()=>[]},outputFileConfig:{},loading:{type:Boolean,default:!1},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"}},emits:["loadOlder","updateThinkingExpanded"],setup(r,{expose:u,emit:a}){var _,w;const o=r,d=a;n.provideOutputFileConfig(o.outputFileConfig??{});const m=e.ref(),{showScrollToBottom:t,forceScrollToBottom:l,requestScrollToBottom:p,resetScrollState:b,onReachTop:E}=I.useAutoScroll(m),S=e.computed(()=>n.createAnswerContentMap(o.parsers));e.watch(()=>o.messages.length===0,i=>{i&&b()});let y=((_=o.messages[0])==null?void 0:_.id)??"",k=((w=o.messages[o.messages.length-1])==null?void 0:w.id)??"";return e.watch(()=>o.messages,()=>{var g,c;const i=((g=o.messages[0])==null?void 0:g.id)??"",f=((c=o.messages[o.messages.length-1])==null?void 0:c.id)??"",s=i!==y&&f===k;y=i,k=f,!s&&p()},{deep:!0}),E(()=>d("loadOlder")),u({forceScrollToBottom:l,requestScrollToBottom:p}),(i,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"scrollEl",ref:m,class:"wi-mobile-chat-messages"},[i.loading?(e.openBlock(),e.createElementBlock("div",P,"历史加载中...")):i.messages.length===0?(e.openBlock(),e.createElementBlock("div",N,[j,e.createElementVNode("div",F,e.toDisplayString(i.emptyTitle),1),e.createElementVNode("div",A,e.toDisplayString(i.emptyDescription),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.messages,s=>{var g;return e.openBlock(),e.createElementBlock(e.Fragment,{key:s.id},[s.role==="user"?(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("div",q,[(g=s.attachments)!=null&&g.length?(e.openBlock(),e.createElementBlock("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.attachments,c=>(e.openBlock(),e.createElementBlock("span",{key:c.name,class:"wi-mobile-chat-messages__attachment"},e.toDisplayString(c.name),1))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",$,e.toDisplayString(s.content),1)])])):(e.openBlock(),e.createElementBlock("div",x,[e.createVNode(e.unref(n.DeepThinkingSteps),{steps:s.thinking.steps,expanded:s.thinking.expanded,"onUpdate:expanded":c=>d("updateThinkingExpanded",s,c)},null,8,["steps","expanded","onUpdate:expanded"]),e.createVNode(e.unref(n.AiAnswerBubble),{answer:s.answer,error:s.error,stopped:s.stopped,"content-map":S.value},null,8,["answer","error","stopped","content-map"])]))],64)}),128)),e.createVNode(e.Transition,{name:"wi-mobile-chat-messages-fade"},{default:e.withCtx(()=>[e.unref(t)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-mobile-chat-messages__bottom",onClick:f[0]||(f[0]=(...s)=>e.unref(l)&&e.unref(l)(...s))}," 回到底部 ")):e.createCommentVNode("",!0)]),_:1})],512))}}),C=h(K,[["__scopeId","data-v-04e966f6"]]),R={class:"wi-mobile-chat-container"},U=e.defineComponent({__name:"ChatContainer",props:{messages:{default:()=>[]},parsers:{default:()=>[]},outputFileConfig:{},loading:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},session:{default:""},question:{default:""},placeholder:{default:"请输入问题,按 Enter 发送"},hasMore:{type:Boolean,default:!0},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"},disabled:{type:Boolean,default:!1}},emits:["update:question","submit","stop","loadOlder","updateThinkingExpanded"],setup(r,{emit:u}){const a=r,o=u,d=()=>{a.hasMore&&o("loadOlder")},m=()=>{o("submit",{text:a.question})};return(t,l)=>(e.openBlock(),e.createElementBlock("section",R,[e.renderSlot(t.$slots,"messages",{},()=>[e.createVNode(C,{messages:t.messages,parsers:t.parsers,"output-file-config":t.outputFileConfig,loading:t.loading,"empty-title":t.emptyTitle,"empty-description":t.emptyDescription,onLoadOlder:d,onUpdateThinkingExpanded:l[0]||(l[0]=(p,b)=>o("updateThinkingExpanded",p,b))},null,8,["messages","parsers","output-file-config","loading","empty-title","empty-description"])],!0),e.renderSlot(t.$slots,"above-input",{},void 0,!0),e.createVNode(v,{"model-value":t.question,placeholder:t.placeholder,disabled:t.disabled||!t.session,"disabled-send":!t.question.trim(),talking:t.talking,"onUpdate:modelValue":l[1]||(l[1]=p=>o("update:question",p)),onSubmit:m,onStop:l[2]||(l[2]=p=>o("stop"))},null,8,["model-value","placeholder","disabled","disabled-send","talking"])]))}}),z=h(U,[["__scopeId","data-v-9bd22d00"]]);Object.defineProperty(exports,"AiAnswerBubble",{enumerable:!0,get:()=>n.AiAnswerBubble});Object.defineProperty(exports,"ClarificationCard",{enumerable:!0,get:()=>n.ClarificationCard});Object.defineProperty(exports,"DeepThinkingSteps",{enumerable:!0,get:()=>n.DeepThinkingSteps});Object.defineProperty(exports,"IframePage",{enumerable:!0,get:()=>n.IframePage});Object.defineProperty(exports,"KnowledgeStreamResult",{enumerable:!0,get:()=>n.KnowledgeStreamResult});Object.defineProperty(exports,"OutputFile",{enumerable:!0,get:()=>n.OutputFile});Object.defineProperty(exports,"createAnswerContentMap",{enumerable:!0,get:()=>n.createAnswerContentMap});Object.defineProperty(exports,"injectIframeResizerChild",{enumerable:!0,get:()=>n.injectIframeResizerChild});Object.defineProperty(exports,"provideIframePageConfig",{enumerable:!0,get:()=>n.provideIframePageConfig});Object.defineProperty(exports,"provideOutputFileConfig",{enumerable:!0,get:()=>n.provideOutputFileConfig});Object.defineProperty(exports,"resolveIframePlaceholders",{enumerable:!0,get:()=>n.resolveIframePlaceholders});Object.defineProperty(exports,"useIframePage",{enumerable:!0,get:()=>n.useIframePage});exports.ChatContainer=z;exports.ChatMessagesView=C;exports.Inputbox=v;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -3,5 +3,5 @@ export { default as Inputbox } from './inputbox/Inputbox.vue';
3
3
  export { default as ChatMessagesView } from './chat/ChatMessagesView.vue';
4
4
  export { default as ChatContainer } from './chat/ChatContainer.vue';
5
5
  export type { ChatSubmitPayload } from './chat/types';
6
- export { AiAnswerBubble, createAnswerContentMap, DeepThinkingSteps, IframePage, injectIframeResizerChild, KnowledgeStreamResult, OutputFile, provideIframePageConfig, provideOutputFileConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
6
+ export { AiAnswerBubble, ClarificationCard, createAnswerContentMap, DeepThinkingSteps, IframePage, injectIframeResizerChild, KnowledgeStreamResult, OutputFile, provideIframePageConfig, provideOutputFileConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
7
7
  export type { AnswerContentMap, IframePageConfig, OutputFileConfig, OutputFilePreviewKind, OutputFilePreviewRequest, UseIframePageReturn, } from 'wi-chat/renderers';
@@ -1,9 +1,9 @@
1
- import { provideOutputFileConfig as D, createAnswerContentMap as M, DeepThinkingSteps as q, AiAnswerBubble as $ } from "wi-chat/renderers";
2
- import { AiAnswerBubble as we, DeepThinkingSteps as ke, IframePage as ve, KnowledgeStreamResult as Ce, OutputFile as Te, createAnswerContentMap as Ie, injectIframeResizerChild as Be, provideIframePageConfig as Se, provideOutputFileConfig as Ee, resolveIframePlaceholders as Ve, useIframePage as Ae } from "wi-chat/renderers";
3
- import { defineComponent as C, openBlock as n, createElementBlock as i, createVNode as f, unref as c, withKeys as x, withModifiers as P, withCtx as F, createTextVNode as U, toDisplayString as y, ref as K, computed as N, watch as z, createElementVNode as _, createCommentVNode as k, Fragment as v, renderList as V, Transition as L, pushScopeId as R, popScopeId as j, renderSlot as A } from "vue";
4
- import { Field as W, Button as G } from "vant";
5
- import { useAutoScroll as H } from "wi-chat/tools";
6
- const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
1
+ import { provideOutputFileConfig as q, createAnswerContentMap as $, DeepThinkingSteps as x, AiAnswerBubble as P } from "wi-chat/renderers";
2
+ import { AiAnswerBubble as ke, ClarificationCard as ve, DeepThinkingSteps as Ce, IframePage as Te, KnowledgeStreamResult as Ie, OutputFile as Se, createAnswerContentMap as Be, injectIframeResizerChild as Ee, provideIframePageConfig as Ve, provideOutputFileConfig as Ae, resolveIframePlaceholders as Fe, useIframePage as Oe } from "wi-chat/renderers";
3
+ import { defineComponent as C, openBlock as i, createElementBlock as n, createVNode as f, unref as c, withKeys as U, withModifiers as K, withCtx as O, createTextVNode as N, toDisplayString as y, ref as z, computed as L, watch as V, createElementVNode as _, createCommentVNode as k, Fragment as v, renderList as A, Transition as R, pushScopeId as j, popScopeId as W, renderSlot as F } from "vue";
4
+ import { Field as G, Button as H } from "vant";
5
+ import { useAutoScroll as J } from "wi-chat/tools";
6
+ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
7
7
  __name: "Inputbox",
8
8
  props: {
9
9
  modelValue: { default: "" },
@@ -18,35 +18,35 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
18
18
  },
19
19
  emits: ["update:modelValue", "submit", "stop"],
20
20
  setup(l, { emit: u }) {
21
- const o = l, t = u, d = () => {
21
+ const o = l, t = u, r = () => {
22
22
  if (o.talking) {
23
23
  t("stop");
24
24
  return;
25
25
  }
26
26
  o.disabled || o.disabledSend || t("submit");
27
27
  }, g = (e) => {
28
- e.isComposing || e.keyCode === 229 || !o.enterExact || o.talking || (e.preventDefault(), d());
28
+ e.isComposing || e.keyCode === 229 || !o.enterExact || o.talking || (e.preventDefault(), r());
29
29
  };
30
- return (e, a) => (n(), i("div", J, [
31
- f(c(W), {
30
+ return (e, a) => (i(), n("div", Q, [
31
+ f(c(G), {
32
32
  "model-value": e.modelValue,
33
33
  type: "textarea",
34
34
  rows: "2",
35
35
  autosize: "",
36
36
  placeholder: e.placeholder,
37
37
  disabled: e.disabled,
38
- "onUpdate:modelValue": a[0] || (a[0] = (r) => t("update:modelValue", String(r ?? ""))),
39
- onKeydown: x(P(g, ["exact"]), ["enter"])
38
+ "onUpdate:modelValue": a[0] || (a[0] = (p) => t("update:modelValue", String(p ?? ""))),
39
+ onKeydown: U(K(g, ["exact"]), ["enter"])
40
40
  }, null, 8, ["model-value", "placeholder", "disabled", "onKeydown"]),
41
- f(c(G), {
41
+ f(c(H), {
42
42
  class: "wi-mobile-inputbox__btn",
43
43
  type: e.talking ? "danger" : e.buttonType,
44
44
  size: "small",
45
45
  disabled: e.disabled,
46
- onClick: d
46
+ onClick: r
47
47
  }, {
48
- default: F(() => [
49
- U(y(e.talking ? e.stopText : e.submitText), 1)
48
+ default: O(() => [
49
+ N(y(e.talking ? e.stopText : e.submitText), 1)
50
50
  ]),
51
51
  _: 1
52
52
  }, 8, ["type", "disabled"])
@@ -54,25 +54,25 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
54
54
  }
55
55
  }), T = (l, u) => {
56
56
  const o = l.__vccOpts || l;
57
- for (const [t, d] of u)
58
- o[t] = d;
57
+ for (const [t, r] of u)
58
+ o[t] = r;
59
59
  return o;
60
- }, X = /* @__PURE__ */ T(Q, [["__scopeId", "data-v-02f9c6a0"]]), Y = (l) => (R("data-v-9400261b"), l = l(), j(), l), Z = {
60
+ }, Y = /* @__PURE__ */ T(X, [["__scopeId", "data-v-02f9c6a0"]]), Z = (l) => (j("data-v-04e966f6"), l = l(), W(), l), ee = {
61
61
  key: 0,
62
62
  class: "wi-mobile-chat-messages__loading"
63
- }, ee = {
63
+ }, te = {
64
64
  key: 1,
65
65
  class: "wi-mobile-chat-messages__empty"
66
- }, te = /* @__PURE__ */ Y(() => /* @__PURE__ */ _("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)), se = { class: "wi-mobile-chat-messages__empty-title" }, oe = { class: "wi-mobile-chat-messages__empty-description" }, ae = {
66
+ }, se = /* @__PURE__ */ Z(() => /* @__PURE__ */ _("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)), oe = { class: "wi-mobile-chat-messages__empty-title" }, ae = { class: "wi-mobile-chat-messages__empty-description" }, ie = {
67
67
  key: 0,
68
68
  class: "wi-mobile-chat-messages__user"
69
- }, ne = { class: "wi-mobile-chat-messages__user-wrapper" }, ie = {
69
+ }, ne = { class: "wi-mobile-chat-messages__user-wrapper" }, le = {
70
70
  key: 0,
71
71
  class: "wi-mobile-chat-messages__attachments"
72
- }, le = { class: "wi-mobile-chat-messages__user-bubble" }, de = {
72
+ }, de = { class: "wi-mobile-chat-messages__user-bubble" }, re = {
73
73
  key: 1,
74
74
  class: "wi-mobile-chat-messages__assistant"
75
- }, re = /* @__PURE__ */ C({
75
+ }, pe = /* @__PURE__ */ C({
76
76
  __name: "ChatMessagesView",
77
77
  props: {
78
78
  messages: { default: () => [] },
@@ -84,71 +84,77 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
84
84
  },
85
85
  emits: ["loadOlder", "updateThinkingExpanded"],
86
86
  setup(l, { expose: u, emit: o }) {
87
- var S, E;
88
- const t = l, d = o;
89
- D(t.outputFileConfig ?? {});
90
- const g = K(), { showScrollToBottom: e, forceScrollToBottom: a, requestScrollToBottom: r, onReachTop: w } = H(g), O = N(() => M(t.parsers));
91
- let I = ((S = t.messages[0]) == null ? void 0 : S.id) ?? "", B = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
92
- return z(
87
+ var B, E;
88
+ const t = l, r = o;
89
+ q(t.outputFileConfig ?? {});
90
+ const g = z(), { showScrollToBottom: e, forceScrollToBottom: a, requestScrollToBottom: p, resetScrollState: w, onReachTop: D } = J(g), M = L(() => $(t.parsers));
91
+ V(
92
+ () => t.messages.length === 0,
93
+ (d) => {
94
+ d && w();
95
+ }
96
+ );
97
+ let I = ((B = t.messages[0]) == null ? void 0 : B.id) ?? "", S = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
98
+ return V(
93
99
  () => t.messages,
94
100
  () => {
95
- var h, m;
96
- const p = ((h = t.messages[0]) == null ? void 0 : h.id) ?? "", b = ((m = t.messages[t.messages.length - 1]) == null ? void 0 : m.id) ?? "", s = p !== I && b === B;
97
- I = p, B = b, !s && r();
101
+ var b, m;
102
+ const d = ((b = t.messages[0]) == null ? void 0 : b.id) ?? "", h = ((m = t.messages[t.messages.length - 1]) == null ? void 0 : m.id) ?? "", s = d !== I && h === S;
103
+ I = d, S = h, !s && p();
98
104
  },
99
105
  { deep: !0 }
100
- ), w(() => d("loadOlder")), u({
106
+ ), D(() => r("loadOlder")), u({
101
107
  /** 强制滚动到底部 */
102
108
  forceScrollToBottom: a,
103
109
  /** 自动滚动开启时请求滚动到底部 */
104
- requestScrollToBottom: r
105
- }), (p, b) => (n(), i("div", {
110
+ requestScrollToBottom: p
111
+ }), (d, h) => (i(), n("div", {
106
112
  ref_key: "scrollEl",
107
113
  ref: g,
108
114
  class: "wi-mobile-chat-messages"
109
115
  }, [
110
- p.loading ? (n(), i("div", Z, "历史加载中...")) : p.messages.length === 0 ? (n(), i("div", ee, [
111
- te,
112
- _("div", se, y(p.emptyTitle), 1),
113
- _("div", oe, y(p.emptyDescription), 1)
116
+ d.loading ? (i(), n("div", ee, "历史加载中...")) : d.messages.length === 0 ? (i(), n("div", te, [
117
+ se,
118
+ _("div", oe, y(d.emptyTitle), 1),
119
+ _("div", ae, y(d.emptyDescription), 1)
114
120
  ])) : k("", !0),
115
- (n(!0), i(v, null, V(p.messages, (s) => {
116
- var h;
117
- return n(), i(v, {
121
+ (i(!0), n(v, null, A(d.messages, (s) => {
122
+ var b;
123
+ return i(), n(v, {
118
124
  key: s.id
119
125
  }, [
120
- s.role === "user" ? (n(), i("div", ae, [
126
+ s.role === "user" ? (i(), n("div", ie, [
121
127
  _("div", ne, [
122
- (h = s.attachments) != null && h.length ? (n(), i("div", ie, [
123
- (n(!0), i(v, null, V(s.attachments, (m) => (n(), i("span", {
128
+ (b = s.attachments) != null && b.length ? (i(), n("div", le, [
129
+ (i(!0), n(v, null, A(s.attachments, (m) => (i(), n("span", {
124
130
  key: m.name,
125
131
  class: "wi-mobile-chat-messages__attachment"
126
132
  }, y(m.name), 1))), 128))
127
133
  ])) : k("", !0),
128
- _("div", le, y(s.content), 1)
134
+ _("div", de, y(s.content), 1)
129
135
  ])
130
- ])) : (n(), i("div", de, [
131
- f(c(q), {
136
+ ])) : (i(), n("div", re, [
137
+ f(c(x), {
132
138
  steps: s.thinking.steps,
133
139
  expanded: s.thinking.expanded,
134
- "onUpdate:expanded": (m) => d("updateThinkingExpanded", s, m)
140
+ "onUpdate:expanded": (m) => r("updateThinkingExpanded", s, m)
135
141
  }, null, 8, ["steps", "expanded", "onUpdate:expanded"]),
136
- f(c($), {
142
+ f(c(P), {
137
143
  answer: s.answer,
138
144
  error: s.error,
139
145
  stopped: s.stopped,
140
- "content-map": O.value
146
+ "content-map": M.value
141
147
  }, null, 8, ["answer", "error", "stopped", "content-map"])
142
148
  ]))
143
149
  ], 64);
144
150
  }), 128)),
145
- f(L, { name: "wi-mobile-chat-messages-fade" }, {
146
- default: F(() => [
147
- c(e) ? (n(), i("button", {
151
+ f(R, { name: "wi-mobile-chat-messages-fade" }, {
152
+ default: O(() => [
153
+ c(e) ? (i(), n("button", {
148
154
  key: 0,
149
155
  type: "button",
150
156
  class: "wi-mobile-chat-messages__bottom",
151
- onClick: b[0] || (b[0] = //@ts-ignore
157
+ onClick: h[0] || (h[0] = //@ts-ignore
152
158
  (...s) => c(a) && c(a)(...s))
153
159
  }, " 回到底部 ")) : k("", !0)
154
160
  ]),
@@ -156,7 +162,7 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
156
162
  })
157
163
  ], 512));
158
164
  }
159
- }), pe = /* @__PURE__ */ T(re, [["__scopeId", "data-v-9400261b"]]), ue = { class: "wi-mobile-chat-container" }, me = /* @__PURE__ */ C({
165
+ }), ue = /* @__PURE__ */ T(pe, [["__scopeId", "data-v-04e966f6"]]), me = { class: "wi-mobile-chat-container" }, ce = /* @__PURE__ */ C({
160
166
  __name: "ChatContainer",
161
167
  props: {
162
168
  messages: { default: () => [] },
@@ -174,52 +180,53 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
174
180
  },
175
181
  emits: ["update:question", "submit", "stop", "loadOlder", "updateThinkingExpanded"],
176
182
  setup(l, { emit: u }) {
177
- const o = l, t = u, d = () => {
183
+ const o = l, t = u, r = () => {
178
184
  o.hasMore && t("loadOlder");
179
185
  }, g = () => {
180
186
  t("submit", { text: o.question });
181
187
  };
182
- return (e, a) => (n(), i("section", ue, [
183
- A(e.$slots, "messages", {}, () => [
184
- f(pe, {
188
+ return (e, a) => (i(), n("section", me, [
189
+ F(e.$slots, "messages", {}, () => [
190
+ f(ue, {
185
191
  messages: e.messages,
186
192
  parsers: e.parsers,
187
193
  "output-file-config": e.outputFileConfig,
188
194
  loading: e.loading,
189
195
  "empty-title": e.emptyTitle,
190
196
  "empty-description": e.emptyDescription,
191
- onLoadOlder: d,
192
- onUpdateThinkingExpanded: a[0] || (a[0] = (r, w) => t("updateThinkingExpanded", r, w))
197
+ onLoadOlder: r,
198
+ onUpdateThinkingExpanded: a[0] || (a[0] = (p, w) => t("updateThinkingExpanded", p, w))
193
199
  }, null, 8, ["messages", "parsers", "output-file-config", "loading", "empty-title", "empty-description"])
194
200
  ], !0),
195
- A(e.$slots, "above-input", {}, void 0, !0),
196
- f(X, {
201
+ F(e.$slots, "above-input", {}, void 0, !0),
202
+ f(Y, {
197
203
  "model-value": e.question,
198
204
  placeholder: e.placeholder,
199
205
  disabled: e.disabled || !e.session,
200
206
  "disabled-send": !e.question.trim(),
201
207
  talking: e.talking,
202
- "onUpdate:modelValue": a[1] || (a[1] = (r) => t("update:question", r)),
208
+ "onUpdate:modelValue": a[1] || (a[1] = (p) => t("update:question", p)),
203
209
  onSubmit: g,
204
- onStop: a[2] || (a[2] = (r) => t("stop"))
210
+ onStop: a[2] || (a[2] = (p) => t("stop"))
205
211
  }, null, 8, ["model-value", "placeholder", "disabled", "disabled-send", "talking"])
206
212
  ]));
207
213
  }
208
- }), he = /* @__PURE__ */ T(me, [["__scopeId", "data-v-9bd22d00"]]);
214
+ }), ye = /* @__PURE__ */ T(ce, [["__scopeId", "data-v-9bd22d00"]]);
209
215
  export {
210
- we as AiAnswerBubble,
211
- he as ChatContainer,
212
- pe as ChatMessagesView,
213
- ke as DeepThinkingSteps,
214
- ve as IframePage,
215
- X as Inputbox,
216
- Ce as KnowledgeStreamResult,
217
- Te as OutputFile,
218
- Ie as createAnswerContentMap,
219
- Be as injectIframeResizerChild,
220
- Se as provideIframePageConfig,
221
- Ee as provideOutputFileConfig,
222
- Ve as resolveIframePlaceholders,
223
- Ae as useIframePage
216
+ ke as AiAnswerBubble,
217
+ ye as ChatContainer,
218
+ ue as ChatMessagesView,
219
+ ve as ClarificationCard,
220
+ Ce as DeepThinkingSteps,
221
+ Te as IframePage,
222
+ Y as Inputbox,
223
+ Ie as KnowledgeStreamResult,
224
+ Se as OutputFile,
225
+ Be as createAnswerContentMap,
226
+ Ee as injectIframeResizerChild,
227
+ Ve as provideIframePageConfig,
228
+ Ae as provideOutputFileConfig,
229
+ Fe as resolveIframePlaceholders,
230
+ Oe as useIframePage
224
231
  };
225
232
  //# sourceMappingURL=index.js.map
@@ -65,9 +65,9 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
65
65
  onStop?: () => any;
66
66
  "onUpdate:modelValue"?: (value: string) => any;
67
67
  }, {
68
- modelValue: string;
69
68
  placeholder: string;
70
69
  disabled: boolean;
70
+ modelValue: string;
71
71
  disabledSend: boolean;
72
72
  enterExact: boolean;
73
73
  submitText: string;
@@ -1 +1 @@
1
- .wi-mobile-inputbox[data-v-02f9c6a0]{display:flex;align-items:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--wi-chat-border, #e1e4e8);background:#f7f8fa}.wi-mobile-inputbox[data-v-02f9c6a0] .van-field__control{font-size:14px;line-height:1.75}.wi-mobile-inputbox__btn[data-v-02f9c6a0]{flex-shrink:0}.wi-mobile-chat-messages[data-v-9400261b]{position:relative;flex:1;min-height:0;overflow-y:auto;padding:14px 12px;background:#f5f7fb;-webkit-overflow-scrolling:touch}.wi-mobile-chat-messages__loading[data-v-9400261b],.wi-mobile-chat-messages__empty[data-v-9400261b]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:8px;color:#8a93a6;font-size:13px}.wi-mobile-chat-messages__empty-logo[data-v-9400261b]{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:16px;background:linear-gradient(135deg,var(--wi-chat-primary),color-mix(in srgb,var(--wi-chat-primary) 55%,#7b61ff));color:#fff;font-size:19px;font-weight:700}.wi-mobile-chat-messages__empty-title[data-v-9400261b]{color:#2c3653;font-size:16px;font-weight:600}.wi-mobile-chat-messages__user[data-v-9400261b]{display:flex;justify-content:flex-end;margin:12px 0}.wi-mobile-chat-messages__user-wrapper[data-v-9400261b]{display:flex;flex-direction:column;align-items:flex-end;max-width:86%;gap:6px}.wi-mobile-chat-messages__attachments[data-v-9400261b]{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}.wi-mobile-chat-messages__attachment[data-v-9400261b]{max-width:100%;padding:4px 8px;border:1px solid #dfe4ee;border-radius:6px;background:#fff;color:#53617c;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wi-mobile-chat-messages__user-bubble[data-v-9400261b]{max-width:100%;padding:9px 12px;border-radius:14px 4px 14px 14px;background:var(--wi-chat-primary);color:#fff;font-size:14px;line-height:1.65;white-space:pre-wrap;word-break:break-word}.wi-mobile-chat-messages__assistant[data-v-9400261b]{width:fit-content;max-width:100%;margin:12px 0;padding:10px 11px;border:1px solid #e7eaf2;border-radius:4px 12px 12px;background:#fff;box-shadow:0 4px 14px #3137570d;color:#27344d;font-size:14px;line-height:1.7;word-break:break-word}.wi-mobile-chat-messages__bottom[data-v-9400261b]{position:sticky;bottom:10px;left:100%;padding:5px 12px;border:1px solid #e1e4e8;border-radius:999px;background:#fff;box-shadow:0 4px 12px #31375724;color:#53617c;font-size:12px}.wi-mobile-chat-messages-fade-enter-active[data-v-9400261b],.wi-mobile-chat-messages-fade-leave-active[data-v-9400261b]{transition:opacity .2s ease}.wi-mobile-chat-messages-fade-enter-from[data-v-9400261b],.wi-mobile-chat-messages-fade-leave-to[data-v-9400261b]{opacity:0}.wi-mobile-chat-container[data-v-9bd22d00]{display:flex;flex-direction:column;height:100%;min-height:0;background:#f5f7fb}
1
+ .wi-mobile-inputbox[data-v-02f9c6a0]{display:flex;align-items:flex-end;gap:8px;padding:10px 12px;border-top:1px solid var(--wi-chat-border, #e1e4e8);background:#f7f8fa}.wi-mobile-inputbox[data-v-02f9c6a0] .van-field__control{font-size:14px;line-height:1.75}.wi-mobile-inputbox__btn[data-v-02f9c6a0]{flex-shrink:0}.wi-mobile-chat-messages[data-v-04e966f6]{position:relative;flex:1;min-height:0;overflow-y:auto;padding:14px 12px;background:#f5f7fb;-webkit-overflow-scrolling:touch}.wi-mobile-chat-messages__loading[data-v-04e966f6],.wi-mobile-chat-messages__empty[data-v-04e966f6]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:8px;color:#8a93a6;font-size:13px}.wi-mobile-chat-messages__empty-logo[data-v-04e966f6]{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:16px;background:linear-gradient(135deg,var(--wi-chat-primary),color-mix(in srgb,var(--wi-chat-primary) 55%,#7b61ff));color:#fff;font-size:19px;font-weight:700}.wi-mobile-chat-messages__empty-title[data-v-04e966f6]{color:#2c3653;font-size:16px;font-weight:600}.wi-mobile-chat-messages__user[data-v-04e966f6]{display:flex;justify-content:flex-end;margin:12px 0}.wi-mobile-chat-messages__user-wrapper[data-v-04e966f6]{display:flex;flex-direction:column;align-items:flex-end;max-width:86%;gap:6px}.wi-mobile-chat-messages__attachments[data-v-04e966f6]{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}.wi-mobile-chat-messages__attachment[data-v-04e966f6]{max-width:100%;padding:4px 8px;border:1px solid #dfe4ee;border-radius:6px;background:#fff;color:#53617c;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wi-mobile-chat-messages__user-bubble[data-v-04e966f6]{max-width:100%;padding:9px 12px;border-radius:14px 4px 14px 14px;background:var(--wi-chat-primary);color:#fff;font-size:14px;line-height:1.65;white-space:pre-wrap;word-break:break-word}.wi-mobile-chat-messages__assistant[data-v-04e966f6]{width:fit-content;max-width:100%;margin:12px 0;padding:10px 11px;border:1px solid #e7eaf2;border-radius:4px 12px 12px;background:#fff;box-shadow:0 4px 14px #3137570d;color:#27344d;font-size:14px;line-height:1.7;word-break:break-word}.wi-mobile-chat-messages__bottom[data-v-04e966f6]{position:sticky;bottom:10px;left:100%;padding:5px 12px;border:1px solid #e1e4e8;border-radius:999px;background:#fff;box-shadow:0 4px 12px #31375724;color:#53617c;font-size:12px}.wi-mobile-chat-messages-fade-enter-active[data-v-04e966f6],.wi-mobile-chat-messages-fade-leave-active[data-v-04e966f6]{transition:opacity .2s ease}.wi-mobile-chat-messages-fade-enter-from[data-v-04e966f6],.wi-mobile-chat-messages-fade-leave-to[data-v-04e966f6]{opacity:0}.wi-mobile-chat-container[data-v-9bd22d00]{display:flex;flex-direction:column;height:100%;min-height:0;background:#f5f7fb}