@myun/gimi-chat 0.9.22 → 0.9.24

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.
Files changed (41) hide show
  1. package/dist/apis/useApi.js +1 -1
  2. package/dist/components/ai-chat-dialogue/index copy.d.ts +16 -0
  3. package/dist/components/ai-chat-dialogue/index copy.js +1062 -0
  4. package/dist/components/ai-chat-dialogue/index.js +54 -49
  5. package/dist/components/ai-chat-dialogue/index.module copy.css +230 -0
  6. package/dist/components/ai-chat-dialogue/index.module.css +78 -136
  7. package/dist/components/chat-input/index.d.ts +5 -0
  8. package/dist/components/chat-input/index.js +181 -68
  9. package/dist/components/chat-input/index.module.css +70 -2
  10. package/dist/components/file-upload/index.js +120 -34
  11. package/dist/components/iconfont-com/index.js +1 -1
  12. package/dist/components/message-list/index.js +3 -2
  13. package/dist/components/templates/CommonChat.js +27 -5
  14. package/dist/components/templates/GimiChatComponent.js +4 -0
  15. package/dist/components/upload-list/CustomFile.d.ts +15 -0
  16. package/dist/components/upload-list/CustomFile.js +105 -0
  17. package/dist/components/upload-list/ImageFile.d.ts +18 -0
  18. package/dist/components/upload-list/ImageFile.js +68 -0
  19. package/dist/components/upload-list/customFile.module.css +122 -0
  20. package/dist/components/upload-list/imageFile.module.css +95 -0
  21. package/dist/components/upload-list/index.d.ts +4 -3
  22. package/dist/components/upload-list/index.js +101 -84
  23. package/dist/components/upload-list/index.module.css +68 -99
  24. package/dist/components/voice-bars/index.js +10 -9
  25. package/dist/components/voice-check-dialog/index.js +2 -1
  26. package/dist/components/voice-recording/index.d.ts +1 -1
  27. package/dist/components/voice-recording/index.js +2 -28
  28. package/dist/hooks/useChatMessage.d.ts +1 -1
  29. package/dist/hooks/useChatMessage.js +1 -1
  30. package/dist/hooks/useCommonChatAPI.js +13 -9
  31. package/dist/hooks/useFile.js +99 -7
  32. package/dist/i18n/locales/en-US.d.ts +9 -0
  33. package/dist/i18n/locales/en-US.js +11 -2
  34. package/dist/i18n/locales/zh-CN.d.ts +9 -0
  35. package/dist/i18n/locales/zh-CN.js +11 -2
  36. package/dist/types/chat.d.ts +3 -0
  37. package/dist/types/file.d.ts +9 -0
  38. package/dist/umd/index.min.js +1 -1
  39. package/dist/utils/tools.d.ts +1 -0
  40. package/dist/utils/tools.js +25 -1
  41. package/package.json +1 -1
@@ -3,12 +3,11 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  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
4
  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; }
5
5
  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; }
6
+ 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); } }
7
+ 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); }); }; }
6
8
  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; }
7
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
10
  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); }
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); } }
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); }); }; }
11
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
12
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
12
  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."); }
14
13
  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); }
@@ -17,12 +16,11 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
17
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
17
  import React, { useContext } from "react";
19
18
  import { useTranslation } from 'react-i18next';
20
- import { AIChatInput, Divider } from '@douyinfe/semi-ui';
19
+ import { AIChatInput, Divider, Popover } from '@douyinfe/semi-ui';
21
20
  import { transformToInputSlots } from "../../utils/chatInputUtil";
22
21
  import VoiceCheckDialog from "../voice-check-dialog";
23
22
  import VoiceCommunication from "../chat-voice/VoiceCommunication";
24
23
  import VoiceRecord from "../chat-voice/VoiceRecord";
25
- import VoiceRecording from "../voice-recording";
26
24
  // import deepThinkActive from "../../assets/image/deepthinkActive.png";
27
25
  import { Tooltip } from "@douyinfe/semi-ui";
28
26
  import styles from "./index.module.css";
@@ -39,6 +37,8 @@ import { Keydown, TitleSlot } from "./extension";
39
37
  import QuotedContent from "../quoted-content";
