@ray-js/t-agent-plugin-aistream 0.2.6-beta-2 → 0.2.6-beta-3
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/utils/AIStream.js
CHANGED
|
@@ -253,9 +253,10 @@ export class AIStreamSession {
|
|
|
253
253
|
bizTag: BizTag.DEFAULT,
|
|
254
254
|
ownerId
|
|
255
255
|
}, this.options), {}, {
|
|
256
|
-
extParams: _objectSpread({
|
|
256
|
+
extParams: _objectSpread(_objectSpread({}, this.options.extParams), {}, {
|
|
257
|
+
// chatId 之前可能是 undefined,这里要覆盖掉
|
|
257
258
|
chatId
|
|
258
|
-
}
|
|
259
|
+
})
|
|
259
260
|
});
|
|
260
261
|
const [error, result] = await tryCatchTTT(() => queryAgentToken(options));
|
|
261
262
|
if (error) {
|
|
@@ -95,20 +95,34 @@ mock.hooks.hook('disconnect', context => {
|
|
|
95
95
|
mock.data.set('sessionMap', new Map());
|
|
96
96
|
});
|
|
97
97
|
mock.hooks.hook('queryAgentToken', context => {
|
|
98
|
-
var _context$options$extP, _context$options$extP2;
|
|
98
|
+
var _context$options$extP, _context$options$extP2, _context$options$extP3;
|
|
99
99
|
const agentToken = generateId();
|
|
100
100
|
const map = mock.data.get('tokenMap');
|
|
101
101
|
map.set(agentToken, {
|
|
102
102
|
onlyAsr: ((_context$options$extP = context.options.extParams) === null || _context$options$extP === void 0 ? void 0 : _context$options$extP.onlyAsr) || false,
|
|
103
103
|
needTts: ((_context$options$extP2 = context.options.extParams) === null || _context$options$extP2 === void 0 ? void 0 : _context$options$extP2.needTts) || false
|
|
104
104
|
});
|
|
105
|
+
let chatId;
|
|
106
|
+
if (((_context$options$extP3 = context.options.extParams) === null || _context$options$extP3 === void 0 ? void 0 : _context$options$extP3.dialogueMode) === 1) {
|
|
107
|
+
var _context$options$extP4;
|
|
108
|
+
if ((_context$options$extP4 = context.options.extParams) !== null && _context$options$extP4 !== void 0 && _context$options$extP4.chatId) {
|
|
109
|
+
// 如果参数有传吗,则使用传入的 chatId
|
|
110
|
+
chatId = context.options.extParams.chatId;
|
|
111
|
+
} else {
|
|
112
|
+
// 使用生成的 id
|
|
113
|
+
chatId = "chatId-".concat(generateId());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
105
116
|
context.result = {
|
|
106
117
|
agentToken,
|
|
107
118
|
bizConfig: {
|
|
108
119
|
bizCode: BizCode.CHAT,
|
|
109
120
|
sendData: ['audio', 'video', 'text', 'image'],
|
|
110
121
|
revData: ['text', 'audio']
|
|
111
|
-
}
|
|
122
|
+
},
|
|
123
|
+
extParams: JSON.stringify({
|
|
124
|
+
chatId
|
|
125
|
+
})
|
|
112
126
|
};
|
|
113
127
|
});
|
|
114
128
|
const dispatch = (type, detail) => {
|
package/dist/utils/promisify.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/es.global-this.js";
|
|
2
3
|
import { isDevTools } from './ttt';
|
|
3
4
|
import logger from './logger';
|
|
4
5
|
import { mock } from './mock';
|
|
@@ -6,6 +7,9 @@ import { TTTError } from './errors';
|
|
|
6
7
|
let callId = 100000;
|
|
7
8
|
export const getEnableMock = () => {
|
|
8
9
|
try {
|
|
10
|
+
if ((globalThis === null || globalThis === void 0 ? void 0 : globalThis.__AIStreamEnableMock) != null) {
|
|
11
|
+
return globalThis.__AIStreamEnableMock;
|
|
12
|
+
}
|
|
9
13
|
const result = ty.getStorageSync({
|
|
10
14
|
key: 'AIStreamEnableMock'
|
|
11
15
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-plugin-aistream",
|
|
3
|
-
"version": "0.2.6-beta-
|
|
3
|
+
"version": "0.2.6-beta-3",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/url-parse": "^1.4.11"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e478ba7ce360563e061efc24d6a8dfb495c5f9e9"
|
|
39
39
|
}
|