@myun/gimi-chat 0.4.7 → 0.5.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.
- package/dist/apis/useApi.d.ts +4 -3
- package/dist/apis/useApi.js +24 -41
- package/dist/client/components/history-list/index.js +2 -1
- package/dist/client/core/chat.js +2 -1
- package/dist/client/core/index.js +9 -1
- package/dist/components/ai-chat-dialogue/index.js +36 -33
- package/dist/components/ai-chat-dialogue/index.module.css +1 -1
- package/dist/components/chat-input/index.d.ts +1 -1
- package/dist/components/chat-input/index.js +14 -10
- package/dist/components/knowledge-trace/index.js +4 -1
- package/dist/components/templates/CommonChat.js +2 -12
- package/dist/components/templates/GimiChatComponent.js +8 -1
- package/dist/components/templates/chatContext.d.ts +6 -0
- package/dist/components/templates/chatContext.js +5 -0
- package/dist/hooks/useChatActions.js +10 -7
- package/dist/hooks/useChatHistory.js +6 -3
- package/dist/hooks/useChatRecommend.js +10 -7
- package/dist/hooks/useCommonChatAPI.d.ts +1 -0
- package/dist/hooks/useCommonChatAPI.js +48 -33
- package/dist/hooks/useKnowledgeService.d.ts +1 -1
- package/dist/hooks/useKnowledgeService.js +19 -16
- package/dist/hooks/useLongPoll.js +10 -7
- package/dist/hooks/useQuoted.js +13 -10
- package/dist/types/chat.d.ts +3 -3
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
package/dist/hooks/useQuoted.js
CHANGED
|
@@ -17,7 +17,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
17
17
|
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; }
|
|
18
18
|
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; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import
|
|
20
|
+
import ChatContext from "../components/templates/chatContext";
|
|
21
|
+
import { useContext } from 'react';
|
|
21
22
|
import { useEffect, useRef, useState } from 'react';
|
|
22
23
|
var useQuotedService = function useQuotedService(_ref) {
|
|
23
24
|
var type = _ref.type,
|
|
@@ -36,9 +37,11 @@ var useQuotedService = function useQuotedService(_ref) {
|
|
|
36
37
|
resource = _useState6[0],
|
|
37
38
|
setResource = _useState6[1];
|
|
38
39
|
var latestTypeRef = useRef(null);
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
var _useContext = useContext(ChatContext),
|
|
41
|
+
apiService = _useContext.apiService;
|
|
42
|
+
var _ref2 = apiService,
|
|
43
|
+
getReferenceVideoList = _ref2.getReferenceVideoList,
|
|
44
|
+
getReferenceCourseList = _ref2.getReferenceCourseList;
|
|
42
45
|
|
|
43
46
|
//处理数据 统一设置key
|
|
44
47
|
var handleData = function handleData(data) {
|
|
@@ -50,7 +53,7 @@ var useQuotedService = function useQuotedService(_ref) {
|
|
|
50
53
|
});
|
|
51
54
|
};
|
|
52
55
|
var getVideoResource = /*#__PURE__*/function () {
|
|
53
|
-
var
|
|
56
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
54
57
|
var params, res, resData;
|
|
55
58
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
56
59
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -102,11 +105,11 @@ var useQuotedService = function useQuotedService(_ref) {
|
|
|
102
105
|
}, _callee, null, [[0, 16]]);
|
|
103
106
|
}));
|
|
104
107
|
return function getVideoResource() {
|
|
105
|
-
return
|
|
108
|
+
return _ref3.apply(this, arguments);
|
|
106
109
|
};
|
|
107
110
|
}();
|
|
108
111
|
var getCourseResource = /*#__PURE__*/function () {
|
|
109
|
-
var
|
|
112
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
110
113
|
var params, res, resData;
|
|
111
114
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
112
115
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -153,13 +156,13 @@ var useQuotedService = function useQuotedService(_ref) {
|
|
|
153
156
|
}, _callee2, null, [[0, 10]]);
|
|
154
157
|
}));
|
|
155
158
|
return function getCourseResource() {
|
|
156
|
-
return
|
|
159
|
+
return _ref4.apply(this, arguments);
|
|
157
160
|
};
|
|
158
161
|
}();
|
|
159
162
|
useEffect(function () {
|
|
160
163
|
latestTypeRef.current = type;
|
|
161
164
|
var getData = /*#__PURE__*/function () {
|
|
162
|
-
var
|
|
165
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
163
166
|
var api;
|
|
164
167
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
165
168
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -184,7 +187,7 @@ var useQuotedService = function useQuotedService(_ref) {
|
|
|
184
187
|
}, _callee3, null, [[1, 8]]);
|
|
185
188
|
}));
|
|
186
189
|
return function getData() {
|
|
187
|
-
return
|
|
190
|
+
return _ref5.apply(this, arguments);
|
|
188
191
|
};
|
|
189
192
|
}();
|
|
190
193
|
if (showmodel) {
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface IAIInputProps {
|
|
|
40
40
|
onSend?: (text: string) => void;
|
|
41
41
|
onConversationCreated?: (conversationId: number) => void;
|
|
42
42
|
onSendEnd?: (message: IChatMessageItem) => void;
|
|
43
|
-
onMicHangUp?: () =>
|
|
43
|
+
onMicHangUp?: () => boolean;
|
|
44
44
|
onFileUploaded?: (file: FileItem) => void;
|
|
45
45
|
enableVoiceRecord?: boolean;
|
|
46
46
|
enableVoiceChat?: boolean;
|
|
@@ -112,8 +112,8 @@ export interface AgentConfig {
|
|
|
112
112
|
|
|
113
113
|
export interface CommonChatProps {
|
|
114
114
|
showInput?: boolean;
|
|
115
|
-
baseUrl
|
|
116
|
-
token
|
|
115
|
+
baseUrl: string;
|
|
116
|
+
token: string;
|
|
117
117
|
showHeader?: boolean;
|
|
118
118
|
autoSendValue?: string;
|
|
119
119
|
initSendValue?: string;
|