@myun/gimi-chat 0.2.0 → 0.2.2

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.
@@ -55,5 +55,8 @@ declare const useApi: (baseUrl?: string, authToken?: string) => {
55
55
  }) => Promise<FetchResponse<any>>;
56
56
  getReferenceVideoList: (params: any) => Promise<FetchResponse<any>>;
57
57
  getReferenceCourseList: (params: any) => Promise<FetchResponse<any>>;
58
+ checkRetry: (params: {
59
+ conversationId: number;
60
+ }) => Promise<FetchResponse<any>>;
58
61
  };
59
62
  export default useApi;
@@ -6,12 +6,14 @@ import { createFetch } from "./fetch";
6
6
  import { useAppSelector } from "../store/hooks";
7
7
  import React from 'react';
8
8
  var useApi = function useApi(baseUrl, authToken) {
9
- var token = authToken || useAppSelector(function (state) {
9
+ var storedToken = useAppSelector(function (state) {
10
10
  return state.gimiMenu.token;
11
11
  });
12
- var baseURL = baseUrl || useAppSelector(function (state) {
12
+ var storedBaseURL = useAppSelector(function (state) {
13
13
  return state.gimiMenu.baseUrl;
14
14
  });
15
+ var token = authToken || storedToken;
16
+ var baseURL = baseUrl || storedBaseURL;
15
17
  var apiRef = React.useRef(createFetch({
16
18
  baseURL: baseURL,
17
19
  timeout: 10000,
@@ -401,6 +403,24 @@ var useApi = function useApi(baseUrl, authToken) {
401
403
  return _ref20.apply(this, arguments);
402
404
  };
403
405
  }();
406
+ var checkRetry = /*#__PURE__*/function () {
407
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
408
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
409
+ while (1) switch (_context20.prev = _context20.next) {
410
+ case 0:
411
+ return _context20.abrupt("return", apiRef.current.get('/mbot/web/agent-message/retry/judge', {
412
+ params: params
413
+ }));
414
+ case 1:
415
+ case "end":
416
+ return _context20.stop();
417
+ }
418
+ }, _callee20);
419
+ }));
420
+ return function checkRetry(_x19) {
421
+ return _ref21.apply(this, arguments);
422
+ };
423
+ }();
404
424
  return {
405
425
  getSkillData: getSkillData,
406
426
  getProductList: getProductList,
@@ -420,7 +440,8 @@ var useApi = function useApi(baseUrl, authToken) {
420
440
  deleteConversationById: deleteConversationById,
421
441
  getAiCorrection: getAiCorrection,
422
442
  getReferenceVideoList: getReferenceVideoList,
423
- getReferenceCourseList: getReferenceCourseList
443
+ getReferenceCourseList: getReferenceCourseList,
444
+ checkRetry: checkRetry
424
445
  };
425
446
  };
426
447
  export default useApi;
@@ -19,7 +19,7 @@ import IconFont from "../../../components/iconfont-com";
19
19
  import styles from "./index.module.css";
20
20
  import { replaceBraces } from "../../../utils/tools";
21
21
  import { useAppDispatch, useAppSelector } from "../../../store/hooks";
22
- import { getChatHistoryList } from "../../../store/slices/gimiMenuSlice";
22
+ import { getChatHistoryList, setMessageList } from "../../../store/slices/gimiMenuSlice";
23
23
  import useApi from "../../../apis/useApi";
24
24
  var confirm = Modal.confirm;
25
25
  var hostoryItemIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202508/28/c5b09_20250828113135.png';
@@ -48,10 +48,12 @@ var HistoryList = function HistoryList() {
48
48
  var loadMoreData = function loadMoreData() {
49
49
  if (!loading && !loadingMore && hasMore) {
50
50
  var nextPage = params.pageIndex + 1;
51
- // dispatch({
52
- // type: 'gimiMenu/updateParams',
53
- // payload: { pageIndex: nextPage },
54
- // });
51
+ dispatch({
52
+ type: 'gimiMenu/updateParams',
53
+ payload: {
54
+ pageIndex: nextPage
55
+ }
56
+ });
55
57
  dispatch(getChatHistoryList({
56
58
  pageIndex: nextPage,
57
59
  pageSize: params.pageSize,
@@ -156,6 +158,9 @@ var HistoryList = function HistoryList() {
156
158
  conversationId: ''
157
159
  }
158
160
  });
161
+ dispatch(setMessageList({
162
+ messageList: []
163
+ }));
159
164
  onRefresh();
160
165
  } else {
161
166
  onRefresh();
@@ -179,7 +184,6 @@ var HistoryList = function HistoryList() {
179
184
  };
180
185
  }();
181
186
  var handleClickHistoryItem = function handleClickHistoryItem(item) {
182
- console.log('handleClickHistoryItem', item.id);
183
187
  setHoveredIndex(null);
184
188
  dispatch({
185
189
  type: 'gimiMenu/setConversationId',
@@ -1,108 +1,10 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
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
- 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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useEffect, useRef, useState } from 'react';
12
- import ChatInput from "../../../components/chat-input";
1
+ import React from 'react';
13
2
  import "./index.css";
14
- import useChatVoice from "../../../hooks/useChatVoice";
15
- import { useAppDispatch, useAppSelector } from "../../../store/hooks";
16
- import useApi from "../../../apis/useApi";
17
- import { Toast } from '@douyinfe/semi-ui';
3
+ import { useAppSelector } from "../../../store/hooks";
18
4
  var NewMain = function NewMain() {
19
- var _useState = useState(false),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- loading = _useState2[0],
22
- setLoading = _useState2[1];
23
- var dispatch = useAppDispatch();
24
- var chatInputRef = React.useRef(null);
25
5
  var agentObj = useAppSelector(function (state) {
26
6
  return state.gimiMenu.agentObj;
27
7
  });
28
- console.log('agentObj', agentObj);
29
- var agentRef = useRef(agentObj);
30
- var _useChatVoice = useChatVoice(),
31
- isRecording = _useChatVoice.isRecording,
32
- recordingCount = _useChatVoice.recordingCount,
33
- asrText = _useChatVoice.asrText,
34
- shortAsrClick = _useChatVoice.shortAsrClick,
35
- isExecuting = _useChatVoice.isExecuting,
36
- playTTSByText = _useChatVoice.playTTSByText,
37
- stopTTSByText = _useChatVoice.stopTTSByText,
38
- isPlaying = _useChatVoice.isPlaying;
39
- var _useApi = useApi(),
40
- createRoomId = _useApi.createRoomId;
41
- var handleInputSend = /*#__PURE__*/function () {
42
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(content) {
43
- return _regeneratorRuntime().wrap(function _callee$(_context) {
44
- while (1) switch (_context.prev = _context.next) {
45
- case 0:
46
- if (!loading) {
47
- _context.next = 2;
48
- break;
49
- }
50
- return _context.abrupt("return");
51
- case 2:
52
- if (!(content.trim() === '')) {
53
- _context.next = 5;
54
- break;
55
- }
56
- Toast.warning('请输入内容');
57
- return _context.abrupt("return");
58
- case 5:
59
- if (navigator.onLine) {
60
- _context.next = 8;
61
- break;
62
- }
63
- Toast.error('无法连接到网络');
64
- return _context.abrupt("return");
65
- case 8:
66
- // setLoading(true)
67
- dispatch({
68
- type: 'gimiMenu/setInitMsg',
69
- payload: {
70
- initMsg: content
71
- }
72
- });
73
-
74
- // const res = await createRoomId({
75
- // content,
76
- // conversationType: agentRef.current.conversationType,
77
- // botId: agentRef.current.botId,
78
- // })
79
- // if (res?.status === 0) {
80
- // setLoading(false)
81
- // dispatch({
82
- // type: 'gimiMenu/setConversationId',
83
- // payload: { conversationId: res.result },
84
- // })
85
- // dispatch({
86
- // type: 'gimiMenu/setInitMsg',
87
- // payload: { initMsg: content},
88
- // })
89
- // } else {
90
- // setLoading(false)
91
- // Toast.error(res.message as string)
92
- // }
93
- case 9:
94
- case "end":
95
- return _context.stop();
96
- }
97
- }, _callee);
98
- }));
99
- return function handleInputSend(_x) {
100
- return _ref.apply(this, arguments);
101
- };
102
- }();
103
- useEffect(function () {
104
- agentRef.current = agentObj;
105
- }, [agentObj]);
106
8
  return /*#__PURE__*/React.createElement("div", {
107
9
  className: "new-main"
108
10
  }, /*#__PURE__*/React.createElement("div", {
@@ -120,21 +22,6 @@ var NewMain = function NewMain() {
120
22
  className: "agent-name"
121
23
  }, agentObj.agentName), /*#__PURE__*/React.createElement("div", {
122
24
  className: "agent-desc"
123
- }, agentObj.agentIntroduce)), /*#__PURE__*/React.createElement("div", {
124
- className: "new-main-input"
125
- }, /*#__PURE__*/React.createElement(ChatInput, {
126
- ref: chatInputRef,
127
- onSend: handleInputSend,
128
- disabled: false,
129
- defaultPrompt: agentObj.defaultPrompt || '',
130
- isRecording: isRecording,
131
- isVoiceGetting: isExecuting,
132
- recordingCount: recordingCount,
133
- asrText: asrText,
134
- shortAsrClick: shortAsrClick,
135
- enableFileUpload: true,
136
- enableVoiceRecord: true,
137
- enableVoiceChat: true
138
- })));
25
+ }, agentObj.agentIntroduce)));
139
26
  };
140
27
  export default NewMain;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  import './index.css';
3
- declare const Slider: React.FC<any>;
3
+ import { Ui } from '../../index';
4
+ declare const Slider: React.FC<Ui['slider']>;
4
5
  export default Slider;
@@ -1,10 +1,4 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useState } from 'react';
1
+ import React from 'react';
8
2
  import "./index.css";
