doomiaichat 7.1.14 → 7.1.16

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
@@ -317,7 +317,7 @@ class CorzBot extends gptbase_1.default {
317
317
  (this.workflowid ? client.workflows.runs.stream(params) :
318
318
  client.workflows.chat.stream(params));
319
319
  let deltaindex = 0, fullanswer = [], followup = [], cardData = [];
320
- let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = ''; // 是否在深度思考中
320
+ let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText = ''; // 是否在深度思考中
321
321
  try {
322
322
  for (var _g = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a;) {
323
323
  _c = stream_1_1.value;
@@ -361,6 +361,16 @@ class CorzBot extends gptbase_1.default {
361
361
  this.emit('chatcard', cardData);
362
362
  }
363
363
  }
364
+ else if (thinking.action === DeepThinkingAction.preresponse) {
365
+ /// 当正文一样输出
366
+ const spiltPreresponse = result.thinking.text.slice(preresponseText.length);
367
+ preresponseText = result.thinking.text;
368
+ fullanswer.push(spiltPreresponse); // = [result.thinking.text];// .push(result.thinking.text);
369
+ let output = { successed: true, type, content_type, role, requestid, segment: spiltPreresponse, text: fullanswer.join(''), index: index++, session_id: conversation_id, preresponse: true, preresponseover: result.thinking.completed };
370
+ if (attach)
371
+ output = Object.assign({}, output, attach);
372
+ this.emit('chattext', output);
373
+ }
364
374
  else {
365
375
  this.emit('chatthinking', { text: result.thinking.text, completed: result.thinking.completed, action: (_d = thinking.action) === null || _d === void 0 ? void 0 : _d.tag });
366
376
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doomiaichat",
3
- "version": "7.1.14",
3
+ "version": "7.1.16",
4
4
  "description": "Doomisoft OpenAI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/corzbot.ts CHANGED
@@ -292,7 +292,7 @@ export default class CorzBot extends GptBase {
292
292
  (this.workflowid ? client.workflows.runs.stream(params as RunWorkflowReq) :
293
293
  client.workflows.chat.stream(params as ChatWorkflowReq));
294
294
  let deltaindex = 0, fullanswer: string[] = [], followup: string[] = [], cardData: CardType[] = [];
295
- let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = ''; // 是否在深度思考中
295
+ let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText=''; // 是否在深度思考中
296
296
  for await (const part of stream) {
297
297
  if (part.event === ChatEventType.ERROR) return this.emit('chaterror', { successed: false, error: 'call failed' });
298
298
  if (part.event === ChatEventType.CONVERSATION_MESSAGE_DELTA ||
@@ -328,7 +328,16 @@ export default class CorzBot extends GptBase {
328
328
  // 将卡片资源返回给客户端
329
329
  this.emit('chatcard', cardData);
330
330
  }
331
- } else {
331
+ } else if(thinking.action === DeepThinkingAction.preresponse){
332
+ /// 当正文一样输出
333
+ const spiltPreresponse = result.thinking.text.slice(preresponseText.length)
334
+ preresponseText = result.thinking.text;
335
+ fullanswer.push(spiltPreresponse);// = [result.thinking.text];// .push(result.thinking.text);
336
+ let output = { successed: true, type, content_type, role, requestid, segment: spiltPreresponse, text: fullanswer.join(''), index: index++, session_id: conversation_id, preresponse: true, preresponseover: result.thinking.completed };
337
+ if (attach) output = Object.assign({}, output, attach);
338
+ this.emit('chattext', output)
339
+ }
340
+ else {
332
341
  this.emit('chatthinking', { text: result.thinking.text, completed: result.thinking.completed, action: thinking.action?.tag });
333
342
  }
334
343
  }