@myun/gimi-chat 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/apis/useApi.d.ts +1 -1
  2. package/dist/apis/useApi.js +3 -3
  3. package/dist/assets/image/addChat.png +0 -0
  4. package/dist/client/components/common-chat/index.d.ts +5 -0
  5. package/dist/client/components/common-chat/index.js +207 -0
  6. package/dist/client/components/common-chat/index.module.css +109 -0
  7. package/dist/client/components/history-list/index.d.ts +5 -0
  8. package/dist/client/components/history-list/index.js +281 -0
  9. package/dist/client/components/history-list/index.module.css +127 -0
  10. package/dist/client/components/new-main/index.css +34 -0
  11. package/dist/client/components/new-main/index.d.ts +4 -0
  12. package/dist/client/components/new-main/index.js +140 -0
  13. package/dist/client/components/slider/index.css +249 -0
  14. package/dist/client/components/slider/index.d.ts +4 -0
  15. package/dist/client/components/slider/index.js +70 -0
  16. package/dist/client/core/chat.d.ts +5 -0
  17. package/dist/client/core/chat.js +109 -0
  18. package/dist/client/core/index.css +17 -0
  19. package/dist/client/core/index.d.ts +3 -0
  20. package/dist/client/core/index.js +10 -0
  21. package/dist/client/index.d.ts +18 -0
  22. package/dist/client/index.js +26 -0
  23. package/dist/components/chat-input/index.js +10 -21
  24. package/dist/components/preset-agent-content/index.js +0 -1
  25. package/dist/components/preset-agent-content/index.module.css +1 -1
  26. package/dist/components/templates/CommonChat.js +13 -3
  27. package/dist/hooks/useChatHistory.js +1 -1
  28. package/dist/hooks/useChatStream.d.ts +1 -1
  29. package/dist/hooks/useChatStream.js +2 -2
  30. package/dist/hooks/useCommonChatAPI.js +5 -4
  31. package/dist/store/slices/gimiMenuSlice.d.ts +1 -0
  32. package/dist/store/slices/gimiMenuSlice.js +25 -15
  33. package/dist/umd/index.min.js +1 -0
  34. package/package.json +1 -1
