@glodon-aiot/agent-cli-ui 2.4.7 → 3.0.4

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 (150) hide show
  1. package/dist/es/AgentClientUI.mjs +97 -110
  2. package/dist/es/Dialog/AgentChat/index.mjs +516 -467
  3. package/dist/es/Dialog/ConnectToNetwork/index.mjs +25 -24
  4. package/dist/es/Dialog/FileCard/index.mjs +48 -55
  5. package/dist/es/Dialog/FilePreview/index.mjs +35 -42
  6. package/dist/es/Dialog/HistoryItem/index.mjs +48 -53
  7. package/dist/es/Dialog/KnowledgeList/index.mjs +55 -48
  8. package/dist/es/Dialog/PromptManager/index.mjs +29 -36
  9. package/dist/es/Dialog/PromptSetting/index.mjs +53 -66
  10. package/dist/es/Dialog/SessionAction/index.mjs +92 -91
  11. package/dist/es/Dialog/SessionList/index.mjs +135 -121
  12. package/dist/es/Dialog/SessionListDrawer/index.mjs +8 -7
  13. package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +29 -36
  14. package/dist/es/Dialog/SessionRefer/index.mjs +29 -36
  15. package/dist/es/Dialog/SessionRelated/index.mjs +17 -14
  16. package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +125 -132
  17. package/dist/es/Dialog/index.mjs +125 -93
  18. package/dist/es/QuillEditor/index.mjs +91 -86
  19. package/dist/es/_virtual/index.mjs +2 -2
  20. package/dist/es/components/Markdown/Image/index.mjs +20 -20
  21. package/dist/es/components/Markdown/index.mjs +27 -22
  22. package/dist/es/constant.mjs +8 -5
  23. package/dist/es/index.mjs +178 -152
  24. package/dist/es/node_modules/classnames/index.mjs +1 -1
  25. package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
  26. package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
  27. package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
  28. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
  29. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
  30. package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
  31. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
  32. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
  33. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
  34. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
  35. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
  36. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
  37. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
  38. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
  39. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
  40. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
  41. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
  42. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
  43. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
  44. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
  45. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
  46. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
  47. package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
  48. package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
  49. package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
  50. package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
  51. package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
  52. package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
  53. package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
  54. package/dist/es/node_modules/longest-streak/index.mjs +12 -0
  55. package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
  56. package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
  57. package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
  58. package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
  59. package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
  60. package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
  61. package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
  62. package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
  63. package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
  64. package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
  65. package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
  66. package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
  67. package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
  68. package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
  69. package/dist/es/utils/index.mjs +44 -27
  70. package/dist/lib/index.js +278 -138
  71. package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
  72. package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
  73. package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
  74. package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
  75. package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
  76. package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
  77. package/dist/src/Dialog/SessionList/index.d.ts +5 -4
  78. package/dist/src/QuillEditor/index.d.ts +1 -0
  79. package/dist/src/components/Markdown/Text/index.d.ts +8 -0
  80. package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
  81. package/dist/src/components/MathJaxRender/index.d.ts +6 -0
  82. package/dist/src/constant.d.ts +1 -1
  83. package/dist/src/contexts/MathJaxContext.d.ts +12 -0
  84. package/dist/src/index.d.ts +4 -1
  85. package/dist/src/types.d.ts +26 -6
  86. package/dist/src/utils/index.d.ts +15 -0
  87. package/package.json +18 -17
  88. package/dist/es/_virtual/index2.mjs +0 -4
  89. package/dist/es/_virtual/index3.mjs +0 -4
  90. package/dist/es/_virtual/index4.mjs +0 -4
  91. package/dist/es/_virtual/minio-zj.mjs +0 -4
  92. package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
  93. package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
  94. package/dist/es/node_modules/base64-js/index.mjs +0 -47
  95. package/dist/es/node_modules/buffer/index.mjs +0 -927
  96. package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
  97. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
  98. package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
  99. package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
  100. package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
  101. package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
  102. package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
  103. package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
  104. package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
  105. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
  106. package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
  107. package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
  108. package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
  109. package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
  110. package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
  111. package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
  112. package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
  113. package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
  114. package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
  115. package/dist/es/node_modules/ieee754/index.mjs +0 -28
  116. package/dist/es/node_modules/js-base64/base64.mjs +0 -31
  117. package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
  118. package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
  119. package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
  120. package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
  121. package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
  122. package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
  123. package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
  124. package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
  125. package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
  126. package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
  127. package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
  128. package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
  129. package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
  130. package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
  131. package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
  132. package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
  133. package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
  134. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
  135. package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
  136. package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
  137. package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
  138. package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
  139. package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
  140. package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
  141. package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
  142. package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
  143. package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
  144. package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
  145. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
  146. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
  147. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
  148. package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
  149. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
  150. package/dist/es/packages/apis/dist/es/utils/fetchEventSource/parse.mjs +0 -97