9
3
  import addChat from "../../../assets/image/addChat.png";
10
4
  import HistoryList from "../history-list";
@@ -13,11 +7,11 @@ import { useAppDispatch, useAppSelector } from "../../../store/hooks";
13
7
  import { setConversationId, setMessageList } from "../../../store/slices/gimiMenuSlice";
14
8
  var hostoryIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202508/28/848da_20250828112623.png';
15
9
  var addExpendChat = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202508/28/ce31b_20250828120347.png';
16
- var Slider = function Slider() {
17
- var _useState = useState(null),
18
- _useState2 = _slicedToArray(_useState, 2),
19
- hoveredIndex = _useState2[0],
20
- setHoveredIndex = _useState2[1];
10
+ var Slider = function Slider(_ref) {
11
+ var _ref$showHistory = _ref.showHistory,
12
+ showHistory = _ref$showHistory === void 0 ? true : _ref$showHistory,
13
+ _ref$showAddNew = _ref.showAddNew,
14
+ showAddNew = _ref$showAddNew === void 0 ? true : _ref$showAddNew;
21
15
  var _useAppSelector = useAppSelector(function (state) {
22
16
  return state.gimiMenu;
23
17
  }),
@@ -37,15 +31,9 @@ var Slider = function Slider() {
37
31
  messageList: []
38
32
  }));
