@chat-lab/ui 0.1.0-beta.51 → 0.1.0-beta.52
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/components/Chatkit/index.cjs +42 -18
- package/dist/components/Chatkit/index.cjs.map +1 -1
- package/dist/components/Chatkit/index.d.ts.map +1 -1
- package/dist/components/Chatkit/index.js +42 -18
- package/dist/components/Chatkit/index.js.map +1 -1
- package/dist/components/Chatkit/types.d.ts +1 -0
- package/dist/components/Chatkit/types.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.cjs +27 -0
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.cjs.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.d.ts +4 -0
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.js +27 -0
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.js.map +1 -1
- package/dist/hooks/useSkillAgent/index.cjs +13 -3
- package/dist/hooks/useSkillAgent/index.cjs.map +1 -1
- package/dist/hooks/useSkillAgent/index.d.ts +3 -1
- package/dist/hooks/useSkillAgent/index.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/index.js +13 -3
- package/dist/hooks/useSkillAgent/index.js.map +1 -1
- package/dist/hooks/useThread.d.ts +24 -0
- package/dist/hooks/useThread.d.ts.map +1 -1
- package/dist/packages/core/dist/index.cjs +7 -6
- package/dist/packages/core/dist/index.cjs.map +1 -1
- package/dist/packages/core/dist/index.js +7 -6
- package/dist/packages/core/dist/index.js.map +1 -1
- package/dist/utils/convertToAssistantMessage.cjs +0 -1
- package/dist/utils/convertToAssistantMessage.cjs.map +1 -1
- package/dist/utils/convertToAssistantMessage.d.ts.map +1 -1
- package/dist/utils/convertToAssistantMessage.js +0 -1
- package/dist/utils/convertToAssistantMessage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"sourcesContent":["import {\n ChatController,\n createThreadManagerState,\n ThreadMessageManager,\n AdkPlugin,\n} from '@chat-lab/core';\nimport { useRef } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport SkillAgentPlugin from './SkillAgentPlugin';\nimport { useMemoizedFn } from 'ahooks';\n\nexport interface SkillAgentOptions {\n api: string;\n sessionId?: string;\n adkOptions: {\n appName: string;\n userID: string;\n };\n query?: Record<string, string>;\n onError?: (error: Error) => void;\n onStateChange?: (state:
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"sourcesContent":["import {\n ChatController,\n createThreadManagerState,\n ThreadMessageManager,\n AdkPlugin,\n} from '@chat-lab/core';\nimport { useRef } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport SkillAgentPlugin from './SkillAgentPlugin';\nimport { useMemoizedFn } from 'ahooks';\n\nexport interface SkillAgentOptions {\n api: string;\n sessionId?: string;\n adkOptions: {\n appName: string;\n userID: string;\n };\n query?: Record<string, string>;\n onError?: (error: Error) => void;\n onStateChange?: (state: {}) => void;\n onUploadFiles?: (files: File[]) => Promise<string[]>;\n}\n\nconst useSkillAgent = (options: SkillAgentOptions) => {\n const chatControllerRef = useRef<ChatController>();\n const pluginRef = useRef<SkillAgentPlugin>();\n if (!pluginRef.current) {\n pluginRef.current = new SkillAgentPlugin({\n onStateChange: options.onStateChange,\n onUploadFiles: options.onUploadFiles,\n });\n }\n pluginRef.current.updateOptions(options);\n if (!chatControllerRef.current) {\n const store = new ThreadMessageManager(createThreadManagerState());\n const plugin = pluginRef.current;\n const adlPlugin = new AdkPlugin({\n appName: options.adkOptions.appName,\n userId: options.adkOptions.userID,\n });\n chatControllerRef.current = new ChatController({\n requestOptions: {\n api: options.api,\n meta: options.query,\n headers: {\n Authorization: 'Bearer',\n },\n defaultParams: {\n streaming: true,\n },\n },\n protocolOptions: {\n protocol: 'ADK',\n },\n storeManager: store,\n plugins: [plugin, adlPlugin],\n });\n }\n\n const sendMessage = useMemoizedFn(({ message }: { message: string }) => {\n chatControllerRef.current?.sendMessage({\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n });\n });\n const ready = useMemoizedFn(({ sessionId }: { sessionId: string }) => {\n chatControllerRef.current\n ?.addThread({\n id: sessionId,\n name: sessionId,\n metadata: {},\n sending: false,\n messages: [],\n })\n .then(() => {\n chatControllerRef.current?.setCurrentThread(sessionId);\n });\n });\n\n const getDeltaState = useMemoizedFn(() => {\n return chatControllerRef.current?.getCurrentThread();\n });\n return {\n controllerRef: chatControllerRef,\n sendMessage,\n ready,\n getDeltaState,\n };\n};\n\nexport { useSkillAgent };\n"],"names":["useRef","ThreadMessageManager","createThreadManagerState","AdkPlugin","ChatController","useMemoizedFn"],"mappings":";;;;;;;AAwBA,MAAM,aAAa,GAAG,CAAC,OAA0B,KAAI;AACnD,IAAA,MAAM,iBAAiB,GAAGA,YAAM,EAAkB,CAAC;AACnD,IAAA,MAAM,SAAS,GAAGA,YAAM,EAAoB,CAAC;AAC7C,IAAA,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;AACtB,QAAA,SAAS,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC;YACvC,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,aAAa,EAAE,OAAO,CAAC,aAAa;AACrC,SAAA,CAAC,CAAC;KACJ;AACD,IAAA,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACzC,IAAA,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE;QAC9B,MAAM,KAAK,GAAG,IAAIC,0BAAoB,CAACC,8BAAwB,EAAE,CAAC,CAAC;AACnE,QAAA,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;AACjC,QAAA,MAAM,SAAS,GAAG,IAAIC,eAAS,CAAC;AAC9B,YAAA,OAAO,EAAE,OAAO,CAAC,UAAU,CAA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ACzD,SAAC,CAAC,CAAC;AACP,KAAC,CAAC,CAAC;AAEH,IAAA,MAAM,aAAa,GAAGA,OAAa,CAAC,MAAK;AACvC,QAAA,OAAO,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACvD,KAAC,CAAC,CAAC;IACH,OAAO;AACL,QAAA,aAAa,EAAE,iBAAiB;QAChC,WAAW;QACX,KAAK;QACL,aAAa;KACd,CAAC;AACJ;;;;"}
|
|
@@ -8,7 +8,8 @@ export interface SkillAgentOptions {
|
|
|
8
8
|
};
|
|
9
9
|
query?: Record<string, string>;
|
|
10
10
|
onError?: (error: Error) => void;
|
|
11
|
-
onStateChange?: (state:
|
|
11
|
+
onStateChange?: (state: {}) => void;
|
|
12
|
+
onUploadFiles?: (files: File[]) => Promise<string[]>;
|
|
12
13
|
}
|
|
13
14
|
declare const useSkillAgent: (options: SkillAgentOptions) => {
|
|
14
15
|
controllerRef: import("react").MutableRefObject<ChatController<import("@chat-lab/core").ChatMessage<import("@chat-lab/core").BaseMessage>> | undefined>;
|
|
@@ -18,6 +19,7 @@ declare const useSkillAgent: (options: SkillAgentOptions) => {
|
|
|
18
19
|
ready: (this: unknown, args_0: {
|
|
19
20
|
sessionId: string;
|
|
20
21
|
}) => void;
|
|
22
|
+
getDeltaState: (this: unknown) => import("@chat-lab/core").Thread<import("@chat-lab/core").ChatMessage<import("@chat-lab/core").BaseMessage>> | null | undefined;
|
|
21
23
|
};
|
|
22
24
|
export { useSkillAgent };
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAIf,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACtD;AAED,QAAA,MAAM,aAAa,GAAI,SAAS,iBAAiB;;;iBAoCY,MAAM;;;mBAUR,MAAM;;;CAuBhE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -5,11 +5,17 @@ import useMemoizedFn from '../../node_modules/.pnpm/ahooks@3.9.6_react-dom@17.0.
|
|
|
5
5
|
|
|
6
6
|
const useSkillAgent = (options) => {
|
|
7
7
|
const chatControllerRef = useRef();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const pluginRef = useRef();
|
|
9
|
+
if (!pluginRef.current) {
|
|
10
|
+
pluginRef.current = new SkillAgentPlugin({
|
|
11
11
|
onStateChange: options.onStateChange,
|
|
12
|
+
onUploadFiles: options.onUploadFiles,
|
|
12
13
|
});
|
|
14
|
+
}
|
|
15
|
+
pluginRef.current.updateOptions(options);
|
|
16
|
+
if (!chatControllerRef.current) {
|
|
17
|
+
const store = new ThreadMessageManager(createThreadManagerState());
|
|
18
|
+
const plugin = pluginRef.current;
|
|
13
19
|
const adlPlugin = new AdkPlugin({
|
|
14
20
|
appName: options.adkOptions.appName,
|
|
15
21
|
userId: options.adkOptions.userID,
|
|
@@ -55,10 +61,14 @@ const useSkillAgent = (options) => {
|
|
|
55
61
|
chatControllerRef.current?.setCurrentThread(sessionId);
|
|
56
62
|
});
|
|
57
63
|
});
|
|
64
|
+
const getDeltaState = useMemoizedFn(() => {
|
|
65
|
+
return chatControllerRef.current?.getCurrentThread();
|
|
66
|
+
});
|
|
58
67
|
return {
|
|
59
68
|
controllerRef: chatControllerRef,
|
|
60
69
|
sendMessage,
|
|
61
70
|
ready,
|
|
71
|
+
getDeltaState,
|
|
62
72
|
};
|
|
63
73
|
};
|
|
64
74
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"sourcesContent":["import {\n ChatController,\n createThreadManagerState,\n ThreadMessageManager,\n AdkPlugin,\n} from '@chat-lab/core';\nimport { useRef } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport SkillAgentPlugin from './SkillAgentPlugin';\nimport { useMemoizedFn } from 'ahooks';\n\nexport interface SkillAgentOptions {\n api: string;\n sessionId?: string;\n adkOptions: {\n appName: string;\n userID: string;\n };\n query?: Record<string, string>;\n onError?: (error: Error) => void;\n onStateChange?: (state:
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useSkillAgent/index.tsx"],"sourcesContent":["import {\n ChatController,\n createThreadManagerState,\n ThreadMessageManager,\n AdkPlugin,\n} from '@chat-lab/core';\nimport { useRef } from 'react';\nimport { v4 as uuid } from 'uuid';\nimport SkillAgentPlugin from './SkillAgentPlugin';\nimport { useMemoizedFn } from 'ahooks';\n\nexport interface SkillAgentOptions {\n api: string;\n sessionId?: string;\n adkOptions: {\n appName: string;\n userID: string;\n };\n query?: Record<string, string>;\n onError?: (error: Error) => void;\n onStateChange?: (state: {}) => void;\n onUploadFiles?: (files: File[]) => Promise<string[]>;\n}\n\nconst useSkillAgent = (options: SkillAgentOptions) => {\n const chatControllerRef = useRef<ChatController>();\n const pluginRef = useRef<SkillAgentPlugin>();\n if (!pluginRef.current) {\n pluginRef.current = new SkillAgentPlugin({\n onStateChange: options.onStateChange,\n onUploadFiles: options.onUploadFiles,\n });\n }\n pluginRef.current.updateOptions(options);\n if (!chatControllerRef.current) {\n const store = new ThreadMessageManager(createThreadManagerState());\n const plugin = pluginRef.current;\n const adlPlugin = new AdkPlugin({\n appName: options.adkOptions.appName,\n userId: options.adkOptions.userID,\n });\n chatControllerRef.current = new ChatController({\n requestOptions: {\n api: options.api,\n meta: options.query,\n headers: {\n Authorization: 'Bearer',\n },\n defaultParams: {\n streaming: true,\n },\n },\n protocolOptions: {\n protocol: 'ADK',\n },\n storeManager: store,\n plugins: [plugin, adlPlugin],\n });\n }\n\n const sendMessage = useMemoizedFn(({ message }: { message: string }) => {\n chatControllerRef.current?.sendMessage({\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n });\n });\n const ready = useMemoizedFn(({ sessionId }: { sessionId: string }) => {\n chatControllerRef.current\n ?.addThread({\n id: sessionId,\n name: sessionId,\n metadata: {},\n sending: false,\n messages: [],\n })\n .then(() => {\n chatControllerRef.current?.setCurrentThread(sessionId);\n });\n });\n\n const getDeltaState = useMemoizedFn(() => {\n return chatControllerRef.current?.getCurrentThread();\n });\n return {\n controllerRef: chatControllerRef,\n sendMessage,\n ready,\n getDeltaState,\n };\n};\n\nexport { useSkillAgent };\n"],"names":[],"mappings":";;;;;AAwBA,MAAM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AC,CAAC;KACJ;IAED,MAAM,WAAW,GAAG,aAAa,CAAC,CAAC,EAAE,OAAO,EAAuB,KAAI;AACrE,QAAA,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC;AACrC,YAAA,OAAO,EAAE;AACP,gBAAA;AACE,oBAAA,IAAI,EAAE,MAAM;AACZ,oBAAA,IAAI,EAAE,OAAO;AACd,iBAAA;AACF,aAAA;AACF,SAAA,CAAC,CAAC;AACL,KAAC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,EAAE,SAAS,EAAyB,KAAI;AACnE,QAAA,iBAAiB,CAAC,OAAO;AACvB,cAAE,SAAS,CAAC;AACV,YAAA,EAAE,EAAE,SAAS;AACb,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,QAAQ,EAAE,EAAE;SACb,CAAC;aACD,IAAI,CAAC,MAAK;AACT,YAAA,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACzD,SAAC,CAAC,CAAC;AACP,KAAC,CAAC,CAAC;AAEH,IAAA,MAAM,aAAa,GAAG,aAAa,CAAC,MAAK;AACvC,QAAA,OAAO,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACvD,KAAC,CAAC,CAAC;IACH,OAAO;AACL,QAAA,aAAa,EAAE,iBAAiB;QAChC,WAAW;QACX,KAAK;QACL,aAAa;KACd,CAAC;AACJ;;;;"}
|
|
@@ -24,6 +24,18 @@ declare const useThread: () => {
|
|
|
24
24
|
readonly url: string;
|
|
25
25
|
readonly status: "init" | "uploading" | "success" | "error";
|
|
26
26
|
readonly type: string;
|
|
27
|
+
readonly file?: {
|
|
28
|
+
readonly lastModified: number;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly webkitRelativePath: string;
|
|
31
|
+
readonly size: number;
|
|
32
|
+
readonly type: string;
|
|
33
|
+
readonly arrayBuffer: () => Promise<ArrayBuffer>;
|
|
34
|
+
readonly bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
35
|
+
readonly slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
36
|
+
readonly stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
37
|
+
readonly text: () => Promise<string>;
|
|
38
|
+
} | undefined;
|
|
27
39
|
readonly mimeType: string;
|
|
28
40
|
readonly createdAt?: number | undefined;
|
|
29
41
|
}[] | undefined;
|
|
@@ -101,6 +113,18 @@ declare const useThread: () => {
|
|
|
101
113
|
readonly url: string;
|
|
102
114
|
readonly status: "init" | "uploading" | "success" | "error";
|
|
103
115
|
readonly type: string;
|
|
116
|
+
readonly file?: {
|
|
117
|
+
readonly lastModified: number;
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly webkitRelativePath: string;
|
|
120
|
+
readonly size: number;
|
|
121
|
+
readonly type: string;
|
|
122
|
+
readonly arrayBuffer: () => Promise<ArrayBuffer>;
|
|
123
|
+
readonly bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
124
|
+
readonly slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
125
|
+
readonly stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
126
|
+
readonly text: () => Promise<string>;
|
|
127
|
+
} | undefined;
|
|
104
128
|
readonly mimeType: string;
|
|
105
129
|
readonly createdAt?: number | undefined;
|
|
106
130
|
}[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThread.d.ts","sourceRoot":"","sources":["../../src/hooks/useThread.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"useThread.d.ts","sourceRoot":"","sources":["../../src/hooks/useThread.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -141,6 +141,7 @@ var AdkProtocol = class extends BaseProtocols_default {
|
|
|
141
141
|
this.protocol = ProtocolEnum.ADK;
|
|
142
142
|
this.authors = [];
|
|
143
143
|
this.omitCompleteText = options.omitCompleteText == true;
|
|
144
|
+
this.splitText = options.splitText || false;
|
|
144
145
|
this.protocolName = options.protocolName || options.protocol;
|
|
145
146
|
}
|
|
146
147
|
onStartSend() {
|
|
@@ -285,7 +286,7 @@ var AdkProtocol = class extends BaseProtocols_default {
|
|
|
285
286
|
generateRequestBody(request) {
|
|
286
287
|
const { userMessage, defaultParams, dynamicParams } = request;
|
|
287
288
|
const attachParts = userMessage.attaches?.map((item) => {
|
|
288
|
-
if (item.url.startsWith("https://") || item.url.startsWith("http://")) {
|
|
289
|
+
if (item.url.startsWith("https://") || item.url.startsWith("http://") || item.url.startsWith("/")) {
|
|
289
290
|
return {
|
|
290
291
|
fileData: {
|
|
291
292
|
displayName: item.attachId,
|
|
@@ -1578,10 +1579,9 @@ var AdkPlugin = class extends ChatkitPlugin {
|
|
|
1578
1579
|
["sessionInited"]: true,
|
|
1579
1580
|
sessionId: data.id,
|
|
1580
1581
|
["isInitingSession"]: false,
|
|
1581
|
-
["x-session-id"]: xSessionId
|
|
1582
|
+
["x-session-id"]: xSessionId,
|
|
1583
|
+
deltaStatus: data.state
|
|
1582
1584
|
},
|
|
1583
|
-
// messages: data?.events?.map(
|
|
1584
|
-
// (chunk: {
|
|
1585
1585
|
// id: string;
|
|
1586
1586
|
// author: string;
|
|
1587
1587
|
// content: { parts: any[] };
|
|
@@ -2026,7 +2026,8 @@ var ChatController = class {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
const shouldSend = {
|
|
2028
2028
|
dynamicParams: hookContext.dynamicParams,
|
|
2029
|
-
requestOptions: hookContext.extraRequestOptions
|
|
2029
|
+
requestOptions: hookContext.extraRequestOptions,
|
|
2030
|
+
userMessage: hookContext.userMessage
|
|
2030
2031
|
};
|
|
2031
2032
|
const storeManager = this.store;
|
|
2032
2033
|
try {
|
|
@@ -2034,7 +2035,7 @@ var ChatController = class {
|
|
|
2034
2035
|
const requestBody = protocolAdaptor.generateRequestBody({
|
|
2035
2036
|
dynamicParams: shouldSend.dynamicParams,
|
|
2036
2037
|
defaultParams: this.requestOptions.defaultParams || {},
|
|
2037
|
-
userMessage,
|
|
2038
|
+
userMessage: shouldSend.userMessage,
|
|
2038
2039
|
thread,
|
|
2039
2040
|
contextMessages: allMessages
|
|
2040
2041
|
});
|