wi-chat 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) 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 +101 -68
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -3
  8. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  9. package/dist/mobile-ui/index.cjs +1 -1
  10. package/dist/mobile-ui/index.d.ts +2 -2
  11. package/dist/mobile-ui/index.js +79 -71
  12. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  13. package/dist/mobile-ui/style.css +1 -1
  14. package/dist/page-context/extArgs.d.ts +46 -0
  15. package/dist/page-context/index.cjs +2 -0
  16. package/dist/page-context/index.d.ts +18 -0
  17. package/dist/page-context/index.js +48 -0
  18. package/dist/page-context/state.d.ts +10 -0
  19. package/dist/page-context/types.d.ts +218 -0
  20. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  21. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  22. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  23. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  24. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +43 -0
  25. package/dist/parser/answerCom/outputFile/types.d.ts +17 -0
  26. package/dist/parser/index.cjs +2 -2
  27. package/dist/parser/index.d.ts +12 -0
  28. package/dist/parser/index.js +537 -211
  29. package/dist/parser/registry.d.ts +8 -1
  30. package/dist/parser/title.d.ts +27 -0
  31. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  32. package/dist/renderers/index.cjs +1 -1
  33. package/dist/renderers/index.d.ts +4 -0
  34. package/dist/renderers/index.js +796 -143
  35. package/dist/renderers/outputFile/OutputFile.vue.d.ts +19 -0
  36. package/dist/renderers/outputFile/useOutputFile.d.ts +85 -0
  37. package/dist/renderers/style.css +1 -1
  38. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  39. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  40. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  41. package/dist/right-panel/icons.d.ts +48 -0
  42. package/dist/right-panel/index.cjs +2 -0
  43. package/dist/right-panel/index.d.ts +43 -0
  44. package/dist/right-panel/index.js +1004 -0
  45. package/dist/right-panel/panels/index.d.ts +7 -0
  46. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  47. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  48. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  49. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  50. package/dist/right-panel/panels/web/index.d.ts +4 -0
  51. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  52. package/dist/right-panel/registry.d.ts +24 -0
  53. package/dist/right-panel/runtime.d.ts +45 -0
  54. package/dist/right-panel/scope.d.ts +34 -0
  55. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  56. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  57. package/dist/right-panel/style.css +1 -0
  58. package/dist/right-panel/types.d.ts +363 -0
  59. package/dist/right-panel/useRightPanel.d.ts +39 -0
  60. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  61. package/dist/tools/index.cjs +4 -4
  62. package/dist/tools/index.d.ts +1 -1
  63. package/dist/tools/index.js +182 -162
  64. package/dist/tools/markdown/index.d.ts +1 -1
  65. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  66. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  67. package/dist/web-ui/chat/ChatContainer.vue.d.ts +8 -3
  68. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  69. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  70. package/dist/web-ui/index.cjs +1 -1
  71. package/dist/web-ui/index.d.ts +2 -2
  72. package/dist/web-ui/index.js +428 -408
  73. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  74. package/dist/web-ui/style.css +1 -1
  75. 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, 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, 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,76 +1,109 @@
1
1
  import "wi-chat/style.css";