40
38
  import { ReferencesEdit } from "../reference-content";
41
39
  import IconFontCom from "../iconfont-com";
40
+ import VoiceBars from "../voice-bars";
41
+ import classNames from 'classnames';
42
42
  var extractText = function extractText() {
43
43
  var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
44
44
  return content.map(function (item) {
@@ -95,14 +95,12 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
95
95
  _React$useState2 = _slicedToArray(_React$useState, 2),
96
96
  showChatCommunication = _React$useState2[0],
97
97
  setShowChatCommunication = _React$useState2[1];
98
- var _React$useState3 = React.useState(0),
98
+ // const [inputWidth, setInputWidth] = React.useState(0);
99
+
100
+ var _React$useState3 = React.useState(false),
99
101
  _React$useState4 = _slicedToArray(_React$useState3, 2),
100
- inputWidth = _React$useState4[0],
101
- setInputWidth = _React$useState4[1];
102
- var _React$useState5 = React.useState(false),
103
- _React$useState6 = _slicedToArray(_React$useState5, 2),
104
- hasContent = _React$useState6[0],
105
- setHasContent = _React$useState6[1];
102
+ hasContent = _React$useState4[0],
103
+ setHasContent = _React$useState4[1];
106
104
  var _useContext = useContext(ChatContext),
107
105
  apiService = _useContext.apiService;
108
106
  var _ref = apiService,
@@ -149,29 +147,25 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
149
147
  preInputValueRef.current = value;
150
148
  (_props$onValueChange = props.onValueChange) === null || _props$onValueChange === void 0 || _props$onValueChange.call(props, value);
151
149
  }, [props]);
152
- React.useEffect(function () {
153
- var element = inputWrapRef.current;
154
- if (!element) return;
155
- var resizeObserver = new ResizeObserver(function (entries) {
156
- var _iterator = _createForOfIteratorHelper(entries),
157
- _step;
158
- try {
159
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
160
- var entry = _step.value;
161
- var width = entry.contentRect.width;
162
- setInputWidth(width);
163
- }
164
- } catch (err) {
165
- _iterator.e(err);
166
- } finally {
167
- _iterator.f();
168
- }
169
- });
170
- resizeObserver.observe(element);
171
- return function () {
172
- resizeObserver.disconnect();
173
- };
174
- }, []);
150
+
151
+ // React.useEffect(() => {
152
+ // const element = inputWrapRef.current;
153
+ // if (!element) return;
154
+
155
+ // const resizeObserver = new ResizeObserver((entries) => {
156
+ // for (const entry of entries) {
157
+ // const width = entry.contentRect.width;
158
+ // setInputWidth(width);
159
+ // }
160
+ // });
161
+
162
+ // resizeObserver.observe(element);
163
+
164
+ // return () => {
165
+ // resizeObserver.disconnect();
166
+ // };
167
+ // }, []);
168
+
175
169
  var handleQuickInput = React.useCallback(function (value) {
176
170
  var isReplace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
177
171
  if (isReplace) {
@@ -188,8 +182,8 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
188
182
  }
189
183
  }, [props.asrText, props.isRecording, props.isVoiceGetting, handleQuickInput]);
190
184
  var handleTip = function handleTip() {
191
- if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0) {
192
- return Toast.info(t('chatInput.uploadLimitOne'));
185
+ if ((fileList === null || fileList === void 0 ? void 0 : fileList.length) >= 10) {
186
+ return Toast.info(t('chatInput.uploadLimitTen'));
193
187
  }
194
188
  return Toast.info(t('chatInput.flowUnsupported'));
195
189
  };
@@ -197,30 +191,96 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
197
191
  if (!props.enableFileUpload || (agentObj === null || agentObj === void 0 ? void 0 : agentObj.openUploadFile) === 0) {
198
192
  return null;
199
193
  }
