doomiaichat 7.1.27 → 7.1.28

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.d.ts CHANGED
@@ -71,6 +71,12 @@ export default class CorzBot extends GptBase {
71
71
  * @returns
72
72
  */
73
73
  private parseDeepThinkingJson;
74
+ /**
75
+ *
76
+ * @param date
77
+ * @returns
78
+ */
79
+ private formatDateWithMs;
74
80
  /**
75
81
  * 流式传输聊天请求
76
82
  * @param chatText
package/dist/corzbot.js CHANGED
@@ -223,8 +223,7 @@ class CorzBot extends gptbase_1.default {
223
223
  }
224
224
  ];
225
225
  const client = yield this.createClient();
226
- const requestid = Math.ceil(Math.random() * (new Date().getTime() * Math.random()) / 1000);
227
- const debugStream = this.debug ? (0, fs_1.createWriteStream)((0, path_1.join)(this.debugDir, `sync_${requestid}.log`), { flags: 'a' }) : null;
226
+ const debugStream = this.debug ? (0, fs_1.createWriteStream)((0, path_1.join)(this.debugDir, `sync_${this.formatDateWithMs()}.log`), { flags: 'a' }) : null;
228
227
  ////如果参数中用的是Workflow,则调用对话流来输出结果
229
228
  ////否则用智能体的对话来输出结果
230
229
  const params = yield this.getRequestStream(client, message, callChatOption);
@@ -312,6 +311,23 @@ class CorzBot extends gptbase_1.default {
312
311
  }, content
313
312
  };
314
313
  }
314
+ /**
315
+ *
316
+ * @param date
317
+ * @returns
318
+ */
319
+ formatDateWithMs(date = new Date()) {
320
+ // 获取各时间部分
321
+ const year = date.getFullYear(); // 年(4位)
322
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 月(补0,2位)
323
+ const day = String(date.getDate()).padStart(2, '0'); // 日(补0,2位)
324
+ const hours = String(date.getHours()).padStart(2, '0'); // 时(补0,2位)
325
+ const minutes = String(date.getMinutes()).padStart(2, '0'); // 分(补0,2位)
326
+ const seconds = String(date.getSeconds()).padStart(2, '0'); // 秒(补0,2位)
327
+ const milliseconds = String(date.getMilliseconds()).padStart(3, '0'); // 毫秒(补0,3位)
328
+ // 拼接成 yyyymmddhhmmssSSS 格式
329
+ return `${year}${month}${day}${hours}${minutes}${seconds}${milliseconds}`;
330
+ }
315
331
  /**
316
332
  * 流式传输聊天请求
317
333
  * @param chatText
@@ -339,7 +355,7 @@ class CorzBot extends gptbase_1.default {
339
355
  ////如果参数中用的是Workflow,则调用对话流来输出结果
340
356
  ////否则用智能体的对话来输出结果
341
357
  let requestid = Math.ceil(Math.random() * (new Date().getTime() * Math.random()) / 1000), index = 0;
342
- const debugStream = this.debug ? (0, fs_1.createWriteStream)((0, path_1.join)(this.debugDir, `${requestid}.log`), { flags: 'a' }) : null;
358
+ const debugStream = this.debug ? (0, fs_1.createWriteStream)((0, path_1.join)(this.debugDir, `${this.formatDateWithMs()}.log`), { flags: 'a' }) : null;
343
359
  const params = yield this.getRequestStream(client, message, callChatOption);
344
360
  if (debugStream) {
345
361
  debugStream.write(`callChatOption:${JSON.stringify(callChatOption)}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doomiaichat",
3
- "version": "7.1.27",
3
+ "version": "7.1.28",
4
4
  "description": "Doomisoft OpenAI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/corzbot.ts CHANGED
@@ -201,8 +201,7 @@ export default class CorzBot extends GptBase {
201
201
  }
202
202
  ];
203
203
  const client = await this.createClient();
204
- const requestid = Math.ceil(Math.random() * (new Date().getTime() * Math.random()) / 1000);
205
- const debugStream = this.debug ? createWriteStream(join(this.debugDir, `sync_${requestid}.log`), { flags: 'a' }) : null;
204
+ const debugStream = this.debug ? createWriteStream(join(this.debugDir, `sync_${this.formatDateWithMs()}.log`), { flags: 'a' }) : null;
206
205
  ////如果参数中用的是Workflow,则调用对话流来输出结果
207
206
  ////否则用智能体的对话来输出结果
208
207
  const params = await this.getRequestStream(client, message, callChatOption);
@@ -288,6 +287,24 @@ export default class CorzBot extends GptBase {
288
287
  };
289
288
 
290
289
  }
290
+ /**
291
+ *
292
+ * @param date
293
+ * @returns
294
+ */
295
+ private formatDateWithMs(date = new Date()) {
296
+ // 获取各时间部分
297
+ const year = date.getFullYear(); // 年(4位)
298
+ const month = String(date.getMonth() + 1).padStart(2, '0'); // 月(补0,2位)
299
+ const day = String(date.getDate()).padStart(2, '0'); // 日(补0,2位)
300
+ const hours = String(date.getHours()).padStart(2, '0'); // 时(补0,2位)
301
+ const minutes = String(date.getMinutes()).padStart(2, '0'); // 分(补0,2位)
302
+ const seconds = String(date.getSeconds()).padStart(2, '0'); // 秒(补0,2位)
303
+ const milliseconds = String(date.getMilliseconds()).padStart(3, '0'); // 毫秒(补0,3位)
304
+
305
+ // 拼接成 yyyymmddhhmmssSSS 格式
306
+ return `${year}${month}${day}${hours}${minutes}${seconds}${milliseconds}`;
307
+ }
291
308
  /**
292
309
  * 流式传输聊天请求
293
310
  * @param chatText
@@ -310,7 +327,7 @@ export default class CorzBot extends GptBase {
310
327
  ////如果参数中用的是Workflow,则调用对话流来输出结果
311
328
  ////否则用智能体的对话来输出结果
312
329
  let requestid = Math.ceil(Math.random() * (new Date().getTime() * Math.random()) / 1000), index = 0;
313
- const debugStream = this.debug ? createWriteStream(join(this.debugDir,`${requestid}.log`), { flags: 'a' }) : null;
330
+ const debugStream = this.debug ? createWriteStream(join(this.debugDir, `${this.formatDateWithMs()}.log`), { flags: 'a' }) : null;
314
331
  const params = await this.getRequestStream(client, message, callChatOption);
315
332
  if (debugStream) {
316
333
  debugStream.write(`callChatOption:${JSON.stringify(callChatOption)}\n`);