2
- import { AuthExpiredError as a, buildChatWsUrl as o, createChatApi as s, createRequest as n, fileToBase64 as l, formDataToJson as i, isCancelError as p, login as m, openChatWebSocketStream as c, pwdEncrypt as h, resolveMessageData as d, sendPayloadInChunks as u } from "wi-chat/request";
3
- import { IFRAME_RESIZER_CHILD_SCRIPT as R, IMAGE_EXTENSIONS as S, RECORDSET_ANSWER_TYPE as g, RoleEnum as y, applyAnswerChunk as E, applyDeepThinkingChunk as C, applyIframePageChunk as I, applyKnowledgeStreamChunk as P, applyRecordsetChunk as w, collectDeepThinkingSteps as T, collectThinkingSteps as k, consumeStream as f, createEmptyAnswerValues as x, createHistoryGroup as H, createLineSplitter as z, deepThinkingParser as D, deleteHistoryGroup as M, extractAttachmentsFromHistory as v, extractHistoryAttachments as G, formatFileSize as _, getHistoryGroups as F, iframePageParser as L, injectIframeResizerScript as U, isImageAttachment as N, knowledgeStreamParser as W, loadGroupMessages as b, loadGroupMessagesByStep as B, nextLocalMessageId as K, normalizeAnswer as O, normalizeAnswerReport as Y, normalizeAttachment as j, normalizeIframePageReport as q, normalizeKnowledgeStreamReport as J, normalizeRecordsetReport as V, parseHistoryAttachment as X, parseRealtimeAttachment as Z, parseSseLine as Q, readRecordsetPayload as $, recordsetParser as ee, resolveAttachDownloadUrl as re, resolveAttachPreviewUrl as te, resolveRemoteFileUrl as ae, setHistoryGroupTitle as oe } from "wi-chat/parser";
4
- import { DEFAULT_PRIMARY as ne, applyTheme as le, createChatTheme as ie } from "wi-chat/theme";
5
- import { useAgent as me, useChat as ce, useChatSession as he, useHistory as de } from "wi-chat/core";
6
- import { closeImagePreview as Ae, downloadAttachment as Re, openImagePreview as Se, renderMarkdown as ge, useAutoScroll as ye } 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
- ne as DEFAULT_PRIMARY,
10
- R as IFRAME_RESIZER_CHILD_SCRIPT,
11
- S as IMAGE_EXTENSIONS,
12
- g as RECORDSET_ANSWER_TYPE,
13
- y as RoleEnum,
14
- E as applyAnswerChunk,
15
- C as applyDeepThinkingChunk,
16
- I as applyIframePageChunk,
17
- P as applyKnowledgeStreamChunk,
18
- w as applyRecordsetChunk,
19
- le 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,
20
31
  o as buildChatWsUrl,
21
- Ae as closeImagePreview,
22
- T as collectDeepThinkingSteps,
23
- k as collectThinkingSteps,
24
- f as consumeStream,
25
- s as createChatApi,
26
- ie as createChatTheme,
27
- x as createEmptyAnswerValues,
28
- H as createHistoryGroup,
29
- z as createLineSplitter,
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,
30
45
  n as createRequest,
31
- D as deepThinkingParser,
32
- M as deleteHistoryGroup,
33
- Re as downloadAttachment,
34
- v as extractAttachmentsFromHistory,
35
- G as extractHistoryAttachments,
36
- l as fileToBase64,
37
- i as formDataToJson,
38
- _ as formatFileSize,
39
- F as getHistoryGroups,
40
- L as iframePageParser,
41
- U as injectIframeResizerScript,
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,
42
60
  p as isCancelError,
43
- N as isImageAttachment,
44
- W as knowledgeStreamParser,
45
- b as loadGroupMessages,
46
- B as loadGroupMessagesByStep,
47
- m as login,
48
- K as nextLocalMessageId,
49
- O as normalizeAnswer,
50
- Y as normalizeAnswerReport,
51
- j as normalizeAttachment,
52
- q as normalizeIframePageReport,
53
- J as normalizeKnowledgeStreamReport,
54
- V as normalizeRecordsetReport,
55
- c as openChatWebSocketStream,
56
- Se as openImagePreview,
57
- X as parseHistoryAttachment,
58
- Z as parseRealtimeAttachment,
59
- Q as parseSseLine,
60
- h as pwdEncrypt,
61
- $ as readRecordsetPayload,
62
- ee as recordsetParser,
63
- ge as renderMarkdown,
64
- re as resolveAttachDownloadUrl,
65
- te as resolveAttachPreviewUrl,
66
- d as resolveMessageData,
67
- ae as resolveRemoteFileUrl,
68
- u as sendPayloadInChunks,
69
- oe as setHistoryGroupTitle,
70
- me as useAgent,
71
- ye as useAutoScroll,
72
- ce as useChat,
73
- he as useChatSession,
74
- de as useHistory
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,
88
+ u as pwdEncrypt,
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
75
108
  };
76
109
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
2
+ import { OutputFileConfig } from 'wi-chat/renderers';
2
3
  import { ChatSubmitPayload } from './types';