200
- var shouldDisableUploadFile = props.disabled || (fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0 || isAskProcess;
201
- return /*#__PURE__*/React.createElement(FileUpload, {
194
+ var shouldDisableUploadFile = props.disabled || (fileList === null || fileList === void 0 ? void 0 : fileList.length) >= 10 || isAskProcess;
195
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FileUpload, {
202
196
  ref: uploadFileRef,
203
197
  accept: props.accept,
204
198
  disabled: shouldDisableUploadFile,
205
199
  onFileUploaded: props.onFileUploaded
206
200
  }, /*#__PURE__*/React.createElement(Tooltip, {
207
- content: t('chatInput.uploadFile')
201
+ content: /*#__PURE__*/React.createElement("span", {
202
+ style: {
203
+ whiteSpace: 'pre-line'
204
+ }
205
+ }, t('chatInput.uploadFile'))
208
206
  }, shouldDisableUploadFile ? /*#__PURE__*/React.createElement("div", {
209
207
  className: styles.uploadIcon,
210
208
  onClick: handleTip,
211
209
  style: {
212
210
  cursor: 'not-allowed'
213
211
  }
214
- }, /*#__PURE__*/React.createElement("img", {
215
- src: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/24/6726e_20250924141448.png',
216
- alt: ""
212
+ }, /*#__PURE__*/React.createElement(IconFontCom, {
213
+ type: "icon-a-tianjia2",
214
+ size: 20
217
215
  })) : /*#__PURE__*/React.createElement("div", {
218
216
  className: styles.uploadIcon
217
+ }, /*#__PURE__*/React.createElement(IconFontCom, {
218
+ type: "icon-a-tianjia2",
219
+ size: 20
220
+ })))), /*#__PURE__*/React.createElement(Divider, {
221
+ layout: "vertical",
222
+ style: {
223
+ marginLeft: 8
224
+ }
225
+ }));
226
+ }, [props.enableFileUpload, props.accept, props.disabled, messageList, agentObj === null || agentObj === void 0 ? void 0 : agentObj.openUploadFile, fileList, isAskProcess]);
227
+ var AgentContainer = React.useMemo(function () {
228
+ var _props$agentList, _props$agentList2, _props$agentList3;
229
+ return /*#__PURE__*/React.createElement("div", {
230
+ className: styles.agentContainer
231
+ }, (_props$agentList = props.agentList) === null || _props$agentList === void 0 ? void 0 : _props$agentList.slice(0, 3).map(function (item) {
232
+ return /*#__PURE__*/React.createElement("div", {
233
+ className: classNames(styles.agentItem, _defineProperty({}, styles.active, item.agentId === (agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId))),
234
+ key: item.agentId,
235
+ onClick: function onClick() {
236
+ var _props$onAgentChange;
237
+ return item.agentId && ((_props$onAgentChange = props.onAgentChange) === null || _props$onAgentChange === void 0 ? void 0 : _props$onAgentChange.call(props, item.agentId));
238
+ },
239
+ style: {
240
+ cursor: 'pointer'
241
+ }
242
+ }, /*#__PURE__*/React.createElement("img", {
243
+ src: item.agentIcon,
244
+ alt: ""
245
+ }), /*#__PURE__*/React.createElement("div", {
246
+ className: styles.agentName
247
+ }, item.agentName));
248
+ }), (props === null || props === void 0 ? void 0 : props.agentList) && ((_props$agentList2 = props.agentList) === null || _props$agentList2 === void 0 ? void 0 : _props$agentList2.length) > 3 && /*#__PURE__*/React.createElement(Popover, {
249
+ content: /*#__PURE__*/React.createElement("div", {
250
+ className: styles.agentPopover
251
+ }, (_props$agentList3 = props.agentList) === null || _props$agentList3 === void 0 || (_props$agentList3 = _props$agentList3.slice(3)) === null || _props$agentList3 === void 0 ? void 0 : _props$agentList3.map(function (item) {
252
+ return /*#__PURE__*/React.createElement("div", {
253
+ className: classNames(styles.agentItem, _defineProperty({}, styles.active, item.agentId === (agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId))),
254
+ key: item.agentId,
255
+ onClick: function onClick() {
256
+ var _props$onAgentChange2;
257
+ return item.agentId && ((_props$onAgentChange2 = props.onAgentChange) === null || _props$onAgentChange2 === void 0 ? void 0 : _props$onAgentChange2.call(props, item.agentId));
258
+ },
259
+ style: {
260
+ cursor: 'pointer'
261
+ }
262
+ }, /*#__PURE__*/React.createElement("img", {
263
+ src: item.agentIcon,
264
+ alt: ""
265
+ }), /*#__PURE__*/React.createElement("div", {
266
+ className: styles.agentName
267
+ }, item.agentName));
268
+ })),
269
+ position: "topLeft",
270
+ trigger: "click"
271
+ }, /*#__PURE__*/React.createElement("div", {
272
+ className: styles.agentItem,
273
+ key: "more",
274
+ style: {
275
+ cursor: 'pointer'
276
+ }
219
277
  }, /*#__PURE__*/React.createElement("img", {
220
- src: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/11/83ad4_20250911153220.png',
278
+ src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202606/08/5655a_20260608143804.png",
221
279
  alt: ""
222
- }))));
223
- }, [props.enableFileUpload, props.accept, props.disabled, messageList, agentObj === null || agentObj === void 0 ? void 0 : agentObj.openUploadFile, fileList, isAskProcess]);
280
+ }), /*#__PURE__*/React.createElement("div", {
281
+ className: styles.agentName
282
+ }, t('chatInput.more')))));
283
+ }, [props.agentList, agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId, t]);
224
284
  var openChatCommunication = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