39
33
  };
40
- var handleMouseEnter = function handleMouseEnter(v, val) {
41
- setHoveredIndex(val);
42
- };
43
- var handleMouseLeave = function handleMouseLeave() {
44
- setHoveredIndex(null);
45
- };
46
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
47
35
  className: "chat-sdk-container-sidebar"
48
- }, /*#__PURE__*/React.createElement("div", {
36
+ }, showAddNew && /*#__PURE__*/React.createElement("div", {
49
37
  className: classNames('newChat', !conversationId ? 'menu_active' : ''),
50
38
  onClick: createConversation
51
39
  }, /*#__PURE__*/React.createElement("img", {
@@ -54,7 +42,7 @@ var Slider = function Slider() {
54
42
  alt: ""
55
43
  }), /*#__PURE__*/React.createElement("span", {
56
44
  className: "newChatText"
57
- }, "\u65B0\u5BF9\u8BDD")), /*#__PURE__*/React.createElement("div", {
45
+ }, "\u65B0\u5BF9\u8BDD")), showHistory && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
58
46
  className: "line"
59
47
  }), /*#__PURE__*/React.createElement("div", {
60
48
  className: "recent_text"
@@ -65,6 +53,6 @@ var Slider = function Slider() {
65
53
  style: {
66
54
  margin: '0px 8px'
67
55
  }
68
- }), /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1\u5BF9\u8BDD")), /*#__PURE__*/React.createElement(HistoryList, null)));
56
+ }), /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1\u5BF9\u8BDD")), /*#__PURE__*/React.createElement(HistoryList, null))));
69
57
  };
70
58
  export default Slider;
@@ -1,5 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3
8
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
9
  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); } }
5
10
  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); }); }; }
@@ -10,21 +15,20 @@ import "./index.css";
10
15
  import useApi from "../../apis/useApi";