3
4
 
4
5
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -6,6 +7,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
6
7
  messages: Message[];
7
8
  /** 自定义回答类型 parser */
8
9
  parsers?: AnswerParser<any>[];
10
+ /** output_file 文件加载 / 预览配置 */
11
+ outputFileConfig?: OutputFileConfig;
9
12
  /** 历史消息是否加载中 */
10
13
  loading?: boolean;
11
14
  /** 流式回答是否进行中 */
@@ -47,6 +50,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
47
50
  messages: Message[];
48
51
  /** 自定义回答类型 parser */
49
52
  parsers?: AnswerParser<any>[];
53
+ /** output_file 文件加载 / 预览配置 */
54
+ outputFileConfig?: OutputFileConfig;
50
55
  /** 历史消息是否加载中 */
51
56
  loading?: boolean;
52
57
  /** 流式回答是否进行中 */
@@ -84,14 +89,14 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
84
89
  onStop?: () => any;
85
90
  "onUpdate:question"?: (value: string) => any;
86
91
  }, {
87
- parsers: AnswerParser<any>[];
92
+ placeholder: string;
88
93
  question: string;
94
+ parsers: AnswerParser<any>[];
89
95
  loading: boolean;
96
+ disabled: boolean;
90
97
  messages: Message[];
91
98
  emptyTitle: string;
92
99
  emptyDescription: string;
93
- placeholder: string;
94
- disabled: boolean;
95
100
  talking: boolean;
96
101
  session: string;
97
102
  hasMore: boolean;
@@ -1,10 +1,13 @@
1
1
  import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
2
+ import { OutputFileConfig } from 'wi-chat/renderers';
2
3
 
3
4
  declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
5
  /** 当前分组消息列表 */
5
6
  messages: Message[];
6
7
  /** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
7
8
  parsers?: AnswerParser[];
9
+ /** output_file 文件加载 / 预览配置(移动端宿主通常需注入 loadFile) */
10
+ outputFileConfig?: OutputFileConfig;
8
11
  /** 历史消息是否加载中 */
9
12
  loading?: boolean;
10
13
  /** 空态主标题 */
@@ -30,6 +33,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
30
33
  messages: Message[];
31
34
  /** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
32
35
  parsers?: AnswerParser[];
36
+ /** output_file 文件加载 / 预览配置(移动端宿主通常需注入 loadFile) */
37
+ outputFileConfig?: OutputFileConfig;
33
38
  /** 历史消息是否加载中 */
34
39
  loading?: boolean;
35
40
  /** 空态主标题 */
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=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(l,{emit:c}){const n=l,o=c,i=()=>{if(n.talking){o("stop");return}n.disabled||n.disabledSend||o("submit")},m=t=>{t.isComposing||t.keyCode===229||!n.enterExact||n.talking||(t.preventDefault(),i())};return(t,a)=>(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":a[0]||(a[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=(l,c)=>{const n=l.__vccOpts||l;for(const[o,i]of c)n[o]=i;return n},v=h(T,[["__scopeId","data-v-02f9c6a0"]]),V=l=>(e.pushScopeId("data-v-d4077ae9"),l=l(),e.popScopeId(),l),P={key:0,class:"wi-mobile-chat-messages__loading"},N={key:1,class:"wi-mobile-chat-messages__empty"},O=V(()=>e.createElementVNode("div",{class:"wi-mobile-chat-messages__empty-logo"},"WI",-1)),A={class:"wi-mobile-chat-messages__empty-title"},D={class:"wi-mobile-chat-messages__empty-description"},j={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"},F=e.defineComponent({__name:"ChatMessagesView",props:{messages:{default:()=>[]},parsers:{default:()=>[]},loading:{type:Boolean,default:!1},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"}},emits:["loadOlder","updateThinkingExpanded"],setup(l,{expose:c,emit:n}){var _,w;const o=l,i=n,m=e.ref(),{showScrollToBottom:t,forceScrollToBottom:a,requestScrollToBottom:d,onReachTop:b}=I.useAutoScroll(m),C=e.computed(()=>r.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,u;const p=((g=o.messages[0])==null?void 0:g.id)??"",f=((u=o.messages[o.messages.length-1])==null?void 0:u.id)??"",s=p!==y&&f===k;y=p,k=f,!s&&d()},{deep:!0}),b(()=>i("loadOlder")),c({forceScrollToBottom:a,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",P,"历史加载中...")):p.messages.length===0?(e.openBlock(),e.createElementBlock("div",N,[O,e.createElementVNode("div",A,e.toDisplayString(p.emptyTitle),1),e.createElementVNode("div",D,e.toDisplayString(p.emptyDescription),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.messages,s=>{var g;return e.openBlock(),e.createElementBlock(e.Fragment,{key:s.id},[s.role==="user"?(e.openBlock(),e.createElementBlock("div",j,[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,u=>(e.openBlock(),e.createElementBlock("span",{key:u.name,class:"wi-mobile-chat-messages__attachment"},e.toDisplayString(u.name),1))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",$,e.toDisplayString(s.content),1)])])):(e.openBlock(),e.createElementBlock("div",x,[e.createVNode(e.unref(r.DeepThinkingSteps),{steps:s.thinking.steps,expanded:s.thinking.expanded,"onUpdate:expanded":u=>i("updateThinkingExpanded",s,u)},null,8,["steps","expanded","onUpdate:expanded"]),e.createVNode(e.unref(r.AiAnswerBubble),{answer:s.answer,error:s.error,stopped:s.stopped,"content-map":C.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(a)&&e.unref(a)(...s))}," 回到底部 ")):e.createCommentVNode("",!0)]),_:1})],512))}}),E=h(F,[["__scopeId","data-v-d4077ae9"]]),K={class:"wi-mobile-chat-container"},R=e.defineComponent({__name:"ChatContainer",props:{messages:{default:()=>[]},parsers:{default:()=>[]},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(l,{emit:c}){const n=l,o=c,i=()=>{n.hasMore&&o("loadOlder")},m=()=>{o("submit",{text:n.question})};return(t,a)=>(e.openBlock(),e.createElementBlock("section",K,[e.renderSlot(t.$slots,"messages",{},()=>[e.createVNode(E,{messages:t.messages,parsers:t.parsers,loading:t.loading,"empty-title":t.emptyTitle,"empty-description":t.emptyDescription,onLoadOlder:i,onUpdateThinkingExpanded:a[0]||(a[0]=(d,b)=>o("updateThinkingExpanded",d,b))},null,8,["messages","parsers","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":a[1]||(a[1]=d=>o("update:question",d)),onSubmit:m,onStop:a[2]||(a[2]=d=>o("stop"))},null,8,["model-value","placeholder","disabled","disabled-send","talking"])]))}}),U=h(R,[["__scopeId","data-v-57230dba"]]);Object.defineProperty(exports,"AiAnswerBubble",{enumerable:!0,get:()=>r.AiAnswerBubble});Object.defineProperty(exports,"DeepThinkingSteps",{enumerable:!0,get:()=>r.DeepThinkingSteps});Object.defineProperty(exports,"IframePage",{enumerable:!0,get:()=>r.IframePage});Object.defineProperty(exports,"KnowledgeStreamResult",{enumerable:!0,get:()=>r.KnowledgeStreamResult});Object.defineProperty(exports,"createAnswerContentMap",{enumerable:!0,get:()=>r.createAnswerContentMap});Object.defineProperty(exports,"injectIframeResizerChild",{enumerable:!0,get:()=>r.injectIframeResizerChild});Object.defineProperty(exports,"provideIframePageConfig",{enumerable:!0,get:()=>r.provideIframePageConfig});Object.defineProperty(exports,"resolveIframePlaceholders",{enumerable:!0,get:()=>r.resolveIframePlaceholders});Object.defineProperty(exports,"useIframePage",{enumerable:!0,get:()=>r.useIframePage});exports.ChatContainer=U;exports.ChatMessagesView=E;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"),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;n.provideOutputFileConfig(o.outputFileConfig??{});const m=e.ref(),{showScrollToBottom:t,forceScrollToBottom:l,requestScrollToBottom:d,onReachTop:b}=I.useAutoScroll(m),E=e.computed(()=>n.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)??"",s=p!==y&&f===k;y=p,k=f,!s&&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,s=>{var g;return e.openBlock(),e.createElementBlock(e.Fragment,{key:s.id},[s.role==="user"?(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",D,[(g=s.attachments)!=null&&g.length?(e.openBlock(),e.createElementBlock("div",q,[(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",M,e.toDisplayString(s.content),1)])])):(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(n.DeepThinkingSteps),{steps:s.thinking.steps,expanded:s.thinking.expanded,"onUpdate:expanded":c=>i("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":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]=(...s)=>e.unref(l)&&e.unref(l)(...s))}," 回到底部 ")):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:()=>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=U;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, provideIframePageConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
7
- export type { AnswerContentMap, IframePageConfig, UseIframePageReturn } from 'wi-chat/renderers';
6
+ export { AiAnswerBubble, ClarificationCard, createAnswerContentMap, DeepThinkingSteps, IframePage, injectIframeResizerChild, KnowledgeStreamResult, OutputFile, provideIframePageConfig, provideOutputFileConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
7
+ export type { AnswerContentMap, IframePageConfig, OutputFileConfig, OutputFilePreviewKind, OutputFilePreviewRequest, UseIframePageReturn, } from 'wi-chat/renderers';
@@ -1,9 +1,9 @@
1
- import { createAnswerContentMap as q, DeepThinkingSteps as $, AiAnswerBubble as x } from "wi-chat/renderers";
2
- import { AiAnswerBubble as _e, DeepThinkingSteps as we, IframePage as ke, KnowledgeStreamResult as ve, createAnswerContentMap as Te, injectIframeResizerChild as Ie, provideIframePageConfig as Ce, resolveIframePlaceholders as Be, useIframePage as Se } from "wi-chat/renderers";
3
- import { defineComponent as T, openBlock as n, createElementBlock as l, createVNode as f, unref as c, withKeys as O, withModifiers as P, withCtx as D, 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 F, pushScopeId as L, popScopeId as R, renderSlot as A } from "vue";
4
- import { Field as j, Button as W } from "vant";
5
- import { useAutoScroll as G } from "wi-chat/tools";
6
- const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
1
+ import { provideOutputFileConfig as D, createAnswerContentMap as M, DeepThinkingSteps as q, AiAnswerBubble as $ } from "wi-chat/renderers";
2
+ import { AiAnswerBubble as we, ClarificationCard as ke, DeepThinkingSteps as ve, IframePage as Ce, KnowledgeStreamResult as Te, OutputFile as Ie, createAnswerContentMap as Be, injectIframeResizerChild as Se, provideIframePageConfig as Ee, provideOutputFileConfig as Ve, resolveIframePlaceholders as Ae, useIframePage as Fe } from "wi-chat/renderers";
3
+ import { defineComponent as C, openBlock as i, createElementBlock as n, 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({
7
7
  __name: "Inputbox",
8
8
  props: {
9
9
  modelValue: { default: "" },
@@ -17,8 +17,8 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
17
17
  buttonType: { default: "primary" }
18
18
  },
19
19
  emits: ["update:modelValue", "submit", "stop"],
20
- setup(i, { emit: m }) {
21
- const o = i, t = m, d = () => {
20
+ setup(l, { emit: u }) {
21
+ const o = l, t = u, d = () => {
22
22
  if (o.talking) {
23
23
  t("stop");
24
24
  return;
@@ -27,8 +27,8 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
27
27
  }, g = (e) => {
28
28
  e.isComposing || e.keyCode === 229 || !o.enterExact || o.talking || (e.preventDefault(), d());
29
29
  };
30
- return (e, a) => (n(), l("div", H, [
31
- f(c(j), {
30
+ return (e, a) => (i(), n("div", J, [
31
+ f(c(W), {
32
32
  "model-value": e.modelValue,
33
33
  type: "textarea",
34
34
  rows: "2",
@@ -36,116 +36,119 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
36
36
  placeholder: e.placeholder,
37
37
  disabled: e.disabled,
38
38
  "onUpdate:modelValue": a[0] || (a[0] = (r) => t("update:modelValue", String(r ?? ""))),
39
- onKeydown: O(P(g, ["exact"]), ["enter"])
39
+ onKeydown: x(P(g, ["exact"]), ["enter"])
40
40
  }, null, 8, ["model-value", "placeholder", "disabled", "onKeydown"]),
41
- f(c(W), {
41
+ f(c(G), {
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
46
  onClick: d
47
47
  }, {
48
- default: D(() => [
48
+ default: F(() => [
49
49
  U(y(e.talking ? e.stopText : e.submitText), 1)
50
50
  ]),
51
51
  _: 1
52
52
  }, 8, ["type", "disabled"])
53
53
  ]));
54
54
  }
55
- }), I = (i, m) => {
56
- const o = i.__vccOpts || i;
57
- for (const [t, d] of m)
55
+ }), T = (l, u) => {
56
+ const o = l.__vccOpts || l;
57
+ for (const [t, d] of u)
58
58
  o[t] = d;
59
59
  return o;
60
- }, Q = /* @__PURE__ */ I(J, [["__scopeId", "data-v-02f9c6a0"]]), X = (i) => (L("data-v-d4077ae9"), i = i(), R(), i), Y = {
60
+ }, X = /* @__PURE__ */ T(Q, [["__scopeId", "data-v-02f9c6a0"]]), Y = (l) => (R("data-v-9400261b"), l = l(), j(), l), Z = {
61
61
  key: 0,
62
62
  class: "wi-mobile-chat-messages__loading"
63
- }, Z = {
63
+ }, ee = {
64
64
  key: 1,
65
65
  class: "wi-mobile-chat-messages__empty"
66
- }, ee = /* @__PURE__ */ X(() => /* @__PURE__ */ _("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)), te = { class: "wi-mobile-chat-messages__empty-title" }, se = { class: "wi-mobile-chat-messages__empty-description" }, oe = {
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 = {
67
67
  key: 0,
68
68
  class: "wi-mobile-chat-messages__user"
69
- }, ae = { class: "wi-mobile-chat-messages__user-wrapper" }, ne = {
69
+ }, ie = { class: "wi-mobile-chat-messages__user-wrapper" }, ne = {
70
70
  key: 0,
71
71
  class: "wi-mobile-chat-messages__attachments"
72
- }, le = { class: "wi-mobile-chat-messages__user-bubble" }, ie = {
72
+ }, le = { class: "wi-mobile-chat-messages__user-bubble" }, de = {
73
73
  key: 1,
74
74
  class: "wi-mobile-chat-messages__assistant"
75
- }, de = /* @__PURE__ */ T({
75
+ }, re = /* @__PURE__ */ C({
76
76
  __name: "ChatMessagesView",
77
77
  props: {
78
78
  messages: { default: () => [] },
79
79
  parsers: { default: () => [] },
80
+ outputFileConfig: {},
80
81
  loading: { type: Boolean, default: !1 },
81
82
  emptyTitle: { default: "输入问题,开始与 AI 对话" },
82
83
  emptyDescription: { default: "回答内容由共享渲染层统一分发" }
83
84
  },
84
85
  emits: ["loadOlder", "updateThinkingExpanded"],
85
- setup(i, { expose: m, emit: o }) {
86
+ setup(l, { expose: u, emit: o }) {
86
87
  var S, E;
87
- const t = i, d = o, g = K(), { showScrollToBottom: e, forceScrollToBottom: a, requestScrollToBottom: r, onReachTop: w } = G(g), M = N(() => q(t.parsers));
88
- let C = ((S = t.messages[0]) == null ? void 0 : S.id) ?? "", B = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
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) ?? "";
89
92
  return z(
90
93
  () => t.messages,
91
94
  () => {
92
- var b, u;
93
- const p = ((b = t.messages[0]) == null ? void 0 : b.id) ?? "", h = ((u = t.messages[t.messages.length - 1]) == null ? void 0 : u.id) ?? "", s = p !== C && h === B;
94
- C = p, B = h, !s && r();
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();
95
98
  },
96
99
  { deep: !0 }
97
- ), w(() => d("loadOlder")), m({
100
+ ), w(() => d("loadOlder")), u({
98
101
  /** 强制滚动到底部 */
99
102
  forceScrollToBottom: a,
100
103
  /** 自动滚动开启时请求滚动到底部 */
101
104
  requestScrollToBottom: r
102
- }), (p, h) => (n(), l("div", {
105
+ }), (p, b) => (i(), n("div", {
103
106
  ref_key: "scrollEl",
104
107
  ref: g,
105
108
  class: "wi-mobile-chat-messages"
106
109
  }, [
107
- p.loading ? (n(), l("div", Y, "历史加载中...")) : p.messages.length === 0 ? (n(), l("div", Z, [
108
- ee,
109
- _("div", te, y(p.emptyTitle), 1),
110
- _("div", se, y(p.emptyDescription), 1)
110
+ p.loading ? (i(), n("div", Z, "历史加载中...")) : p.messages.length === 0 ? (i(), n("div", ee, [
111
+ te,
112
+ _("div", se, y(p.emptyTitle), 1),
113
+ _("div", oe, y(p.emptyDescription), 1)
111
114
  ])) : k("", !0),
112
- (n(!0), l(v, null, V(p.messages, (s) => {
113
- var b;
114
- return n(), l(v, {
115
+ (i(!0), n(v, null, V(p.messages, (s) => {
116
+ var h;
117
+ return i(), n(v, {
115
118
  key: s.id
116
119
  }, [
117
- s.role === "user" ? (n(), l("div", oe, [
118
- _("div", ae, [
119
- (b = s.attachments) != null && b.length ? (n(), l("div", ne, [
120
- (n(!0), l(v, null, V(s.attachments, (u) => (n(), l("span", {
121
- key: u.name,
120
+ s.role === "user" ? (i(), n("div", ae, [
121
+ _("div", ie, [
122
+ (h = s.attachments) != null && h.length ? (i(), n("div", ne, [
123
+ (i(!0), n(v, null, V(s.attachments, (m) => (i(), n("span", {
124
+ key: m.name,
122
125
  class: "wi-mobile-chat-messages__attachment"
123
- }, y(u.name), 1))), 128))
126
+ }, y(m.name), 1))), 128))
124
127
  ])) : k("", !0),
125
128
  _("div", le, y(s.content), 1)
126
129
  ])
127
- ])) : (n(), l("div", ie, [
128
- f(c($), {
130
+ ])) : (i(), n("div", de, [
131
+ f(c(q), {
129
132
  steps: s.thinking.steps,
130
133
  expanded: s.thinking.expanded,
131
- "onUpdate:expanded": (u) => d("updateThinkingExpanded", s, u)
134
+ "onUpdate:expanded": (m) => d("updateThinkingExpanded", s, m)
132
135
  }, null, 8, ["steps", "expanded", "onUpdate:expanded"]),
133
- f(c(x), {
136
+ f(c($), {
134
137
  answer: s.answer,
135
138
  error: s.error,
136
139
  stopped: s.stopped,
137
- "content-map": M.value
140
+ "content-map": O.value
138
141
  }, null, 8, ["answer", "error", "stopped", "content-map"])
139
142
  ]))
140
143
  ], 64);
141
144
  }), 128)),
142
- f(F, { name: "wi-mobile-chat-messages-fade" }, {
143
- default: D(() => [
144
- c(e) ? (n(), l("button", {
145
+ f(L, { name: "wi-mobile-chat-messages-fade" }, {
146
+ default: F(() => [
147
+ c(e) ? (i(), n("button", {
145
148
  key: 0,
146
149
  type: "button",
147
150
  class: "wi-mobile-chat-messages__bottom",
148
- onClick: h[0] || (h[0] = //@ts-ignore
151
+ onClick: b[0] || (b[0] = //@ts-ignore
149
152
  (...s) => c(a) && c(a)(...s))
150
153
  }, " 回到底部 ")) : k("", !0)
151
154
  ]),
@@ -153,11 +156,12 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
153
156
  })
154
157
  ], 512));
155
158
  }
156
- }), re = /* @__PURE__ */ I(de, [["__scopeId", "data-v-d4077ae9"]]), pe = { class: "wi-mobile-chat-container" }, me = /* @__PURE__ */ T({
159
+ }), pe = /* @__PURE__ */ T(re, [["__scopeId", "data-v-9400261b"]]), ue = { class: "wi-mobile-chat-container" }, me = /* @__PURE__ */ C({
157
160
  __name: "ChatContainer",
158
161
  props: {
159
162
  messages: { default: () => [] },
160
163
  parsers: { default: () => [] },
164
+ outputFileConfig: {},
161
165
  loading: { type: Boolean, default: !1 },
162
166
  talking: { type: Boolean, default: !1 },
163
167
  session: { default: "" },
@@ -169,26 +173,27 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
169
173
  disabled: { type: Boolean, default: !1 }
170
174
  },
171
175
  emits: ["update:question", "submit", "stop", "loadOlder", "updateThinkingExpanded"],
172
- setup(i, { emit: m }) {
173
- const o = i, t = m, d = () => {
176
+ setup(l, { emit: u }) {
177
+ const o = l, t = u, d = () => {
174
178
  o.hasMore && t("loadOlder");
175
179
  }, g = () => {
176
180
  t("submit", { text: o.question });
177
181
  };
178
- return (e, a) => (n(), l("section", pe, [
182
+ return (e, a) => (i(), n("section", ue, [
179
183
  A(e.$slots, "messages", {}, () => [
180
- f(re, {
184
+ f(pe, {
181
185
  messages: e.messages,
182
186
  parsers: e.parsers,
187
+ "output-file-config": e.outputFileConfig,
183
188
  loading: e.loading,
184
189
  "empty-title": e.emptyTitle,
185
190
  "empty-description": e.emptyDescription,
186
191
  onLoadOlder: d,
187
192
  onUpdateThinkingExpanded: a[0] || (a[0] = (r, w) => t("updateThinkingExpanded", r, w))
188
- }, null, 8, ["messages", "parsers", "loading", "empty-title", "empty-description"])
193
+ }, null, 8, ["messages", "parsers", "output-file-config", "loading", "empty-title", "empty-description"])
189
194
  ], !0),
190
195
  A(e.$slots, "above-input", {}, void 0, !0),
191
- f(Q, {
196
+ f(X, {
192
197
  "model-value": e.question,
193
198
  placeholder: e.placeholder,
194
199
  disabled: e.disabled || !e.session,
@@ -200,19 +205,22 @@ const H = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ T({
200
205
  }, null, 8, ["model-value", "placeholder", "disabled", "disabled-send", "talking"])
201
206
  ]));
202
207
  }
203
- }), he = /* @__PURE__ */ I(me, [["__scopeId", "data-v-57230dba"]]);
208
+ }), he = /* @__PURE__ */ T(me, [["__scopeId", "data-v-9bd22d00"]]);
204
209
  export {
205
- _e as AiAnswerBubble,
210
+ we as AiAnswerBubble,
206
211
  he as ChatContainer,
207
- re as ChatMessagesView,
208
- we as DeepThinkingSteps,
209
- ke as IframePage,
210
- Q as Inputbox,
211
- ve as KnowledgeStreamResult,
212
- Te as createAnswerContentMap,
213
- Ie as injectIframeResizerChild,
214
- Ce as provideIframePageConfig,
215
- Be as resolveIframePlaceholders,
216
- Se as useIframePage
212
+ pe as ChatMessagesView,
213
+ ke as ClarificationCard,
214
+ ve as DeepThinkingSteps,
215
+ Ce as IframePage,
216
+ X as Inputbox,
217
+ Te as KnowledgeStreamResult,
218
+ Ie as OutputFile,
219
+ Be as createAnswerContentMap,
220
+ Se as injectIframeResizerChild,
221
+ Ee as provideIframePageConfig,
222
+ Ve as provideOutputFileConfig,
223
+ Ae as resolveIframePlaceholders,
224
+ Fe as useIframePage
217
225
  };
218
226
  //# sourceMappingURL=index.js.map