@myun/gimi-chat 0.1.9 → 0.2.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.
|
@@ -5,7 +5,6 @@ var PresetAgentContent = function PresetAgentContent(_ref) {
|
|
|
5
5
|
questionList = _ref.questionList,
|
|
6
6
|
setInputValue = _ref.setInputValue,
|
|
7
7
|
layout = _ref.layout;
|
|
8
|
-
if (!questionList || questionList.length === 0) return null;
|
|
9
8
|
var rowListStyle = {
|
|
10
9
|
flexDirection: 'row',
|
|
11
10
|
flexWrap: 'wrap',
|
|
@@ -9,7 +9,7 @@ interface StreamChatCallbacks {
|
|
|
9
9
|
/**
|
|
10
10
|
* 处理流式聊天逻辑
|
|
11
11
|
*/
|
|
12
|
-
export declare const useChatStream: () => {
|
|
12
|
+
export declare const useChatStream: (platform: string) => {
|
|
13
13
|
fetchChatStream: (messageId: string | number, reSumeInfo?: any, callbacks?: StreamChatCallbacks, method?: 'GET' | 'POST', requestUrl?: string) => Promise<void>;
|
|
14
14
|
abortStream: () => void;
|
|
15
15
|
setIgnoreOnMessage: (ignore: boolean) => void;
|
|
@@ -16,7 +16,7 @@ import { setIsMsgRecieving } from "../store/slices/gimiMenuSlice";
|
|
|
16
16
|
/**
|
|
17
17
|
* 处理流式聊天逻辑
|
|
18
18
|
*/
|
|
19
|
-
export var useChatStream = function useChatStream() {
|
|
19
|
+
export var useChatStream = function useChatStream(platform) {
|
|
20
20
|
var esAbortRef = useRef(null);
|
|
21
21
|
var esRef = useRef(null);
|
|
22
22
|
var ignoreOnMessageRef = useRef(true);
|
|
@@ -91,7 +91,7 @@ export var useChatStream = function useChatStream() {
|
|
|
91
91
|
|
|
92
92
|
// 获取 lastEventId
|
|
93
93
|
currentLastEventId = getLastEventId(messageId); // 构建URL
|
|
94
|
-
url = requestUrl ? "https://".concat(baseUrlRef.current).concat(requestUrl) : Object.keys(reSumeInfo).length === 0 ? "https://".concat(baseUrlRef.current, "/mbot/web/chat/execute?messageId=").concat(messageId) : "https://".concat(baseUrlRef.current, "/mbot/web/agent-message/getSwitchStreamOut?messageId=").concat(messageId, "&lastEventId=").concat(currentLastEventId);
|
|
94
|
+
url = requestUrl ? "https://".concat(baseUrlRef.current).concat(requestUrl) : Object.keys(reSumeInfo).length === 0 ? "https://".concat(baseUrlRef.current, "/mbot/web/chat/execute?messageId=").concat(messageId, "&preview=").concat(platform === 'preview' ? 1 : 0) : "https://".concat(baseUrlRef.current, "/mbot/web/agent-message/getSwitchStreamOut?messageId=").concat(messageId, "&lastEventId=").concat(currentLastEventId, "&preview=").concat(platform === 'preview' ? 1 : 0);
|
|
95
95
|
fullResponse = Object.keys(reSumeInfo).length > 0 ? reSumeInfo.content : '';
|
|
96
96
|
reasoningResponse = Object.keys(reSumeInfo).length > 0 ? reSumeInfo.reasoningContent : '';
|
|
97
97
|
_context.prev = 14;
|
|
@@ -67,7 +67,7 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
67
67
|
var _useChatMessage = useChatMessage(),
|
|
68
68
|
createUserChat = _useChatMessage.createUserChat,
|
|
69
69
|
createAiChat = _useChatMessage.createAiChat;
|
|
70
|
-
var _useChatStream = useChatStream(),
|
|
70
|
+
var _useChatStream = useChatStream(platform),
|
|
71
71
|
fetchChatStreamHook = _useChatStream.fetchChatStream,
|
|
72
72
|
setIgnoreOnMessage = _useChatStream.setIgnoreOnMessage,
|
|
73
73
|
streamEsAbortRef = _useChatStream.esAbortRef;
|
|
@@ -824,7 +824,8 @@ var useCommonChatAPI = function useCommonChatAPI(containerRef, platform, stopTTS
|
|
|
824
824
|
params = _objectSpread({
|
|
825
825
|
content: val,
|
|
826
826
|
conversationId: conversationId || conversationIdRef.current,
|
|
827
|
-
conversationType: (_agentObjRef$current2 = agentObjRef.current) === null || _agentObjRef$current2 === void 0 ? void 0 : _agentObjRef$current2.conversationType
|
|
827
|
+
conversationType: (_agentObjRef$current2 = agentObjRef.current) === null || _agentObjRef$current2 === void 0 ? void 0 : _agentObjRef$current2.conversationType,
|
|
828
|
+
preview: platform === 'preview' ? 1 : 0
|
|
828
829
|
}, currentBussinessParams);
|
|
829
830
|
_fileList = fileListRef.current;
|
|
830
831
|
if ((_fileList === null || _fileList === void 0 ? void 0 : _fileList.length) > 0) {
|