11
16
  import { Toast } from '@douyinfe/semi-ui';
12
17
  import { useAppDispatch, useAppSelector } from "../../store/hooks";
13
- import { setAgentDetail, setBaseUrl, setToken, setPlatform, setConversationId, getChatHistoryList } from "../../store/slices/gimiMenuSlice";
18
+ import { setAgentDetail, setBaseUrl, setToken, setPlatform, setConversationId, getChatHistoryList, updateParams } from "../../store/slices/gimiMenuSlice";
14
19
  import CommonChat from "../../components/templates/CommonChat";
15
20
  var Chat = function Chat(props) {
16
- var _props$ui;
21
+ var _props$ui, _props$ui2;
17
22
  var _ref = props.chat,
18
23
  agentId = _ref.agentId,
19
24
  baseUrl = _ref.baseUrl,
20
25
  token = _ref.token,
21
- platform = _ref.platform;
26
+ platform = _ref.platform,
27
+ _ref$chatInputConfig = _ref.chatInputConfig,
28
+ chatInputConfig = _ref$chatInputConfig === void 0 ? {} : _ref$chatInputConfig;
22
29
  var conversationId = useAppSelector(function (state) {
23
30
  return state.gimiMenu.conversationId;
24
31
  });
25
- var initMsg = useAppSelector(function (state) {
26
- return state.gimiMenu.initMsg;
27
- });
28
32
  var dispatch = useAppDispatch();
29
33
  var _useApi = useApi(baseUrl, token),
30
34
  getAgentDetail = _useApi.getAgentDetail;
@@ -76,7 +80,6 @@ var Chat = function Chat(props) {
76
80
  useEffect(function () {
77
81
  if (agentId) {
78
82
  var historyConversationId = localStorage.getItem('historyConversationId');
79
- console.log('historyConversationId', historyConversationId);
80
83
  if (historyConversationId) dispatch(setConversationId({
81
84
  conversationId: parseInt(historyConversationId, 10)
82
85
  }));
@@ -85,12 +88,17 @@ var Chat = function Chat(props) {
85
88
  }, [agentId]);
86
89
  return /*#__PURE__*/React.createElement("div", {
87
90
  className: "chat-sdk-container"
88
- }, !!((_props$ui = props.ui) !== null && _props$ui !== void 0 && _props$ui.slider) && /*#__PURE__*/React.createElement(Slider, null), /*#__PURE__*/React.createElement("div", {
91
+ }, !!((_props$ui = props.ui) !== null && _props$ui !== void 0 && _props$ui.slider) && /*#__PURE__*/React.createElement(Slider, (_props$ui2 = props.ui) === null || _props$ui2 === void 0 ? void 0 : _props$ui2.slider), /*#__PURE__*/React.createElement("div", {
89
92
  className: "chat-sdk-container-main"
90
93
  }, /*#__PURE__*/React.createElement("div", {
91
- className: "chat-sdk-container-main-content"
92
- }, conversationId || initMsg ? /*#__PURE__*/React.createElement(CommonChat, _extends({}, props.chat, {
93
- chatInputConfig: {
94
+ className: "chat-sdk-container-main-content ".concat(conversationId ? 'has-conversation' : 'new-conversation')
95
+ }, !conversationId && /*#__PURE__*/React.createElement(NewMain, null), /*#__PURE__*/React.createElement(CommonChat, _extends({}, props.chat, {
96
+ showHeader: !!conversationId,
97
+ showPrologue: !!conversationId,
98
+ chatInputConfig: _objectSpread(_objectSpread({}, chatInputConfig), {}, {
99
+ enableFileUpload: true,
100
+ enableVoiceChat: true,
101
+ enableVoiceRecord: true,
94
102
  onConversationCreated: function onConversationCreated() {
95
103
  dispatch({
96
104
  type: 'gimiMenu/setInitMsg',
@@ -98,12 +106,18 @@ var Chat = function Chat(props) {
98
106
  initMsg: ''
99
107
  }
100
108
  });
109
+ },
110
+ onFirstSendSuccess: function onFirstSendSuccess() {
111
+ dispatch(updateParams({
112
+ pageIndex: 1,
113
+ pageSize: 50
114
+ }));
101
115
  dispatch(getChatHistoryList({
102
116
  pageIndex: 1,
103
117
  pageSize: 50
104
118
  }));
105
119
  }
106
- }
107
- })) : /*#__PURE__*/React.createElement(NewMain, null))));
120
+ })
121
+ })))));
108
122
  };