225
285
  var params, res, _props$onConversation;
226
286
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -340,21 +400,46 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
340
400
  });
341
401
  }, [props.enableSourceQuote, props.initQuoteSource]);
342
402
  var renderActionArea = React.useCallback(function (renderProps) {
403
+ var sendBtn = renderProps.menuItem;
404
+
405
+ // 判断是否有语音能力
406
+ var hasVoiceCapability = props.enableVoiceChat || props.enableVoiceRecord;
407
+
408
+ // 当没有内容、没有文件、没有引用、且有语音能力时显示语音工具,否则显示发送按钮
409
+ var hasReference = (quoteTeachModelList === null || quoteTeachModelList === void 0 ? void 0 : quoteTeachModelList.length) > 0 || (quoteProductList === null || quoteProductList === void 0 ? void 0 : quoteProductList.length) > 0;
410
+ var showVoiceTools = !isMsgRecieving && !hasContent && (!fileList || fileList.length === 0) && !hasReference && hasVoiceCapability;
343
411
  return /*#__PURE__*/React.createElement("div", {
344
412
  className: renderProps.className,
345
- key: "action_area"
413
+ key: "action_area",
414
+ style: {
415
+ position: 'relative'
416
+ }
346
417
  }, /*#__PURE__*/React.createElement("div", {
347
418
  style: {
348
419
  display: 'flex',
349
- alignItems: 'center'
420
+ alignItems: 'center',
421
+ gap: 8
350
422
  }
351
- }, renderQuotedContent, VoiceTools, UploadFileTool, /*#__PURE__*/React.createElement(Divider, {
352
- layout: "vertical",
423
+ }, renderQuotedContent, props.isRecording ? /*#__PURE__*/React.createElement(Tooltip, {
424
+ content: t('chatInput.stopVoiceInput')
425
+ }, /*#__PURE__*/React.createElement("div", {
353
426
  style: {
354
- marginLeft: 8
427
+ width: 32,
428
+ height: 32,
429
+ borderRadius: 8,
430
+ backgroundColor: "#F2F3F7",
431
+ border: "#F2F3F7",
432
+ cursor: "pointer",
433
+ position: 'relative',
434
+ zIndex: 10
435
+ },
436
+ onClick: function onClick() {
437
+ return stopRecording(true);
355
438
  }
356
- })), renderProps.menuItem);
357
- }, [VoiceTools, UploadFileTool, renderQuotedContent]);
439
+ }, /*#__PURE__*/React.createElement(VoiceBars, {
440
+ parentWidth: 32
441
+ }))) : showVoiceTools ? VoiceTools : sendBtn));
442
+ }, [VoiceTools, renderQuotedContent, props.renderSendButton, hasContent, fileList, quoteTeachModelList, quoteProductList, props.isRecording, stopRecording]);
358
443
  var onMessageSend = React.useCallback(function (content) {
359
444
  var _props$onSend;
360
445
  var inputContents = content.inputContents || [];
@@ -362,29 +447,44 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
362
447
  (_props$onSend = props.onSend) === null || _props$onSend === void 0 || _props$onSend.call(props, text);
363
448
  }, [props]);
