wi-chat 0.4.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 (68) 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 +26 -25
  11. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  12. package/dist/page-context/extArgs.d.ts +46 -0
  13. package/dist/page-context/index.cjs +2 -0
  14. package/dist/page-context/index.d.ts +18 -0
  15. package/dist/page-context/index.js +48 -0
  16. package/dist/page-context/state.d.ts +10 -0
  17. package/dist/page-context/types.d.ts +218 -0
  18. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  19. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  20. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  21. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  22. package/dist/parser/index.cjs +2 -2
  23. package/dist/parser/index.d.ts +9 -0
  24. package/dist/parser/index.js +537 -251
  25. package/dist/parser/registry.d.ts +8 -1
  26. package/dist/parser/title.d.ts +27 -0
  27. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  28. package/dist/renderers/index.cjs +1 -1
  29. package/dist/renderers/index.d.ts +1 -0
  30. package/dist/renderers/index.js +641 -354
  31. package/dist/renderers/style.css +1 -1
  32. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  33. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  34. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  35. package/dist/right-panel/icons.d.ts +48 -0
  36. package/dist/right-panel/index.cjs +2 -0
  37. package/dist/right-panel/index.d.ts +43 -0
  38. package/dist/right-panel/index.js +1004 -0
  39. package/dist/right-panel/panels/index.d.ts +7 -0
  40. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  41. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  42. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  43. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  44. package/dist/right-panel/panels/web/index.d.ts +4 -0
  45. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  46. package/dist/right-panel/registry.d.ts +24 -0
  47. package/dist/right-panel/runtime.d.ts +45 -0
  48. package/dist/right-panel/scope.d.ts +34 -0
  49. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  50. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  51. package/dist/right-panel/style.css +1 -0
  52. package/dist/right-panel/types.d.ts +363 -0
  53. package/dist/right-panel/useRightPanel.d.ts +39 -0
  54. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  55. package/dist/tools/index.cjs +4 -4
  56. package/dist/tools/index.d.ts +1 -1
  57. package/dist/tools/index.js +182 -162
  58. package/dist/tools/markdown/index.d.ts +1 -1
  59. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  60. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  61. package/dist/web-ui/chat/ChatContainer.vue.d.ts +3 -3
  62. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  63. package/dist/web-ui/index.cjs +1 -1
  64. package/dist/web-ui/index.d.ts +1 -1
  65. package/dist/web-ui/index.js +301 -295
  66. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  67. package/dist/web-ui/style.css +1 -1
  68. 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"),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, 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,6 +1,6 @@
1
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";
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
4
  import { Field as W, Button as G } from "vant";
5
5
  import { useAutoScroll as H } from "wi-chat/tools";
6
6
  const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