109
123
  export default Chat;
@@ -9,9 +9,12 @@
9
9
  flex-direction: column;
10
10
  }
11
11
  .chat-sdk-container .chat-sdk-container-main .chat-sdk-container-main-content {
12
- flex: 1;
13
- width: 800px;
14
- margin: 0 auto;
15
12
  padding: 20px;
13
+ }
14
+ .chat-sdk-container .chat-sdk-container-main .chat-sdk-container-main-content.new-conversation {
15
+ height: 160px;
16
+ }
17
+ .chat-sdk-container .chat-sdk-container-main .chat-sdk-container-main-content.has-conversation {
18
+ flex: 1;
16
19
  height: calc(100% - 40px);
17
20
  }
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
- declare const Index: (props: any) => React.JSX.Element;
2
+ import { ChatClientOptions } from '../index';
3
+ declare const Index: (props: ChatClientOptions) => React.JSX.Element;
3
4
  export default Index;
@@ -1,6 +1,6 @@
1
1
  import { CommonChatProps } from '../types/chat';
2
2
  export interface Ui {
3
- slider?: {
3
+ slider: {
4
4
  showHistory?: boolean;
5
5
  showAddNew?: boolean;
6
6
  };
@@ -54,6 +54,18 @@ var AnswerItem = function AnswerItem(_ref) {
54
54
  var messageList = useAppSelector(function (state) {
55
55
  return state.gimiMenu.messageList || [];
56
56
  });
57
+ var platform = useAppSelector(function (state) {
58
+ return state.gimiMenu.platform;
59
+ });
60
+ var handleLinkClickCapture = React.useCallback(function (e) {
61
+ if (platform !== 'preview') return;
62
+ var target = e.target;
63
+ var anchor = target.closest('a');
64
+ if (anchor) {
65
+ e.preventDefault();
66
+ e.stopPropagation();
67
+ }
68
+ }, [platform]);
57
69
  var _React$useMemo = React.useMemo(function () {
58
70
  var _item$moduleInfo, _item$moduleInfo2, _messageList;
59
71
  var contentStr = item.content && processString(item.content) || '';
@@ -82,7 +94,8 @@ var AnswerItem = function AnswerItem(_ref) {
82
94
  return state.gimiMenu.agentObj || {};
83
95
  });
84
96
  return /*#__PURE__*/React.createElement("div", {
85
- className: styles.title
97
+ className: styles.title,
98
+ onClickCapture: handleLinkClickCapture
86
99
  }, /*#__PURE__*/React.createElement("div", {
87
100
  className: classNames(styles.answer)
88
101
  }, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
@@ -22,7 +22,7 @@ import { Tooltip } from "@douyinfe/semi-ui";
22
22
  import styles from "./index.module.css";
23
23
  import FileUpload from "../file-upload";
24
24
  import { useAppSelector, useAppDispatch } from "../../store/hooks";
25
- import { setConversationId, setFileList } from "../../store/slices/gimiMenuSlice";
25
+ import { setAutoLoadConversation, setConversationId, setFileList } from "../../store/slices/gimiMenuSlice";
26
26
  import { Toast } from "@douyinfe/semi-ui";
27
27
  import useApi from "../../apis/useApi";
28
28
  import UploadList from "../upload-list";
@@ -235,6 +235,10 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
235
235
  case 16:
236
236
  res = _context.sent;
237
237
  if (res && res.status === 0) {
238
+ // 关闭自动加载会话,避免重复加载
239
+ dispatch(setAutoLoadConversation({
240
+ autoLoadConversation: false
241
+ }));
238
242
  dispatch(setConversationId({
239
243
  conversationId: res.result
240
244
  }));
@@ -390,6 +394,10 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
390
394
  window.location.href = "/gimi/chat/".concat(aesId);
391
395
  return;
392
396
  }
397
+ // 重置自动加载会话设置
398
+ dispatch(setAutoLoadConversation({
399
+ autoLoadConversation: true
400
+ }));
393
401
  (_props$onHistoryReloa = props.onHistoryReload) === null || _props$onHistoryReloa === void 0 || _props$onHistoryReloa.call(props);
394
402
  };
395
403
  var defaultContent = transformToInputSlots(props.defaultPrompt || '', props.titleSlot || '');
@@ -2,6 +2,7 @@
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
+ width: 100%;
5
6
  }
6
7
 
7
8
  .deepthink {
@@ -46,4 +47,5 @@
46
47
  box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
47
48
  margin: 0px 10px 10px 10px;
48
49
  padding: 16px;
50
+ max-width: 800px;
49
51
  }
@@ -5,6 +5,8 @@
5
5
  transition: all 0.3s ease;
6
6
  flex: 1;
7
7
  padding: 20px 0 0;
8
+ max-width: 800px;
9
+ margin: 0 auto;
8
10
  }
9
11
  .main.translate {
10
12
  transform: translateX(-320px);
@@ -17,7 +17,6 @@ import FileCardSideBar from "../file-card/fileCardSidebar";
17
17
  import OfficeFilePreviewPanel from "../file-preview";
18
18
  import AiLoading from "../ai-loading";
19
19
  var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
20
- var _props$chatInputConfi2, _props$chatInputConfi3;
21
20
  var _props$businessType = props.businessType,
22
21
  businessType = _props$businessType === void 0 ? 'chat' : _props$businessType,
23
22
  _props$showInput = props.showInput,
@@ -61,9 +60,6 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
61
60
  var storedToken = useAppSelector(function (state) {
62
61
  return state.gimiMenu.token;
63
62
  });
64
- var initMsg = useAppSelector(function (state) {
65
- return state.gimiMenu.initMsg;
66
- });
67
63
  var chatUI = useChatUI();
68
64
  var _useChatVoice = useChatVoice(),
69
65
  isRecording = _useChatVoice.isRecording,
@@ -74,7 +70,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
74
70
  playTTSByText = _useChatVoice.playTTSByText,
75
71
  stopTTSByText = _useChatVoice.stopTTSByText,
76
72
  isPlaying = _useChatVoice.isPlaying;
77
- var _useCommonChatAPI = useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, props === null || props === void 0 ? void 0 : props.reloadAgentKey, props === null || props === void 0 ? void 0 : props.resetKey, props === null || props === void 0 ? void 0 : props.interruptKey, (_props$chatInputConfi2 = props.chatInputConfig) === null || _props$chatInputConfi2 === void 0 ? void 0 : _props$chatInputConfi2.onConversationCreated, (_props$chatInputConfi3 = props.chatInputConfig) === null || _props$chatInputConfi3 === void 0 ? void 0 : _props$chatInputConfi3.onSendEnd),
73
+ var _useCommonChatAPI = useCommonChatAPI(containerRef, platform, stopTTSByText, isPlaying, agentId, props === null || props === void 0 ? void 0 : props.reloadAgentKey, props === null || props === void 0 ? void 0 : props.resetKey, props === null || props === void 0 ? void 0 : props.interruptKey, props.chatInputConfig),
78
74
  headerValue = _useCommonChatAPI.headerValue,
79
75
  msgLoading = _useCommonChatAPI.msgLoading,
80
76
  onSucessExcel = _useCommonChatAPI.onSucessExcel,
@@ -126,9 +122,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
126
122
  }));