364
449
  var renderConfigureArea = React.useCallback(function () {
365
- return /*#__PURE__*/React.createElement(Tooltip, {
450
+ return /*#__PURE__*/React.createElement("div", {
451
+ className: styles.configureArea
452
+ }, UploadFileTool, !props.hiddenDeepThink && /*#__PURE__*/React.createElement(Tooltip, {
366
453
  trigger: 'click',
367
454
  content: t('chatInput.deepThinkTip')
368
455
  }, /*#__PURE__*/React.createElement("div", {
369
456
  className: styles.deepthink
370
457
  }, /*#__PURE__*/React.createElement(IconFontCom, {
371
458
  type: "icon-moxing",
372
- size: 14,
373
- color: "var(--theme-primary, #4086ff)"
374
- }), /*#__PURE__*/React.createElement("span", null, t('chatInput.deepThinkModeAuto'))));
375
- }, []);
459
+ size: 14
460
+ }), /*#__PURE__*/React.createElement("span", {
461
+ style: {
462
+ marginBottom: 2
463
+ }
464
+ }, t('chatInput.deepThinkModeAuto')), /*#__PURE__*/React.createElement(IconFontCom, {
465
+ type: "icon-a-jiantoucu2x",
466
+ size: 12,
467
+ extraStyle: {
468
+ marginLeft: 0
469
+ }
470
+ }))), AgentContainer);
471
+ }, [UploadFileTool, props.hiddenDeepThink, AgentContainer]);
376
472
  var stopSSe = function stopSSe() {
377
473
  if (uploadFileRef.current) {
378
474
  var _uploadFileRef$curren;
379
475
  (_uploadFileRef$curren = uploadFileRef.current) === null || _uploadFileRef$curren === void 0 || _uploadFileRef$curren.abortUpload();
380
476
  }
381
477
  };
