@myun/gimi-chat 0.9.12 → 0.9.14
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/apis/useApi.js +3 -1
- package/dist/components/custom-render/WordCard.js +2 -1
- package/dist/components/file-card/index.d.ts +1 -0
- package/dist/components/file-card/index.js +5 -2
- package/dist/hooks/useChatStream.js +3 -1
- package/dist/hooks/useCommonChatAPI.js +3 -2
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.d.ts +1 -0
- package/dist/utils/tools.js +13 -1
- package/package.json +1 -1
package/dist/apis/useApi.js
CHANGED
|
@@ -3,6 +3,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
5
|
import { createFetch } from "./fetch";
|
|
6
|
+
import { getTimeZone } from "../utils/tools";
|
|
6
7
|
var useApi = function useApi(baseUrl, authToken) {
|
|
7
8
|
var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'zh-cn';
|
|
8
9
|
var token = authToken;
|
|
@@ -14,7 +15,8 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
14
15
|
'Authorization': 'Bearer ' + token,
|
|
15
16
|
'X-Mc-Domain': location.hostname,
|
|
16
17
|
'Content-Type': 'application/json',
|
|
17
|
-
'Language': locale
|
|
18
|
+
'Language': locale,
|
|
19
|
+
'X-Timezone': getTimeZone()
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
var getAiCorrection = /*#__PURE__*/function () {
|
|
@@ -81,7 +81,9 @@ export var MultipleFileCard = function MultipleFileCard(_ref2) {
|
|
|
81
81
|
onDownloadCallback = _ref2.onDownloadCallback,
|
|
82
82
|
model = _ref2.model,
|
|
83
83
|
_ref2$showAll = _ref2.showAll,
|
|
84
|
-
showAll = _ref2$showAll === void 0 ? false : _ref2$showAll
|
|
84
|
+
showAll = _ref2$showAll === void 0 ? false : _ref2$showAll,
|
|
85
|
+
_ref2$disablePreview = _ref2.disablePreview,
|
|
86
|
+
disablePreview = _ref2$disablePreview === void 0 ? false : _ref2$disablePreview;
|
|
85
87
|
var dispatch = useAppDispatch();
|
|
86
88
|
var _useTranslation2 = useTranslation(),
|
|
87
89
|
t = _useTranslation2.t;
|
|
@@ -111,7 +113,8 @@ export var MultipleFileCard = function MultipleFileCard(_ref2) {
|
|
|
111
113
|
key: index,
|
|
112
114
|
downloadText: t('file.download'),
|
|
113
115
|
onDownloadCallback: onDownloadCallback,
|
|
114
|
-
model: model
|
|
116
|
+
model: model,
|
|
117
|
+
disablePreview: disablePreview
|
|
115
118
|
});
|
|
116
119
|
}), hasMore && /*#__PURE__*/React.createElement("div", {
|
|
117
120
|
className: styles.all,
|
|
@@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
14
14
|
import { useLastEventId } from "./useLastEventId";
|
|
15
15
|
import { useAppSelector, useAppDispatch } from "../store/hooks";
|
|
16
16
|
import { setIsMsgRecieving } from "../store/slices/gimiMenuSlice";
|
|
17
|
+
import { getTimeZone } from "../utils/tools";
|
|
17
18
|
/**
|
|
18
19
|
* 处理流式聊天逻辑
|
|
19
20
|
*/
|
|
@@ -106,7 +107,8 @@ export var useChatStream = function useChatStream(platform) {
|
|
|
106
107
|
'Cache-Control': 'no-cache',
|
|
107
108
|
Connection: 'keep-alive',
|
|
108
109
|
Authorization: "Bearer ".concat(tokenRef.current),
|
|
109
|
-
'Language': i18n.language
|
|
110
|
+
'Language': i18n.language,
|
|
111
|
+
'X-Timezone': getTimeZone()
|
|
110
112
|
}, method === 'POST' ? {
|
|
111
113
|
'Content-Type': 'application/json'
|
|
112
114
|
} : {}),
|
|
@@ -24,7 +24,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
24
24
|
import { Toast } from "@douyinfe/semi-ui";
|
|
25
25
|
import { useAppDispatch, useAppSelector } from "../store/hooks";
|
|
26
26
|
import { setMessageList, setFileList, setConversationId, setAgentDetail, setBusinessParams, setAutoLoadConversation, updateState, closeSidebar } from "../store/slices/gimiMenuSlice";
|
|
27
|
-
import { fileValidation, parseMessageContent, processString } from "../utils/tools";
|
|
27
|
+
import { fileValidation, getTimeZone, parseMessageContent, processString } from "../utils/tools";
|
|
28
28
|
import { filterPropmptFromUserInput } from "../utils/tools";
|
|
29
29
|
import { useChatMessage } from "./useChatMessage";
|
|
30
30
|
import { useChatStream } from "./useChatStream";
|
|
@@ -738,7 +738,8 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
738
738
|
headers: {
|
|
739
739
|
'Content-Type': 'application/json',
|
|
740
740
|
Authorization: "Bearer ".concat(tokenRef.current),
|
|
741
|
-
'Language': i18n.language
|
|
741
|
+
'Language': i18n.language,
|
|
742
|
+
'X-Timezone': getTimeZone()
|
|
742
743
|
},
|
|
743
744
|
signal: signal,
|
|
744
745
|
body: JSON.stringify(params)
|