doomiaichat 7.1.20 → 7.1.22
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/corzbot.js +10 -8
- package/package.json +3 -3
- package/src/corzbot.ts +9 -7
package/dist/corzbot.js
CHANGED
|
@@ -219,9 +219,7 @@ class CorzBot extends gptbase_1.default {
|
|
|
219
219
|
const resp = workflowResp.data;
|
|
220
220
|
return { successed: true, message: [{ role: 'assistant', type: 'answer', content: resp }] };
|
|
221
221
|
}
|
|
222
|
-
|
|
223
|
-
console.error('workflow run failed', workflowResp.msg, workflowResp);
|
|
224
|
-
}
|
|
222
|
+
console.error('workflow run failed', workflowResp.msg, workflowResp);
|
|
225
223
|
// try {
|
|
226
224
|
// return { successed: true, message: [{ role: 'assistant', type: 'answer', content: JSON.parse(resp).data }] };
|
|
227
225
|
// } catch (error) {
|
|
@@ -328,7 +326,7 @@ class CorzBot extends gptbase_1.default {
|
|
|
328
326
|
(this.workflowid ? client.workflows.runs.stream(params) :
|
|
329
327
|
client.workflows.chat.stream(params));
|
|
330
328
|
let deltaindex = 0, fullanswer = [], cardfollowup = [], followup = [], cardData = [];
|
|
331
|
-
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource =
|
|
329
|
+
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = [], preresponseText = ''; // 是否在深度思考中
|
|
332
330
|
try {
|
|
333
331
|
for (var _g = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a;) {
|
|
334
332
|
_c = stream_1_1.value;
|
|
@@ -359,17 +357,21 @@ class CorzBot extends gptbase_1.default {
|
|
|
359
357
|
if (thinking) {
|
|
360
358
|
deepThinking = result.content;
|
|
361
359
|
if (thinking.action === DeepThinkingAction.card) {
|
|
362
|
-
cardResource
|
|
360
|
+
cardResource.push(result.thinking.text);
|
|
363
361
|
// 卡片流结束,解析卡片资源数据
|
|
364
362
|
if (result.thinking.completed) {
|
|
365
|
-
const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|');
|
|
363
|
+
const allCards = cardResource.join('|').replace(/[\x00-\x1F\x7F]/g, '').split('|');
|
|
366
364
|
for (const item of allCards) {
|
|
367
365
|
const cardinfo = (0, querystring_1.parse)(item);
|
|
368
366
|
if (cardinfo.type && cardinfo.tag) {
|
|
369
367
|
if (cardinfo.type === 'follow_up')
|
|
370
368
|
cardfollowup.push(cardinfo.tag);
|
|
371
|
-
else
|
|
372
|
-
|
|
369
|
+
else {
|
|
370
|
+
const tags = cardinfo.tag.split(',');
|
|
371
|
+
for (const tag of tags)
|
|
372
|
+
cardData.push({ type: cardinfo.type, tag });
|
|
373
|
+
//cardData.push({ ...cardinfo })
|
|
374
|
+
}
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
377
|
// 将卡片资源返回给客户端
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doomiaichat",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.22",
|
|
4
4
|
"description": "Doomisoft OpenAI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@azure/openai": "^1.0.0-beta.11",
|
|
20
|
-
"@coze/api": "^1.3.
|
|
20
|
+
"@coze/api": "^1.3.6",
|
|
21
21
|
"axios": "^1.8.4",
|
|
22
|
-
"openai": "^
|
|
22
|
+
"openai": "^5.19.1"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/corzbot.ts
CHANGED
|
@@ -200,9 +200,8 @@ export default class CorzBot extends GptBase {
|
|
|
200
200
|
if (workflowResp.msg === 'Success' || (!workflowResp.msg && workflowResp.data)){
|
|
201
201
|
const resp = workflowResp.data;
|
|
202
202
|
return { successed: true, message: [{ role: 'assistant', type: 'answer', content: resp }] };
|
|
203
|
-
}else{
|
|
204
|
-
console.error('workflow run failed', workflowResp.msg, workflowResp)
|
|
205
203
|
}
|
|
204
|
+
console.error('workflow run failed', workflowResp.msg, workflowResp)
|
|
206
205
|
// try {
|
|
207
206
|
// return { successed: true, message: [{ role: 'assistant', type: 'answer', content: JSON.parse(resp).data }] };
|
|
208
207
|
// } catch (error) {
|
|
@@ -302,7 +301,7 @@ export default class CorzBot extends GptBase {
|
|
|
302
301
|
(this.workflowid ? client.workflows.runs.stream(params as RunWorkflowReq) :
|
|
303
302
|
client.workflows.chat.stream(params as ChatWorkflowReq));
|
|
304
303
|
let deltaindex = 0, fullanswer: string[] = [],cardfollowup: string[] = [], followup: string[] = [], cardData: CardType[] = [];
|
|
305
|
-
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource =
|
|
304
|
+
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource:string[] = [], preresponseText=''; // 是否在深度思考中
|
|
306
305
|
for await (const part of stream) {
|
|
307
306
|
if (part.event === ChatEventType.ERROR) return this.emit('chaterror', { successed: false, error: 'call failed' });
|
|
308
307
|
if (part.event === ChatEventType.CONVERSATION_MESSAGE_DELTA ||
|
|
@@ -327,17 +326,20 @@ export default class CorzBot extends GptBase {
|
|
|
327
326
|
if (thinking) {
|
|
328
327
|
deepThinking = result.content;
|
|
329
328
|
if (thinking.action === DeepThinkingAction.card) {
|
|
330
|
-
cardResource
|
|
329
|
+
cardResource.push(result.thinking.text);
|
|
331
330
|
// 卡片流结束,解析卡片资源数据
|
|
332
331
|
if (result.thinking.completed) {
|
|
333
|
-
const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|')
|
|
332
|
+
const allCards = cardResource.join('|').replace(/[\x00-\x1F\x7F]/g, '').split('|')
|
|
334
333
|
for (const item of allCards) {
|
|
335
334
|
const cardinfo: any = parse(item);
|
|
336
335
|
if (cardinfo.type && cardinfo.tag) {
|
|
337
336
|
if (cardinfo.type === 'follow_up')
|
|
338
337
|
cardfollowup.push(cardinfo.tag);
|
|
339
|
-
else
|
|
340
|
-
|
|
338
|
+
else{
|
|
339
|
+
const tags = cardinfo.tag.split(',');
|
|
340
|
+
for (const tag of tags) cardData.push({ type: cardinfo.type, tag })
|
|
341
|
+
//cardData.push({ ...cardinfo })
|
|
342
|
+
}
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
345
|
// 将卡片资源返回给客户端
|