@@ -27,7 +27,7 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
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(), i("div", J, [
30
+ return (e, a) => (i(), n("div", J, [
31
31
  f(c(W), {
32
32
  "model-value": e.modelValue,
33
33
  type: "textarea",
@@ -66,7 +66,7 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
66
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
- }, ne = { class: "wi-mobile-chat-messages__user-wrapper" }, ie = {
69
+ }, ie = { class: "wi-mobile-chat-messages__user-wrapper" }, ne = {
70
70
  key: 0,
71
71
  class: "wi-mobile-chat-messages__attachments"
72
72
  }, le = { class: "wi-mobile-chat-messages__user-bubble" }, de = {
@@ -102,32 +102,32 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
102
102
  forceScrollToBottom: a,
103
103
  /** 自动滚动开启时请求滚动到底部 */
104
104
  requestScrollToBottom: r
105
- }), (p, b) => (n(), i("div", {
105
+ }), (p, b) => (i(), n("div", {
106
106
  ref_key: "scrollEl",
107
107
  ref: g,
108
108
  class: "wi-mobile-chat-messages"
109
109
  }, [
110
- p.loading ? (n(), i("div", Z, "历史加载中...")) : p.messages.length === 0 ? (n(), i("div", ee, [
110
+ p.loading ? (i(), n("div", Z, "历史加载中...")) : p.messages.length === 0 ? (i(), n("div", ee, [
111
111
  te,
112
112
  _("div", se, y(p.emptyTitle), 1),
113
113
  _("div", oe, y(p.emptyDescription), 1)
114
114
  ])) : k("", !0),
115
- (n(!0), i(v, null, V(p.messages, (s) => {
115
+ (i(!0), n(v, null, V(p.messages, (s) => {
116
116
  var h;
117
- return n(), i(v, {
117
+ return i(), n(v, {
118
118
  key: s.id
119
119
  }, [
120
- s.role === "user" ? (n(), i("div", ae, [
121
- _("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", {
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
124
  key: m.name,
125
125
  class: "wi-mobile-chat-messages__attachment"
126
126
  }, y(m.name), 1))), 128))
127
127
  ])) : k("", !0),
128
128
  _("div", le, y(s.content), 1)
129
129
  ])
130
- ])) : (n(), i("div", de, [
130
+ ])) : (i(), n("div", de, [
131
131
  f(c(q), {
132
132
  steps: s.thinking.steps,
133
133
  expanded: s.thinking.expanded,
@@ -144,7 +144,7 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
144
144
  }), 128)),
145
145
  f(L, { name: "wi-mobile-chat-messages-fade" }, {
146
146
  default: F(() => [
147
- c(e) ? (n(), i("button", {
147
+ c(e) ? (i(), n("button", {
148
148
  key: 0,
149
149
  type: "button",
150
150
  class: "wi-mobile-chat-messages__bottom",
@@ -179,7 +179,7 @@ const J = { class: "wi-mobile-inputbox" }, Q = /* @__PURE__ */ C({
179
179
  }, g = () => {
180
180
  t("submit", { text: o.question });
181
181
  };
182
- return (e, a) => (n(), i("section", ue, [
182
+ return (e, a) => (i(), n("section", ue, [
183
183
  A(e.$slots, "messages", {}, () => [
184
184
  f(pe, {
185
185
  messages: e.messages,
@@ -210,16 +210,17 @@ export {
210
210
  we as AiAnswerBubble,
211
211
  he as ChatContainer,
212
212
  pe as ChatMessagesView,
213
- ke as DeepThinkingSteps,
214
- ve as IframePage,
213
+ ke as ClarificationCard,
214
+ ve as DeepThinkingSteps,
215
+ Ce as IframePage,
215
216
  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
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
224
225
  };
225
226
  //# 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;
@@ -0,0 +1,46 @@
1
+ import { AgentAction, AgentNavigationContext, AgentPageContext, AgentTableStateInput } from './types';
2
+
3
+ /** 页面上下文在 ext_args 中的字段名 */
4
+ export declare const PAGE_CONTEXT_EXT_ARGS_KEY = "pageContext";
5
+ /** 当前页面上下文协议版本 */
6
+ export declare const PAGE_CONTEXT_SCHEMA_VERSION = "2.0";
7
+ /** 携带页面上下文的 ext_args 形态(pageContext 为第一次序列化后的字符串) */
8
+ export interface PageContextExtArgs {
9
+ /** 序列化后的页面上下文(`JSON.stringify(AgentPageContext)`) */
10
+ [PAGE_CONTEXT_EXT_ARGS_KEY]: string;
11
+ }
12
+ /** 创建页面上下文的入参(schemaVersion 由工厂补全) */
13
+ export interface CreatePageContextOptions {
14
+ /** 当前页面及可访问菜单的导航上下文 */
15
+ navigation: AgentNavigationContext;
16
+ /** 页面显式提供给大模型读取的表格状态(自动截断并补 total / truncated) */
17
+ state?: AgentTableStateInput[];
18
+ /** 页面允许大模型规划的 Action 列表 */
19
+ actions?: AgentAction[];
20
+ }
21
+ /**
22
+ * 组装一份页面上下文(补 schemaVersion、规范化状态快照)。
23
+ * @param options 导航上下文、状态与 Action 列表
24
+ * @returns 符合 schemaVersion 2.0 的完整页面上下文
25
+ */
26
+ export declare const createPageContext: (options: CreatePageContextOptions) => AgentPageContext;
27
+ /**
28
+ * 把页面上下文转成提问用的 ext_args 对象(完成协议要求的第一层序列化)。
29
+ * @param context 页面上下文
30
+ * @returns `{ pageContext: '<序列化后的上下文>' }`,直接作为 `submitQuestion` 的 `extArgs`
31
+ */
32
+ export declare const toPageContextExtArgs: (context: AgentPageContext) => PageContextExtArgs;
33
+ /**
34
+ * 判断一个值是否形似页面上下文(只做最小结构校验,不校验 schema 细节)。
35
+ * @param value 待判断的值
36
+ * @returns 具备 schemaVersion / navigation / state / actions 时返回 true
37
+ */
38
+ export declare const isAgentPageContext: (value: unknown) => value is AgentPageContext;
39
+ /**
40
+ * 从 ext_args 中反向解析页面上下文(调试 / 历史回放用,提问链路不需要)。
41
+ * 兼容两种输入:`ext_args` 原对象,或已序列化的 ext_args JSON 字符串;
42
+ * 其中 `pageContext` 同样兼容字符串与对象两种形态。
43
+ * @param extArgs ext_args 原对象或其 JSON 字符串
44
+ * @returns 解析出的页面上下文;缺失 / 非法时返回 undefined
45
+ */
46
+ export declare const parsePageContextExtArgs: (extArgs: unknown) => AgentPageContext | undefined;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=100,o=(e=[])=>e.map(t=>({...t,columns:t.columns.map(a=>({...a})),data:t.data.slice(0,n).map(a=>({...a})),total:t.data.length,truncated:t.data.length>n})),r="pageContext",s="2.0",g=e=>({schemaVersion:s,navigation:e.navigation,state:o(e.state),actions:e.actions??[]}),c=e=>({[r]:JSON.stringify(e)}),i=e=>{if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return typeof t.schemaVersion=="string"&&!!t.navigation&&typeof t.navigation=="object"&&Array.isArray(t.state)&&Array.isArray(t.actions)},A=e=>{let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return}if(!t||typeof t!="object"||Array.isArray(t))return;let a=t[r];if(typeof a=="string")try{a=JSON.parse(a)}catch{return}return i(a)?a:void 0};exports.AGENT_TABLE_STATE_ROW_LIMIT=n;exports.PAGE_CONTEXT_EXT_ARGS_KEY=r;exports.PAGE_CONTEXT_SCHEMA_VERSION=s;exports.createPageContext=g;exports.isAgentPageContext=i;exports.normalizeAgentPageState=o;exports.parsePageContextExtArgs=A;exports.toPageContextExtArgs=c;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * wi-chat/page-context —— 页面上下文协议
3
+ *
4
+ * 宿主页面把自己「能导航到哪、能被读什么状态、能执行什么 Action」按
5
+ * schemaVersion 2.0 声明给大模型,随提问经 `ext_args.pageContext` 下发。
6
+ *
7
+ * 组织:
8
+ * - `./types`:协议类型(纯类型,无运行时依赖)
9
+ * - `./state`:表格状态快照(补 total / truncated、按行数上限截断)
10
+ * - `./extArgs`:页面上下文 ↔ ext_args 的双层序列化与反向解析
11
+ *
12
+ * 全部用具名 re-export 而非 export *:TS < 5.0 的 nodenext 下 star 转发成员
13
+ * 不物化(消费端报 TS2305),且 vite/esbuild 隔离转译要求类型显式标注 export type。
14
+ */
15
+ export { PAGE_CONTEXT_EXT_ARGS_KEY, PAGE_CONTEXT_SCHEMA_VERSION, createPageContext, toPageContextExtArgs, parsePageContextExtArgs, isAgentPageContext } from './extArgs';
16
+ export type { PageContextExtArgs, CreatePageContextOptions } from './extArgs';
17
+ export { AGENT_TABLE_STATE_ROW_LIMIT, normalizeAgentPageState } from './state';
18
+ export type { 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 './types';
@@ -0,0 +1,48 @@
1
+ const i = 100, n = (e = []) => e.map((t) => ({
2
+ ...t,
3
+ columns: t.columns.map((a) => ({ ...a })),
4
+ data: t.data.slice(0, 100).map((a) => ({ ...a })),
5
+ total: t.data.length,
6
+ truncated: t.data.length > 100
7
+ })), r = "pageContext", o = "2.0", c = (e) => ({
8
+ schemaVersion: o,
9
+ navigation: e.navigation,
10
+ state: n(e.state),
11
+ actions: e.actions ?? []
12
+ }), A = (e) => ({
13
+ [r]: JSON.stringify(e)
14
+ }), s = (e) => {
15
+ if (!e || typeof e != "object" || Array.isArray(e))
16
+ return !1;
17
+ const t = e;
18
+ return typeof t.schemaVersion == "string" && !!t.navigation && typeof t.navigation == "object" && Array.isArray(t.state) && Array.isArray(t.actions);
19
+ }, g = (e) => {
20
+ let t = e;
21
+ if (typeof t == "string")
22
+ try {
23
+ t = JSON.parse(t);
24
+ } catch {
25
+ return;
26
+ }
27
+ if (!t || typeof t != "object" || Array.isArray(t))
28
+ return;
29
+ let a = t[r];
30
+ if (typeof a == "string")
31
+ try {
32
+ a = JSON.parse(a);
33
+ } catch {
34
+ return;
35
+ }
36
+ return s(a) ? a : void 0;
37
+ };
38
+ export {
39
+ i as AGENT_TABLE_STATE_ROW_LIMIT,
40
+ r as PAGE_CONTEXT_EXT_ARGS_KEY,
41
+ o as PAGE_CONTEXT_SCHEMA_VERSION,
42
+ c as createPageContext,
43
+ s as isAgentPageContext,
44
+ n as normalizeAgentPageState,
45
+ g as parsePageContextExtArgs,
46
+ A as toPageContextExtArgs
47
+ };
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import { AgentPageState, AgentTableStateInput } from './types';
2
+
3
+ /** 表格状态最多发送的行数(超出时 `truncated` 置 true) */
4
+ export declare const AGENT_TABLE_STATE_ROW_LIMIT = 100;
5
+ /**
6
+ * 把调用方显式提供的状态整理为页面上下文中的只读快照。
7
+ * @param state 调用方提供的表格状态列表(缺省为空数组)
8
+ * @returns 补齐 total / truncated 并截断后的状态列表(列与行均做浅拷贝,避免外部后续改动污染快照)
9
+ */
10
+ export declare const normalizeAgentPageState: (state?: AgentTableStateInput[]) => AgentPageState[];