@@ -0,0 +1,127 @@
1
+ @charset "UTF-8";
2
+ .history_list {
3
+ padding: 0 10px;
4
+ overflow: auto;
5
+ flex: 1;
6
+ }
7
+ .history_list .history_list_item {
8
+ width: 180px;
9
+ height: 36px;
10
+ display: flex;
11
+ align-items: center;
12
+ font-family: PingFangSC, PingFang SC;
13
+ font-weight: 400;
14
+ font-size: 12px;
15
+ color: #2e394c;
16
+ line-height: 18px;
17
+ text-align: left;
18
+ font-style: normal;
19
+ white-space: nowrap; /* 防止文本换行 */
20
+ overflow: hidden; /* 隐藏超出部分 */
21
+ text-overflow: ellipsis; /* 显示省略号 */
22
+ color: #4c5a70;
23
+ overflow: visible;
24
+ }
25
+ .history_list .history_list_item .history_list_item_text {
26
+ width: 100%;
27
+ flex: 1;
28
+ display: flex;
29
+ align-items: center;
30
+ overflow: hidden;
31
+ }
32
+ .history_list .history_list_item .history_list_item_text .item_text_title {
33
+ flex: 1;
34
+ flex-shrink: 0;
35
+ white-space: nowrap; /* 防止文本换行 */
36
+ overflow: hidden; /* 隐藏超出部分 */
37
+ text-overflow: ellipsis; /* 显示省略号 */
38
+ }
39
+ .history_list .history_list_item .history_list_item_img {
40
+ margin: 0 4px;
41
+ cursor: pointer;
42
+ flex-shrink: 0;
43
+ }
44
+ .history_list .history_list_item .history_list_item_img .iconMore {
45
+ width: 16px;
46
+ height: 16px;
47
+ object-fit: cover;
48
+ }
49
+ .history_list .menu_hover:hover {
50
+ color: #4086ff;
51
+ border-radius: 8px;
52
+ cursor: pointer;
53
+ }
54
+ .history_list .menu_active {
55
+ background-color: #e6efff;
56
+ border-radius: 4px;
57
+ cursor: pointer;
58
+ }
59
+
60
+ .history_list::-webkit-scrollbar {
61
+ display: none; /* 完全隐藏滚动条 */
62
+ }
63
+
64
+ .history_list {
65
+ scrollbar-width: none; /* Firefox 64+ */
66
+ -ms-overflow-style: none; /* IE/Edge */
67
+ }
68
+
69
+ .empty {
70
+ height: 36px;
71
+ width: 148px;
72
+ font-family: PingFangSC, PingFang SC;
73
+ font-weight: 400;
74
+ font-size: 12px;
75
+ color: #7891b6;
76
+ line-height: 36px;
77
+ text-align: left;
78
+ font-style: normal;
79
+ margin-left: 6px;
80
+ }
81
+
82
+ .deltext {
83
+ margin-left: 4px;
84
+ width: 56px;
85
+ height: 20px;
86
+ font-family: PingFangSC, PingFang SC;
87
+ font-weight: 400;
88
+ font-size: 14px;
89
+ color: #ff3636;
90
+ line-height: 20px;
91
+ text-align: left;
92
+ font-style: normal;
93
+ }
94
+
95
+ .morebtn {
96
+ display: flex;
97
+ align-items: center;
98
+ }
99
+
100
+ .more_pop :global .ant-popover-content .ant-popover-inner .ant-popover-inner-content {
101
+ padding: 6px !important;
102
+ }
103
+
104
+ .loading_more {
105
+ display: flex;
106
+ justify-content: center;
107
+ align-items: center;
108
+ padding: 10px 0;
109
+ color: #999;
110
+ }
111
+
112
+ .loading {
113
+ display: flex;
114
+ justify-content: center;
115
+ align-items: center;
116
+ padding: 10px 0;
117
+ color: #999;
118
+ height: 100%;
119
+ font-size: 14px;
120
+ }
121
+
122
+ .no_more {
123
+ text-align: center;
124
+ padding: 10px 0;
125
+ color: #999;
126
+ font-size: 12px;
127
+ }
@@ -0,0 +1,34 @@
1
+ .new-main {
2
+ flex-direction: column;
3
+ flex: 1;
4
+ align-items: center;
5
+ margin-top: 18vh;
6
+ display: flex;
7
+ position: relative;
8
+ color: #2e394c;
9
+ }
10
+ .new-main .new-main-info {
11
+ display: flex;
12
+ flex-direction: column;
13
+ align-items: center;
14
+ }
15
+ .new-main .new-main-info .agent-icon-wrap {
16
+ width: 88px;
17
+ height: 88px;
18
+ }
19
+ .new-main .new-main-info .agent-name {
20
+ text-align: center;
21
+ margin: 8px 0 4px;
22
+ font-size: 28px;
23
+ font-weight: 600;
24
+ }
25
+ .new-main .new-main-info .agent-desc {
26
+ text-align: center;
27
+ margin-bottom: 24px;
28
+ font-size: 20px;
29
+ font-weight: 400;
30
+ line-height: 36px;
31
+ }
32
+ .new-main .new-main-input {
33
+ width: 100%;
34
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index.css';
3
+ declare const NewMain: () => React.JSX.Element;
4
+ export default NewMain;
@@ -0,0 +1,140 @@
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";
13
+ 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';
18
+ 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
+ var agentObj = useAppSelector(function (state) {
26
+ return state.gimiMenu.agentObj;
27
+ });
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
+ return /*#__PURE__*/React.createElement("div", {
107
+ className: "new-main"
108
+ }, /*#__PURE__*/React.createElement("div", {
109
+ className: "new-main-info"
110
+ }, /*#__PURE__*/React.createElement("div", {
111
+ className: "agent-icon-wrap"
112
+ }, /*#__PURE__*/React.createElement("img", {
113
+ width: 88,
114
+ src: agentObj.agentIcon,
115
+ alt: "",
116
+ style: {
117
+ borderRadius: 18
118
+ }
119
+ })), /*#__PURE__*/React.createElement("div", {
120
+ className: "agent-name"
121
+ }, agentObj.agentName), /*#__PURE__*/React.createElement("div", {
122
+ 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
+ })));
139
+ };
140
+ export default NewMain;
@@ -0,0 +1,249 @@
1
+ @charset "UTF-8";
2
+ .chat-sdk-container-sidebar {
3
+ width: 200px;
4
+ flex-shrink: 0;
5
+ border-right: 1px solid #e8e8e8;
6
+ transition: width 0.3s ease;
7
+ overflow-x: hidden;
8
+ display: flex;
9
+ flex-direction: column;
10
+ padding: 20px 0;
11
+ }
12
+ .chat-sdk-container-sidebar.collapsed {
13
+ width: 48px;
14
+ }
15
+
16
+ .logo {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: space-between;
20
+ padding: 18px 14px;
21
+ }
22
+ .logo .logoText {
23
+ width: calc(100% - 16px);
24
+ display: flex;
25
+ align-items: center;
26
+ cursor: pointer;
27
+ overflow: hidden;
28
+ }
29
+ .logo .gimiHomeLogo {
30
+ width: calc(100% - 50px);
31
+ color: #000;
32
+ font-family: "PingFang SC";
33
+ font-size: 16px;
34
+ font-style: normal;
35
+ font-weight: 600;
36
+ line-height: normal;
37
+ margin-left: 8px;
38
+ white-space: nowrap; /* 禁止文本换行 */
39
+ overflow: hidden; /* 隐藏溢出内容 */
40
+ text-overflow: ellipsis; /* 溢出部分显示省略号 */
41
+ }
42
+
43
+ .menu_active {
44
+ background-color: #e9edf4;
45
+ cursor: pointer;
46
+ }
47
+
48
+ .menu_hover {
49
+ background-color: #f0f2f5;
50
+ cursor: pointer;
51
+ }
52
+
53
+ .newChat:hover {
54
+ background-color: #f0f2f5;
55
+ cursor: pointer;
56
+ }
57
+
58
+ .newChat {
59
+ height: 36px;
60
+ display: flex;
61
+ align-items: center;
62
+ margin: 0 10px 10px 10px;
63
+ cursor: pointer;
64
+ border-radius: 12px;
65
+ color: #000;
66
+ font-family: "PingFang SC";
67
+ font-size: 14px;
68
+ font-style: normal;
69
+ font-weight: 700;
70
+ line-height: normal;
71
+ transition: all 0.3s ease;
72
+ overflow: hidden;
73
+ padding: 0 14px;
74
+ }
75
+ .newChat .newChatText {
76
+ margin-left: 10px;
77
+ white-space: nowrap;
78
+ color: #2e394c;
79
+ }
80
+ .sidebar.collapsed .newChat {
81
+ justify-content: center;
82
+ padding: 0;
83
+ margin: 0 8px 10px;
84
+ }
85
+
86
+ .line {
87
+ width: calc(100% - 20px);
88
+ height: 1px;
89
+ background: #dfe8f7;
90
+ margin: 10px;
91
+ transition: opacity 0.2s ease;
92
+ }
93
+
94
+ .recent_text {
95
+ display: flex;
96
+ align-items: center;
97
+ height: 36px;
98
+ color: #2e394c;
99
+ font-family: "PingFang SC";
100
+ font-size: 14px;
101
+ font-style: normal;
102
+ font-weight: 400;
103
+ line-height: normal;
104
+ margin: 0 0 4px 10px;
105
+ transition: all 0.3s ease;
106
+ overflow: hidden;
107
+ white-space: nowrap;
108
+ }
109
+
110
+ .recent_icon {
111
+ display: flex;
112
+ justify-content: center;
113
+ align-items: center;
114
+ height: 36px;
115
+ margin: 10px 0 4px 0;
116
+ cursor: pointer;
117
+ }
118
+
119
+ .space {
120
+ height: 20px;
121
+ width: 100%;
122
+ }
123
+
124
+ .gimiRouteList {
125
+ padding: 0 10px;
126
+ overflow: hidden;
127
+ margin-bottom: 10px;
128
+ }
129
+ .gimiRouteList .history_list_item {
130
+ height: 36px;
131
+ display: flex;
132
+ align-items: center;
133
+ font-family: PingFangSC, PingFang SC;
134
+ font-weight: 400;
135
+ font-size: 14px;
136
+ color: #000;
137
+ line-height: 18px;
138
+ text-align: left;
139
+ font-style: normal;
140
+ margin-bottom: 8px;
141
+ border-radius: 12px;
142
+ transition: all 0.3s ease;
143
+ display: flex;
144
+ align-items: center;
145
+ }
146
+ .gimiRouteList .history_list_item .history_list_item_text {
147
+ color: #2e394c;
148
+ font-family: "PingFang SC";
149
+ font-size: 14px;
150
+ font-style: normal;
151
+ font-weight: 400;
152
+ line-height: normal;
153
+ flex: 1;
154
+ white-space: nowrap;
155
+ overflow: hidden;
156
+ text-overflow: ellipsis;
157
+ transition: opacity 0.2s ease;
158
+ }
159
+ .gimiRouteList .history_list_item .history_list_item_img {
160
+ margin: 0 8px;
161
+ cursor: pointer;
162
+ flex-shrink: 0;
163
+ border-radius: 8px;
164
+ display: flex;
165
+ align-items: center;
166
+ }
167
+ .gimiRouteList .history_list_item .history_list_item_img .iconMore {
168
+ width: 18px;
169
+ height: 18px;
170
+ object-fit: cover;
171
+ }
172
+ .sidebar.collapsed .gimiRouteList .history_list_item {
173
+ justify-content: center;
174
+ padding: 0;
175
+ margin: 0 auto 8px;
176
+ }
177
+ .sidebar.collapsed .gimiRouteList .history_list_item .history_list_item_text {
178
+ opacity: 0;
179
+ width: 0;
180
+ }
181
+ .sidebar.collapsed .gimiRouteList .history_list_item .history_list_item_img {
182
+ margin: 0;
183
+ }
184
+ .gimiRouteList .history_list_item:nth-last-child(1) {
185
+ margin-bottom: 0;
186
+ }
187
+
188
+ .gimiRouteList {
189
+ max-height: 175px;
190
+ overflow: auto;
191
+ }
192
+
193
+ .gimiRouteList::-webkit-scrollbar {
194
+ width: 0; /* 隐藏垂直滚动条宽度 */
195
+ display: none;
196
+ }
197
+
198
+ .empty {
199
+ height: 36px;
200
+ width: 148px;
201
+ font-family: PingFangSC, PingFang SC;
202
+ font-weight: 400;
203
+ font-size: 12px;
204
+ color: #7891b6;
205
+ line-height: 36px;
206
+ text-align: left;
207
+ font-style: normal;
208
+ margin-left: 6px;
209
+ }
210
+
211
+ .deltext {
212
+ margin-left: 4px;
213
+ width: 56px;
214
+ height: 20px;
215
+ font-family: PingFangSC, PingFang SC;
216
+ font-weight: 400;
217
+ font-size: 14px;
218
+ color: #ff3636;
219
+ line-height: 20px;
220
+ text-align: left;
221
+ font-style: normal;
222
+ }
223
+
224
+ .morebtn {
225
+ display: flex;
226
+ align-items: center;
227
+ }
228
+
229
+ .notExpendIcon {
230
+ width: 100%;
231
+ padding: 0 15px;
232
+ margin-bottom: 20px;
233
+ cursor: pointer;
234
+ }
235
+ .notExpendIcon img {
236
+ border-radius: 4px;
237
+ }
238
+
239
+ .more_pop :global .ant-popover-content .ant-popover-inner .ant-popover-inner-content {
240
+ padding: 6px !important;
241
+ }
242
+
243
+ .tooltip {
244
+ left: 36px !important;
245
+ border-radius: 8px;
246
+ }
247
+ .tooltip :global(.ant-tooltip-inner) {
248
+ border-radius: 8px;
249
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index.css';
3
+ declare const Slider: React.FC<any>;
4
+ export default Slider;
@@ -0,0 +1,70 @@
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';
8
+ import "./index.css";
9
+ import addChat from "../../../assets/image/addChat.png";
10
+ import HistoryList from "../history-list";
11
+ import classNames from 'classnames';
12
+ import { useAppDispatch, useAppSelector } from "../../../store/hooks";
13
+ import { setConversationId, setMessageList } from "../../../store/slices/gimiMenuSlice";
14
+ var hostoryIcon = 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202508/28/848da_20250828112623.png';
15
+ 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];
21
+ var _useAppSelector = useAppSelector(function (state) {
22
+ return state.gimiMenu;
23
+ }),
24
+ conversationId = _useAppSelector.conversationId;
25
+ var dispatch = useAppDispatch();
26
+ var createConversation = function createConversation() {
27
+ dispatch({
28
+ type: 'gimiMenu/setConversationId',
29
+ payload: {
30
+ conversationId: ''
31
+ }
32
+ });
33
+ dispatch(setConversationId({
34
+ conversationId: null
35
+ }));
36
+ dispatch(setMessageList({
37
+ messageList: []
38
+ }));
39
+ };
40
+ var handleMouseEnter = function handleMouseEnter(v, val) {
41
+ setHoveredIndex(val);
42
+ };
43
+ var handleMouseLeave = function handleMouseLeave() {
44
+ setHoveredIndex(null);
45
+ };
46
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
47
+ className: "chat-sdk-container-sidebar"
48
+ }, /*#__PURE__*/React.createElement("div", {
49
+ className: classNames('newChat', !conversationId ? 'menu_active' : ''),
50
+ onClick: createConversation
51
+ }, /*#__PURE__*/React.createElement("img", {
52
+ src: addChat,
53
+ width: 10,
54
+ alt: ""
55
+ }), /*#__PURE__*/React.createElement("span", {
56
+ className: "newChatText"
57
+ }, "\u65B0\u5BF9\u8BDD")), /*#__PURE__*/React.createElement("div", {
58
+ className: "line"
59
+ }), /*#__PURE__*/React.createElement("div", {
60
+ className: "recent_text"
61
+ }, /*#__PURE__*/React.createElement("img", {
62
+ src: hostoryIcon,
63
+ alt: "",
64
+ width: 18,
65
+ style: {
66
+ margin: '0px 8px'
67
+ }
68
+ }), /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1\u5BF9\u8BDD")), /*#__PURE__*/React.createElement(HistoryList, null)));
69
+ };
70
+ export default Slider;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ChatClientOptions } from '../index';
3
+ import './index.css';
4
+ declare const Chat: (props: ChatClientOptions) => React.JSX.Element;
5
+ export default Chat;