@@ -1,5 +1,5 @@
1
1
  import { default as React, Dispatch, SetStateAction } from 'react';
2
- import { IApplication, ISessionParams } from '@glodon-aiot/apis';
2
+ import { IApplication, IKnowledge, ISessionParams } from '@glodon-aiot/apis';
3
3
  import { Session } from '@glodon-aiot/agent-cli-sdk';
4
4
  interface AgentChatProps {
5
5
  embeddingService?: string;
@@ -7,7 +7,9 @@ interface AgentChatProps {
7
7
  application: IApplication;
8
8
  currentSession?: Session;
9
9
  resourceToken?: string;
10
- onCreateSession?: (param: ISessionParams) => Promise<Session>;
10
+ onCreateSession?: (param: ISessionParams & {
11
+ knowledges?: IKnowledge[];
12
+ }) => Promise<Session>;
11
13
  footer?: HTMLDivElement | string | boolean;
12
14
  setCurrentSession?: Dispatch<SetStateAction<Session | undefined>>;
13
15
  networkStatus: boolean;
@@ -7,6 +7,7 @@ interface ConnectToNetworkProps {
7
7
  sessionId?: string;
8
8
  netStatus: boolean;
9
9
  enable: boolean;
10
+ disabledTip?: string;
10
11
  onNetStatusChange: (status: boolean) => any;
11
12
  }
12
13
  declare const ConnectToNetwork: React.FC<ConnectToNetworkProps>;
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { CheckboxValueType } from 'antd/es/checkbox/Group';
3
- import { IKnowledge } from '@glodon-aiot/apis/dist/src/cvforce/model';
3
+ import { IKnowledge } from '@glodon-aiot/apis';
4
4
  interface KnowledgeSelectProps {
5
5
  disabled: boolean;
6
6
  checkedValues: CheckboxValueType[];
@@ -1,13 +1,12 @@
1
1
  import { default as React, Dispatch, SetStateAction } from 'react';
2
- import { IApplication } from '@glodon-aiot/apis';
2
+ import { IApplication, IKnowledge } from '@glodon-aiot/apis';
3
3
  import { Session } from '@glodon-aiot/agent-cli-sdk';
4
- import { IKnowledge } from '@glodon-aiot/apis/dist/src/cvforce/model';
5
4
  interface AgentHeaderProps {
6
5
  application?: IApplication;
7
6
  currentSession?: Session;
8
7
  setCurrentSession?: Dispatch<SetStateAction<Session | undefined>>;
9
8
  reload?: VoidFunction;
10
- setCheckKnowledges?: Dispatch<SetStateAction<IKnowledge[]>>;
9
+ setCheckKnowledges?: Dispatch<SetStateAction<IKnowledge[] | undefined>>;
11
10
  }
12
11
  declare const AgentHeader: React.FC<AgentHeaderProps>;
13
12
  export default AgentHeader;
@@ -6,6 +6,7 @@ interface PromptSettingProps {
6
6
  currentSession?: Session;
7
7
  setPromptVariables: Dispatch<SetStateAction<ISessionPrompt[]>>;
8
8
  promptVariables: ISessionPrompt[];
9
+ setCurrentSession?: Dispatch<SetStateAction<Session | undefined>>;
9
10
  }
10
11
  export interface PromptSettingtRef {
11
12
  clear: () => void;
@@ -1,10 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { IHistory } from '@glodon-aiot/apis';
3
+ import { Session } from '@glodon-aiot/agent-cli-sdk';
3
4
  interface SessionActionProps {
4
5
  appId: string;
5
6
  sessionId?: string;
6
7
  isLastHistory?: boolean;
7
8
  history: IHistory;
9
+ currentSession?: Session;
8
10
  onAgainClick?: VoidFunction;
9
11
  }
10
12
  declare const SessionAction: React.FC<SessionActionProps>;
@@ -1,7 +1,6 @@
1
1
  import { default as React, Dispatch, SetStateAction } from 'react';
2
2
  import { Session } from '@glodon-aiot/agent-cli-sdk';
3
- import { IKnowledge } from '@glodon-aiot/apis/dist/src/cvforce/model';
4
- import { IApplication, ISessionParams } from '@glodon-aiot/apis';
3
+ import { IKnowledge, IApplication, ISessionParams } from '@glodon-aiot/apis';
5
4
  interface SessionListProps {
6
5
  appId: string;
7
6
  application?: IApplication;
@@ -11,10 +10,12 @@ interface SessionListProps {
11
10
  setCurrentSession?: Dispatch<SetStateAction<Session | undefined>>;
12
11
  reload?: VoidFunction;
13
12
  checkKnowledges?: IKnowledge[];
14
- setCheckKnowledges?: Dispatch<SetStateAction<IKnowledge[]>>;
13
+ setCheckKnowledges?: Dispatch<SetStateAction<IKnowledge[] | undefined>>;
15
14
  }
16
15
  export interface SessionListRef {
17
- create: (param: ISessionParams) => Promise<Session> | any;
16
+ create: (param: ISessionParams & {
17
+ knowledges?: IKnowledge[];
18
+ }) => Promise<Session> | any;
18
19
  }
19
20
  declare const SessionList: React.ForwardRefExoticComponent<SessionListProps & React.RefAttributes<SessionListRef>>;
20
21
  export default SessionList;
@@ -8,6 +8,7 @@ interface QuillEditorProp {
8
8
  onTextSend?: (value?: string) => void;
9
9
  onChange?: (text: string, editor: ReactQuill.UnprivilegedEditor) => void;
10
10
  clearAction?: React.ReactNode;
11
+ loading?: boolean;
11
12
  }
12
13
  export interface editorRefProps {
13
14
  clear: () => void;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare global {
3
+ interface Window {
4
+ MathJax: any;
5
+ }
6
+ }
7
+ declare const MarkdownMath: ({ node, children }: any) => JSX.Element;
8
+ export default MarkdownMath;
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Window {
3
+ MathJax: any;
4
+ }
5
+ }
6
+ declare const MathJaxLoader: () => null;
7
+ export default MathJaxLoader;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const MathJaxRender: ({ formula, inline, }: {
3
+ formula: string;
4
+ inline?: boolean;
5
+ }) => JSX.Element;
6
+ export default MathJaxRender;
@@ -3,7 +3,7 @@ import { default as brand } from './assets/brand.svg';
3
3
  import { AgentClientUIConfig } from './types';
4
4
  export declare const defaultUIConfig: AgentClientUIConfig;
5
5
  export declare const defaultApiUrl = "https://copilot.glodon.com/api/cvforcepd";
6
- export declare const defaultDovViewerUrl = "https://copilot.glodon.com/portal/test/cvforcepd/fe/";
6
+ export declare const defaultDovViewerUrl = "https://copilot.glodon.com/portal/_/aecpilot/fe/";
7
7
  export { icon, brand };
8
8
  export declare const UNNAMED_SESSION_NAME = "\u672A\u547D\u540D\u4F1A\u8BDD";
9
9
  export declare const KB = 1024;
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ declare global {
3
+ interface Window {
4
+ MathJax: any;
5
+ }
6
+ }
7
+ interface MathJaxContextProps {
8
+ children: React.ReactNode;
9
+ }
10
+ export declare const MathJaxContext: React.Context<{}>;
11
+ export declare const MathJaxProvider: ({ children }: MathJaxContextProps) => JSX.Element;
12
+ export {};
@@ -5,6 +5,7 @@ export default class AgentClientUI {
5
5
  private _activeSession;
6
6
  private _applicationId;
7
7
  private _defaultInputText;
8
+ private _inputDisabled;
8
9
  private _defatulSessionId;
9
10
  readonly apiUrl: string;
10
11
  readonly docViewerUrl: string;
@@ -28,6 +29,8 @@ export default class AgentClientUI {
28
29
  reload(): void;
29
30
  getMessageList(sessionId?: string): Promise<import('@glodon-aiot/apis').IHistory[]>;
30
31
  input(message: string): void;
32
+ disable(): void;
33
+ enable(): void;
31
34
  render(): void;
32
- destroy(): void;
35
+ destroy(callback?: VoidFunction): void;
33
36
  }
@@ -1,5 +1,5 @@
1
- import { BotClient, AgentPluginMap } from '@glodon-aiot/agent-cli-sdk';
2
- import { AgentClientUIApi, ICommentParam, ISession, IChatMessage, IHistory } from '@glodon-aiot/apis';
1
+ import { BotClient, AgentPluginMap, Session } from '@glodon-aiot/agent-cli-sdk';
2
+ import { AgentClientUIApi, ICommentParam, ISession, IChatMessage, IHistory, IKnowledge, ISessionPrompt } from '@glodon-aiot/apis';
3
3
  import { Theme } from 'antd/lib/config-provider/context';
4
4
  import { CSSProperties } from 'react';
5
5
  export type Env = 'dev' | 'test' | 'prod' | 'local';
@@ -30,6 +30,7 @@ export interface AgentClientUITransform {
30
30
  isExpand?: boolean;
31
31
  };
32
32
  knowledges?: boolean;
33
+ promptVariables?: boolean;
33
34
  }
34
35
  export interface MessageBoxFooterItem {
35
36
  componentName: 'AnswerAgain' | 'Copy' | 'Comments';
@@ -43,7 +44,6 @@ export interface AgentFeaturesConfig {
43
44
  newSession?: boolean;
44
45
  fileUpload?: boolean;
45
46
  imageUpload?: boolean;
46
- connectNetwork?: boolean;
47
47
  userMessageBox?: {
48
48
  copy?: boolean;
49
49
  editAgain?: boolean;
@@ -60,9 +60,19 @@ export interface AgentFeaturesConfig {
60
60
  };
61
61
  };
62
62
  prompts?: boolean;
63
+ connectNetwork?: boolean | {
64
+ diabled?: boolean;
65
+ visible?: boolean;
66
+ default?: boolean;
67
+ };
63
68
  knowledges?: boolean | {
64
- diabled: boolean;
65
- visible: boolean;
69
+ diabled?: boolean;
70
+ visible?: boolean;
71
+ default?: IKnowledge[];
72
+ };
73
+ promptVariables?: boolean | {
74
+ visible?: boolean;
75
+ default?: ISessionPrompt[];
66
76
  };
67
77
  }
68
78
  type CommentListener = (payload: {
@@ -78,7 +88,8 @@ type MessageListener = (payload: {
78
88
  type SessionLoadListener = (payload: {
79
89
  applicationId: string;
80
90
  sessionId: string;
81
- session: ISession;
91
+ session: ISession | null;
92
+ sessionInstance: Session | null;
82
93
  }) => void;
83
94
  type SessionUnloadListener = (payload: {
84
95
  applicationId: string;
@@ -90,6 +101,11 @@ type HistoryLoadListener = (payload: {
90
101
  sessionId: string;
91
102
  histories: IHistory[];
92
103
  }) => void;
104
+ type BeforeMessageSendListener = (payload: {
105
+ applicationId: string;
106
+ sessionId: string;
107
+ message: Partial<IChatMessage>;
108
+ }) => boolean | Promise<boolean> | IChatMessage | Promise<Partial<IChatMessage>>;
93
109
  export interface AgentClientDefaultProps {
94
110
  env?: Env;
95
111
  apiUrl?: string;
@@ -135,9 +151,11 @@ export interface AgentClientDefaultProps {
135
151
  onSessionLoad?: SessionLoadListener;
136
152
  onSessionUnload?: SessionUnloadListener;
137
153
  onHistoryLoad?: HistoryLoadListener;
154
+ beforeMessageSend?: BeforeMessageSendListener;
138
155
  bodyStyle?: CSSProperties;
139
156
  prompts?: boolean;
140
157
  features?: AgentFeaturesConfig;
158
+ disabled?: boolean;
141
159
  }
142
160
  interface DataEventListeners {
143
161
  comment: CommentListener;
@@ -145,6 +163,7 @@ interface DataEventListeners {
145
163
  sessionload: SessionLoadListener;
146
164
  sessionunload: SessionUnloadListener;
147
165
  historyload: HistoryLoadListener;
166
+ beforemessagesend: BeforeMessageSendListener;
148
167
  }
149
168
  interface UIEventListeners {
150
169
  }
@@ -179,5 +198,6 @@ export interface AgentClientProps extends AgentClientDefaultProps {
179
198
  bodyStyle?: CSSProperties;
180
199
  apiUrl?: string;
181
200
  sessionId?: string;
201
+ disabled?: boolean;
182
202
  }
183
203
  export {};
@@ -15,3 +15,18 @@ export declare enum shortCutEnum {
15
15
  export declare const FILE_NAME_MAX_LENGTH = 40;
16
16
  export declare const isValidImageUrlWithAnyExtension: (url: string) => boolean;
17
17
  export declare const fileTypes: string[];
18
+ /**
19
+ * 将输入字符串中的 LaTeX 定界符替换为 Markdown 支持的数学公式定界符。
20
+ * 具体来说,会将块级公式的定界符 \[...\] 替换为 $$...$$,行内公式的定界符 \(...\) 替换为 $...$。
21
+ * @param input - 包含 LaTeX 定界符的输入字符串。
22
+ * @returns 替换定界符后的字符串。
23
+ */
24
+ export declare function replaceLatexDelimiters(input: string): string;
25
+ /**
26
+ * 对输入字符串中的反斜杠进行转义处理。
27
+ * 在 Markdown 解析等场景中,反斜杠有特殊含义,
28
+ * 使用此函数可将反斜杠转义,使其作为普通文本显示。
29
+ * @param text - 待转义的输入字符串。
30
+ * @returns 转义后的字符串,特殊字符前会添加反斜杠。
31
+ */
32
+ export declare function escapeSlash(text: string): string;
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@glodon-aiot/agent-cli-ui",
3
- "version": "2.4.7",
3
+ "version": "3.0.4",
4
4
  "module": "./dist/es/index.mjs",
5
5
  "main": "./dist/lib/index.js",
6
6
  "typings": "./dist/src/index.d.ts",
7
7
  "exports": {
8
8
  "import": "./dist/es/index.mjs",
9
9
  "require": "./dist/lib/index.js",
10
- "type": "./dist/src/index.d.ts"
10
+ "types": "./dist/src/index.d.ts"
11
11
  },
12
12
  "files": [
13
13
  "dist"
14
14
  ],
15
15
  "type": "module",
16
+ "types": "dist/src/index.d.ts",
16
17
  "scripts": {
17
18
  "dev": "vite",
18
19
  "start": "vite",
@@ -25,37 +26,35 @@
25
26
  "storybook": "start-storybook -p 6006 -s public",
26
27
  "build-storybook": "build-storybook -s public",
27
28
  "docs": "start-storybook -p 6006",
28
- "commit": "cz",
29
- "vpublish:major": "sh ./publish.sh major",
30
- "vpublish:minor": "sh ./publish.sh minor",
31
- "vpublish:patch": "sh ./publish.sh patch",
32
- "vpublish:premajor": "sh ./publish.sh premajor",
33
- "vpublish:preminor": "sh ./publish.sh preminor",
34
- "vpublish:prepatch": "sh ./publish.sh prepatch",
35
- "vpublish:prerelease": "sh ./publish.sh prerelease",
36
- "vpublish": "npm publish --registry=https://packages.glodon.com/artifactory/api/npm/npm-GGM-releases/"
29
+ "commit": "cz"
37
30
  },
38
31
  "peerDependencies": {
39
32
  "webpack": "*"
40
33
  },
41
34
  "dependencies": {
42
35
  "@ant-design/icons": "^5.3.4",
43
- "@glodon-aiot/agent-cli-sdk": "^2.4.7",
44
- "@glodon-aiot/apis": "^2.4.7",
36
+ "@glodon-aiot/agent-cli-sdk": "^3.0.4",
37
+ "@glodon-aiot/apis": "^3.0.4",
38
+ "@matejmazur/react-mathjax": "^0.1.10",
45
39
  "antd": "4.x",
46
40
  "axios": "0.24.0",
47
41
  "dayjs": "^1.11.13",
42
+ "katex": "^0.16.22",
48
43
  "lodash": "^4.17.21",
49
44
  "react": "^17.0.2",
50
45
  "react-dom": "^17.0.2",
51
46
  "react-infinite-scroll-component": "^6.1.0",
52
47
  "react-markdown": "^9.0.1",
48
+ "react-mathjax": "^1.0.1",
53
49
  "react-quill": "^2.0.0",
54
50
  "react-resizable": "^3.0.5",
55
51
  "react-syntax-highlighter": "^15.5.0",
56
52
  "rehype-external-links": "^3.0.0",
53
+ "rehype-katex": "^7.0.1",
54
+ "rehype-mathjax": "^7.1.0",
57
55
  "rehype-raw": "^7.0.0",
58
- "remark-gfm": "^4.0.0"
56
+ "remark-gfm": "^4.0.0",
57
+ "remark-math": "^6.0.0"
59
58
  },
60
59
  "devDependencies": {
61
60
  "@babel/core": "^7.20.12",
@@ -75,6 +74,7 @@
75
74
  "@types/lodash": "^4",
76
75
  "@types/react": "^17.0.44",
77
76
  "@types/react-dom": "^17.0.17",
77
+ "@types/react-mathjax": "^1",
78
78
  "@types/react-syntax-highlighter": "^15",
79
79
  "@typescript-eslint/eslint-plugin": "^5.35.1",
80
80
  "@typescript-eslint/parser": "^5.35.1",
@@ -119,9 +119,6 @@
119
119
  "last 1 firefox version",
120
120
  "last 1 safari version"
121
121
  ],
122
- "publishConfig": {
123
- "access": "public"
124
- },
125
122
  "config": {
126
123
  "commitizen": {
127
124
  "path": "node_modules/cz-customizable"
@@ -130,6 +127,10 @@
130
127
  "config": ".cz-config.cjs"
131
128
  }
132
129
  },
130
+ "publishConfig": {
131
+ "access": "public",
132
+ "registry": "https://registry.npmjs.org/"
133
+ },
133
134
  "husky": {
134
135
  "hooks": {
135
136
  "commit-msg": "validate-commit-msg"
@@ -1,4 +0,0 @@
1
- var s = {};
2
- export {
3
- s as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var e = {};
2
- export {
3
- e as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var s = { exports: {} };
2
- export {
3
- s as __module
4
- };
@@ -1,4 +0,0 @@
1
- var o = { exports: {} };
2
- export {
3
- o as __module
4
- };