doomiaichat 7.1.15 → 7.1.17

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
@@ -129,16 +129,15 @@ class CorzBot extends gptbase_1.default {
129
129
  * @param _axiosOption
130
130
  */
131
131
  getRequestStream(client, message, callChatOption = {}) {
132
- var _a, _b;
132
+ var _a, _b, _c;
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  //简单的对话请求
135
- const conversation_id = (_a = callChatOption.session_id) !== null && _a !== void 0 ? _a : yield this.createCoversation(client);
136
135
  if (this.botid) {
137
136
  const req = {
138
137
  bot_id: this.botid,
139
138
  additional_messages: message,
140
139
  user_id: callChatOption.userid || callChatOption.cozeUserID,
141
- conversation_id,
140
+ conversation_id: (_a = callChatOption.session_id) !== null && _a !== void 0 ? _a : yield this.createCoversation(client),
142
141
  parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}),
143
142
  };
144
143
  req.custom_variables = Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {});
@@ -158,7 +157,7 @@ class CorzBot extends gptbase_1.default {
158
157
  additional_messages: message,
159
158
  ext: callChatOption.ext,
160
159
  workflow_id: this.talkflowid,
161
- conversation_id,
160
+ conversation_id: (_c = callChatOption.session_id) !== null && _c !== void 0 ? _c : yield this.createCoversation(client),
162
161
  parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}) //Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {}),
163
162
  //parameters: { input: message[0]?.content }
164
163
  };
@@ -366,7 +365,7 @@ class CorzBot extends gptbase_1.default {
366
365
  const spiltPreresponse = result.thinking.text.slice(preresponseText.length);
367
366
  preresponseText = result.thinking.text;
368
367
  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 };
368
+ 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
369
  if (attach)
371
370
  output = Object.assign({}, output, attach);
372
371
  this.emit('chattext', output);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doomiaichat",
3
- "version": "7.1.15",
3
+ "version": "7.1.17",
4
4
  "description": "Doomisoft OpenAI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/corzbot.ts CHANGED
@@ -120,13 +120,12 @@ export default class CorzBot extends GptBase {
120
120
  */
121
121
  async getRequestStream<T>(client: CozeAPI, message: EnterMessage[], callChatOption: any = {}): Promise<T> {
122
122
  //简单的对话请求
123
- const conversation_id = callChatOption.session_id ?? await this.createCoversation(client);
124
123
  if (this.botid) {
125
124
  const req: StreamChatReq = {
126
125
  bot_id: this.botid,
127
126
  additional_messages: message,
128
127
  user_id: callChatOption.userid || callChatOption.cozeUserID,
129
- conversation_id,
128
+ conversation_id: callChatOption.session_id ?? await this.createCoversation(client),
130
129
  parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}),
131
130
  }
132
131
  req.custom_variables = Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {});
@@ -146,7 +145,7 @@ export default class CorzBot extends GptBase {
146
145
  additional_messages: message,
147
146
  ext: callChatOption.ext,
148
147
  workflow_id: this.talkflowid!,//callChatOption.workflowid,
149
- conversation_id,
148
+ conversation_id: callChatOption.session_id ?? await this.createCoversation(client),
150
149
  parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}) //Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {}),
151
150
  //parameters: { input: message[0]?.content }
152
151
  }
@@ -333,7 +332,7 @@ export default class CorzBot extends GptBase {
333
332
  const spiltPreresponse = result.thinking.text.slice(preresponseText.length)
334
333
  preresponseText = result.thinking.text;
335
334
  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 };
335
+ 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
336
  if (attach) output = Object.assign({}, output, attach);
338
337
  this.emit('chattext', output)
339
338
  }