@myun/gimi-chat 0.9.12 → 0.9.13

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.
@@ -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 () {
@@ -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)