127
123
  }, [agentDetail]);
128
124
  React.useEffect(function () {
129
- dispatch(setBussinessParams({
130
- bussinessParams: bussinessParams || {}
131
- }));
125
+ dispatch(setBussinessParams(bussinessParams || {}));
132
126
  }, [bussinessParams]);
133
127
  React.useEffect(function () {
134
128
  if (bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.QUESTION_ID && bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.ANSWER_ID && businessType === 'correction' && storedBaseUrl && storedToken) {
@@ -160,11 +154,12 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
160
154
  }
161
155
  handleSend(val, agent, isSystemAuto);
162
156
  }, [handleSend, startConversationAndChat]);
163
- React.useEffect(function () {
164
- if (initMsg) {
165
- handleInputSend(initMsg);
166
- }
167
- }, [initMsg]);
157
+
158
+ // React.useEffect(() => {
159
+ // if (initMsg) {
160
+ // handleInputSend(initMsg)
161
+ // }
162
+ // }, [initMsg]);
168
163
 
169
164
  // 输入框开头Agent名称
170
165
  var showTitleSlot = React.useMemo(function () {
@@ -13,6 +13,7 @@
13
13
  height: 100%;
14
14
  display: flex;
15
15
  flex-direction: column;
16
+ align-items: center;
16
17
  min-width: 0;
17
18
  position: relative;
18
19
  }