doomiaichat 7.1.17 → 7.1.18

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 CHANGED
@@ -315,7 +315,7 @@ class CorzBot extends gptbase_1.default {
315
315
  const stream = this.botid ? client.chat.stream(params) :
316
316
  (this.workflowid ? client.workflows.runs.stream(params) :
317
317
  client.workflows.chat.stream(params));
318
- let deltaindex = 0, fullanswer = [], followup = [], cardData = [];
318
+ let deltaindex = 0, fullanswer = [], cardfollowup = [], followup = [], cardData = [];
319
319
  let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText = ''; // 是否在深度思考中
320
320
  try {
321
321
  for (var _g = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a;) {
@@ -353,8 +353,12 @@ class CorzBot extends gptbase_1.default {
353
353
  const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|');
354
354
  for (const item of allCards) {
355
355
  const cardinfo = (0, querystring_1.parse)(item);
356
- if (cardinfo.type && cardinfo.tag)
357
- cardData.push(Object.assign({}, cardinfo));
356
+ if (cardinfo.type && cardinfo.tag) {
357
+ if (cardinfo.type === 'follow_up')
358
+ cardfollowup.push(cardinfo.tag);
359
+ else
360
+ cardData.push(Object.assign({}, cardinfo));
361
+ }
358
362
  }
359
363
  // 将卡片资源返回给客户端
360
364
  this.emit('chatcard', cardData);
@@ -396,7 +400,7 @@ class CorzBot extends gptbase_1.default {
396
400
  if (part.event === api_1.ChatEventType.CONVERSATION_CHAT_COMPLETED ||
397
401
  part.event === api_1.WorkflowEventType.DONE) {
398
402
  const { conversation_id, content } = (_f = (part.data)) !== null && _f !== void 0 ? _f : {};
399
- let output = { successed: true, cards: cardData.length ? cardData : null, followup, type: 'answer', content_type: 'text', role: api_1.RoleType.Assistant, requestid, segment: null, text: content !== null && content !== void 0 ? content : fullanswer.join(''), index: index++, session_id: conversation_id };
403
+ let output = { successed: true, cards: cardData.length ? cardData : null, cardfollowup, followup, type: 'answer', content_type: 'text', role: api_1.RoleType.Assistant, requestid, segment: null, text: content !== null && content !== void 0 ? content : fullanswer.join(''), index: index++, session_id: conversation_id };
400
404
  if (attach)
401
405
  output = Object.assign({}, output, attach);
402
406
  this.emit('chatdone', output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doomiaichat",
3
- "version": "7.1.17",
3
+ "version": "7.1.18",
4
4
  "description": "Doomisoft OpenAI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/corzbot.ts CHANGED
@@ -290,7 +290,7 @@ export default class CorzBot extends GptBase {
290
290
  const stream = this.botid ? client.chat.stream(params as StreamChatReq) :
291
291
  (this.workflowid ? client.workflows.runs.stream(params as RunWorkflowReq) :
292
292
  client.workflows.chat.stream(params as ChatWorkflowReq));
293
- let deltaindex = 0, fullanswer: string[] = [], followup: string[] = [], cardData: CardType[] = [];
293
+ let deltaindex = 0, fullanswer: string[] = [],cardfollowup: string[] = [], followup: string[] = [], cardData: CardType[] = [];
294
294
  let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText=''; // 是否在深度思考中
295
295
  for await (const part of stream) {
296
296
  if (part.event === ChatEventType.ERROR) return this.emit('chaterror', { successed: false, error: 'call failed' });
@@ -322,7 +322,12 @@ export default class CorzBot extends GptBase {
322
322
  const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|')
323
323
  for (const item of allCards) {
324
324
  const cardinfo: any = parse(item);
325
- if (cardinfo.type && cardinfo.tag) cardData.push({ ...cardinfo })
325
+ if (cardinfo.type && cardinfo.tag) {
326
+ if (cardinfo.type === 'follow_up')
327
+ cardfollowup.push(cardinfo.tag);
328
+ else
329
+ cardData.push({ ...cardinfo })
330
+ }
326
331
  }
327
332
  // 将卡片资源返回给客户端
328
333
  this.emit('chatcard', cardData);
@@ -360,7 +365,7 @@ export default class CorzBot extends GptBase {
360
365
  part.event === WorkflowEventType.DONE
361
366
  ) {
362
367
  const { conversation_id, content } = (part.data) ?? {} as any;
363
- let output = { successed: true, cards: cardData.length ? cardData : null, followup, type: 'answer', content_type: 'text', role: RoleType.Assistant, requestid, segment: null, text: content ?? fullanswer.join(''), index: index++, session_id: conversation_id };
368
+ let output = { successed: true, cards: cardData.length ? cardData : null, cardfollowup, followup, type: 'answer', content_type: 'text', role: RoleType.Assistant, requestid, segment: null, text: content ?? fullanswer.join(''), index: index++, session_id: conversation_id };
364
369
  if (attach) output = Object.assign({}, output, attach);
365
370
  this.emit('chatdone', output)
366
371
  }