@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.
- package/dist/es/AgentClientUI.mjs +97 -110
- package/dist/es/Dialog/AgentChat/index.mjs +516 -467
- package/dist/es/Dialog/ConnectToNetwork/index.mjs +25 -24
- package/dist/es/Dialog/FileCard/index.mjs +48 -55
- package/dist/es/Dialog/FilePreview/index.mjs +35 -42
- package/dist/es/Dialog/HistoryItem/index.mjs +48 -53
- package/dist/es/Dialog/KnowledgeList/index.mjs +55 -48
- package/dist/es/Dialog/PromptManager/index.mjs +29 -36
- package/dist/es/Dialog/PromptSetting/index.mjs +53 -66
- package/dist/es/Dialog/SessionAction/index.mjs +92 -91
- package/dist/es/Dialog/SessionList/index.mjs +135 -121
- package/dist/es/Dialog/SessionListDrawer/index.mjs +8 -7
- package/dist/es/Dialog/SessionRefer/ReferItem/index.mjs +29 -36
- package/dist/es/Dialog/SessionRefer/index.mjs +29 -36
- package/dist/es/Dialog/SessionRelated/index.mjs +17 -14
- package/dist/es/Dialog/UploadKnowledgeFiles/index.mjs +125 -132
- package/dist/es/Dialog/index.mjs +125 -93
- package/dist/es/QuillEditor/index.mjs +91 -86
- package/dist/es/_virtual/index.mjs +2 -2
- package/dist/es/components/Markdown/Image/index.mjs +20 -20
- package/dist/es/components/Markdown/index.mjs +27 -22
- package/dist/es/constant.mjs +8 -5
- package/dist/es/index.mjs +178 -152
- package/dist/es/node_modules/classnames/index.mjs +1 -1
- package/dist/es/node_modules/comma-separated-tokens/index.mjs +13 -0
- package/dist/es/node_modules/devlop/lib/default.mjs +5 -0
- package/dist/es/node_modules/hast-util-from-dom/lib/index.mjs +93 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/create-h.mjs +126 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/index.mjs +8 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/hastscript/lib/svg-case-sensitive-tag-names.mjs +4 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/index.mjs +12 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/aria.mjs +61 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/find.mjs +33 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/html.mjs +368 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/normalize.mjs +6 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/svg.mjs +566 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-insensitive-transform.mjs +7 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/case-sensitive-transform.mjs +6 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/create.mjs +14 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/defined-info.mjs +36 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/info.mjs +28 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/merge.mjs +10 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/schema.mjs +21 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/util/types.mjs +15 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xlink.mjs +19 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xml.mjs +15 -0
- package/dist/es/node_modules/hast-util-from-dom/node_modules/property-information/lib/xmlns.mjs +16 -0
- package/dist/es/node_modules/hast-util-from-html-isomorphic/lib/browser.mjs +16 -0
- package/dist/es/node_modules/hast-util-is-element/lib/index.mjs +61 -0
- package/dist/es/node_modules/hast-util-parse-selector/lib/index.mjs +20 -0
- package/dist/es/node_modules/hast-util-to-text/lib/index.mjs +223 -0
- package/dist/es/node_modules/katex/dist/katex.min.css.mjs +4 -0
- package/dist/es/node_modules/katex/dist/katex.mjs +11700 -0
- package/dist/es/node_modules/longest-streak/index.mjs +12 -0
- package/dist/es/node_modules/mdast-util-math/lib/index.mjs +170 -0
- package/dist/es/node_modules/micromark-extension-math/lib/math-flow.mjs +76 -0
- package/dist/es/node_modules/micromark-extension-math/lib/math-text.mjs +48 -0
- package/dist/es/node_modules/micromark-extension-math/lib/syntax.mjs +15 -0
- package/dist/es/node_modules/micromark-factory-space/index.mjs +15 -0
- package/dist/es/node_modules/micromark-util-character/index.mjs +10 -0
- package/dist/es/node_modules/rehype-katex/lib/index.mjs +83 -0
- package/dist/es/node_modules/remark-math/lib/index.mjs +13 -0
- package/dist/es/node_modules/space-separated-tokens/index.mjs +7 -0
- package/dist/es/node_modules/unist-util-find-after/lib/index.mjs +32 -0
- package/dist/es/node_modules/unist-util-is/lib/index.mjs +81 -0
- package/dist/es/node_modules/unist-util-visit-parents/lib/color.mjs +6 -0
- package/dist/es/node_modules/unist-util-visit-parents/lib/index.mjs +56 -0
- package/dist/es/node_modules/web-namespaces/index.mjs +11 -0
- package/dist/es/utils/index.mjs +44 -27
- package/dist/lib/index.js +278 -138
- package/dist/src/Dialog/AgentChat/index.d.ts +4 -2
- package/dist/src/Dialog/ConnectToNetwork/index.d.ts +1 -0
- package/dist/src/Dialog/KnowledgeList/KnowledgeSelect/index.d.ts +1 -1
- package/dist/src/Dialog/KnowledgeList/index.d.ts +2 -3
- package/dist/src/Dialog/PromptSetting/index.d.ts +1 -0
- package/dist/src/Dialog/SessionAction/index.d.ts +2 -0
- package/dist/src/Dialog/SessionList/index.d.ts +5 -4
- package/dist/src/QuillEditor/index.d.ts +1 -0
- package/dist/src/components/Markdown/Text/index.d.ts +8 -0
- package/dist/src/components/MathJaxLoader/index.d.ts +7 -0
- package/dist/src/components/MathJaxRender/index.d.ts +6 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/contexts/MathJaxContext.d.ts +12 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/types.d.ts +26 -6
- package/dist/src/utils/index.d.ts +15 -0
- package/package.json +18 -17
- package/dist/es/_virtual/index2.mjs +0 -4
- package/dist/es/_virtual/index3.mjs +0 -4
- package/dist/es/_virtual/index4.mjs +0 -4
- package/dist/es/_virtual/minio-zj.mjs +0 -4
- package/dist/es/node_modules/@glodon-aiot/minio/dist/minio-zj.mjs +0 -26485
- package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +0 -54
- package/dist/es/node_modules/base64-js/index.mjs +0 -47
- package/dist/es/node_modules/buffer/index.mjs +0 -927
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +0 -9
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +0 -18
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +0 -24
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +0 -19
- package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +0 -4
- package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +0 -317
- package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +0 -113
- package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +0 -11
- package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +0 -273
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +0 -8
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +0 -87
- package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +0 -52
- package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +0 -21
- package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +0 -23
- package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +0 -21
- package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +0 -14
- package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +0 -39
- package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +0 -28
- package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +0 -105
- package/dist/es/node_modules/ieee754/index.mjs +0 -28
- package/dist/es/node_modules/js-base64/base64.mjs +0 -31
- package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +0 -26
- package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +0 -25
- package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +0 -242
- package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +0 -8
- package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +0 -608
- package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +0 -19
- package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +0 -52
- package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +0 -203
- package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +0 -26
- package/dist/es/packages/agent-cli-sdk/src/AgentSession.mjs +0 -243
- package/dist/es/packages/agent-cli-sdk/src/BotClient.mjs +0 -242
- package/dist/es/packages/agent-cli-sdk/src/Config.mjs +0 -34
- package/dist/es/packages/agent-cli-sdk/src/DialogSession.mjs +0 -281
- package/dist/es/packages/agent-cli-sdk/src/EventBus.mjs +0 -64
- package/dist/es/packages/agent-cli-sdk/src/Logger.mjs +0 -31
- package/dist/es/packages/agent-cli-sdk/src/PayloadTypes.mjs +0 -4
- package/dist/es/packages/agent-cli-sdk/src/Session.mjs +0 -527
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/fetch.mjs +0 -112
- package/dist/es/packages/agent-cli-sdk/src/api/fetchEventSource/parse.mjs +0 -97
- package/dist/es/packages/agent-cli-sdk/src/api/index.mjs +0 -48
- package/dist/es/packages/agent-cli-sdk/src/utils.mjs +0 -11
- package/dist/es/packages/apis/dist/es/aecpilot/cosntant.mjs +0 -5
- package/dist/es/packages/apis/dist/es/aecpilot/model.mjs +0 -9
- package/dist/es/packages/apis/dist/es/aecpilotui/index.mjs +0 -8
- package/dist/es/packages/apis/dist/es/agentcliui/index.mjs +0 -414
- package/dist/es/packages/apis/dist/es/base/index.mjs +0 -154
- package/dist/es/packages/apis/dist/es/cvforce/index.mjs +0 -431
- package/dist/es/packages/apis/dist/es/cvforce/model.mjs +0 -6
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +0 -6
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +0 -10
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +0 -9
- package/dist/es/packages/apis/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +0 -19
- package/dist/es/packages/apis/dist/es/utils/fetchEventSource/fetch.mjs +0 -106
- 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
|
|
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;
|
|
@@ -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
|
|
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
|
|
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
|
|
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;
|
package/dist/src/constant.d.ts
CHANGED
|
@@ -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/
|
|
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 {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -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
|
|
65
|
-
visible
|
|
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": "
|
|
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
|
-
"
|
|
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": "^
|
|
44
|
-
"@glodon-aiot/apis": "^
|
|
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"
|