382
- var handleDelFile = React.useCallback(function () {
478
+ var handleDelFile = React.useCallback(function (uid) {
383
479
  stopSSe();
480
+ var currentFileList = fileList || [];
481
+ var newFileList = currentFileList.filter(function (file) {
482
+ return file.uid !== uid;
483
+ });
384
484
  dispatch(setFileList({
385
- fileList: []
485
+ fileList: newFileList
386
486
  }));
387
- }, [dispatch]);
487
+ }, [dispatch, fileList]);
388
488
  var handleReTry = React.useCallback(function (file) {
389
489
  var currentFileList = fileList || [];
390
490
  var _file = currentFileList.find(function (item) {
@@ -405,7 +505,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
405
505
  className: styles.reference,
406
506
  key: "reference"
407
507
  }, !props.isRecording && (fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0 && !disabledUploadFileList && /*#__PURE__*/React.createElement(UploadList, {
408
- file: fileList[0],
508
+ fileList: fileList,
409
509
  handleReTry: handleReTry,
410
510
  handleDelFile: handleDelFile
411
511
  }), ((quoteTeachModelList === null || quoteTeachModelList === void 0 ? void 0 : quoteTeachModelList.length) > 0 || (quoteProductList === null || quoteProductList === void 0 ? void 0 : quoteProductList.length) > 0) && !props.isRecording && /*#__PURE__*/React.createElement("div", {
@@ -455,12 +555,25 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
455
555
  var uniqueKey = "".concat(props.placeholder, "-").concat(defaultContent);
456
556
  return /*#__PURE__*/React.createElement("div", {
457
557
  className: styles.inputWrap,
458
- ref: inputWrapRef
459
- }, props.isRecording ? /*#__PURE__*/React.createElement(VoiceRecording, {
460
- recordingCount: props.recordingCount,
461
- stopRecording: stopRecording,
462
- containerWidth: inputWidth
463
- }) : /*#__PURE__*/React.createElement(AIChatInput, _extends({
558
+ ref: inputWrapRef,
559
+ style: {
560
+ position: 'relative'
561
+ }
562
+ }, props.isRecording && /*#__PURE__*/React.createElement("div", {
563
+ style: {
564
+ position: 'absolute',
565
+ top: 0,
566
+ left: 0,
567
+ right: 0,
568
+ bottom: 0,
569
+ zIndex: 10,
570
+ display: 'flex',
571
+ alignItems: 'center',
572
+ justifyContent: 'center',
573
+ borderRadius: '8px',
574
+ pointerEvents: 'auto'
575
+ }
576
+ }), /*#__PURE__*/React.createElement(AIChatInput, _extends({
464
577
  ref: inputRef
465
578
  // 为了当 props 变化时,重新渲染 AIChatInput
466
579
  ,
@@ -8,6 +8,11 @@
8
8
  box-shadow: inset 0 2px #fff, 0 2px 10px rgba(84, 105, 140, 0.15);
9
9
  border-radius: 10px;
10
10
  }
11
+ @media (min-width: 1921px) {
12
+ .inputWrap {
13
+ max-width: 1000px;
14
+ }
15
+ }
11
16
 
12
17
  .deepthink {
13
18
  padding: 0 12px;
@@ -17,8 +22,6 @@
17
22
  align-items: center;
18
23
  justify-content: center;
19
24
  cursor: pointer;
20
- color: var(--theme-primary, #4086ff);
21
- background-color: var(--theme-primary-pale, #F0F8FF);
22
25
  }
23
26
  .deepthink span {
24
27
  margin-left: 4px;
@@ -38,8 +41,15 @@
38
41
  .uploadIcon {
39
42
  width: 32px;
40
43
  height: 32px;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
41
47
  cursor: pointer;
42
48
  }
49
+ .uploadIcon:hover {
50
+ border-radius: 50%;
51
+ background-color: #F2F3F7;
52
+ }
43
53
  .uploadIcon img {
44
54
  width: 100%;
45
55
  height: 100%;
@@ -55,6 +65,11 @@
55
65
  scrollbar-width: thin;
56
66
  scrollbar-color: #d1d1d1 transparent;
57
67
  }
68
+ @media (min-width: 1921px) {
69
+ .chatInput {
70
+ max-width: 1000px;
71
+ }
72
+ }
58
73
  .chatInput::-webkit-scrollbar {
59
74
  width: 4px;
60
75
  }
@@ -93,10 +108,63 @@
93
108
  align-items: center;
94
109
  padding-top: 5px;
95
110
  }
111
+ .reference .fileListContainer {
112
+ display: flex;
113
+ flex-wrap: nowrap;
114
+ gap: 8px;
115
+ padding-top: 5px;
116
+ }
117
+
118
+ .configureArea {
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: flex-start;
122
+ }
96
123
 
97
124
  :global .semi-aiChatInput-footer-action-send {
98
125
  background-color: var(--theme-primary, #4086ff);
99
126
  }
100
127
  :global .semi-aiChatInput-footer-action-send-disabled {
101
128
  background-color: rgba(46, 50, 56, 0.1294117647);
129
+ }
130
+
131
+ .agentContainer {
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: flex-start;
135
+ }
136
+
137
+ .agentItem {
138
+ display: flex;
139
+ align-items: center;
140
+ padding: 6px 12px;
141
+ cursor: pointer;
142
+ font-size: 13px;
143
+ }
144
+ .agentItem:hover {
145
+ border-radius: 8px;
146
+ background-color: #F2F3F7;
147
+ }
148
+ .agentItem.active {
149
+ border-radius: 8px;
150
+ background-color: var(--theme-primary-pale, #F0F8FF);
151
+ color: var(--theme-primary, #4086ff);
152
+ }
153
+ .agentItem img {
154
+ width: 16px;
155
+ height: 16px;
156
+ margin-right: 4px;
157
+ }
158
+ .agentItem .agentName {
159
+ max-width: 100px;
160
+ overflow: hidden;
161
+ text-overflow: ellipsis;
162
+ white-space: nowrap;
163
+ }
164
+
165
+ .agentPopover {
166
+ padding: 4px;
167
+ }
168
+ .agentPopover .agentItem {
169
+ padding: 6px 4px;
102
170
  }