doomiaichat 7.1.22 → 7.1.25
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 +8 -3
- package/package.json +1 -1
- package/src/corzbot.ts +6 -3
package/dist/corzbot.js
CHANGED
|
@@ -157,6 +157,8 @@ class CorzBot extends gptbase_1.default {
|
|
|
157
157
|
// parameters: Object.assign({ input: message[0]?.content }, this.setting.customVariables || {}, callChatOption.customVariables || {}),
|
|
158
158
|
parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}, { input: (_b = message[0]) === null || _b === void 0 ? void 0 : _b.content })
|
|
159
159
|
};
|
|
160
|
+
if (callChatOption.userid || callChatOption.cozeUserID)
|
|
161
|
+
worflowreq.ext = Object.assign({}, worflowreq.ext || {}, { user_id: callChatOption.userid || callChatOption.cozeUserID });
|
|
160
162
|
return worflowreq;
|
|
161
163
|
}
|
|
162
164
|
const worflowreq = {
|
|
@@ -167,6 +169,8 @@ class CorzBot extends gptbase_1.default {
|
|
|
167
169
|
parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}) //Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {}),
|
|
168
170
|
//parameters: { input: message[0]?.content }
|
|
169
171
|
};
|
|
172
|
+
if (callChatOption.userid || callChatOption.cozeUserID)
|
|
173
|
+
worflowreq.ext = Object.assign({}, worflowreq.ext || {}, { user_id: callChatOption.userid || callChatOption.cozeUserID });
|
|
170
174
|
return worflowreq;
|
|
171
175
|
});
|
|
172
176
|
}
|
|
@@ -326,7 +330,7 @@ class CorzBot extends gptbase_1.default {
|
|
|
326
330
|
(this.workflowid ? client.workflows.runs.stream(params) :
|
|
327
331
|
client.workflows.chat.stream(params));
|
|
328
332
|
let deltaindex = 0, fullanswer = [], cardfollowup = [], followup = [], cardData = [];
|
|
329
|
-
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource =
|
|
333
|
+
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText = ''; // 是否在深度思考中
|
|
330
334
|
try {
|
|
331
335
|
for (var _g = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _a = stream_1_1.done, !_a;) {
|
|
332
336
|
_c = stream_1_1.value;
|
|
@@ -357,10 +361,11 @@ class CorzBot extends gptbase_1.default {
|
|
|
357
361
|
if (thinking) {
|
|
358
362
|
deepThinking = result.content;
|
|
359
363
|
if (thinking.action === DeepThinkingAction.card) {
|
|
360
|
-
cardResource
|
|
364
|
+
cardResource += result.thinking.text;
|
|
361
365
|
// 卡片流结束,解析卡片资源数据
|
|
362
366
|
if (result.thinking.completed) {
|
|
363
|
-
const allCards = cardResource.
|
|
367
|
+
const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|');
|
|
368
|
+
cardResource = '';
|
|
364
369
|
for (const item of allCards) {
|
|
365
370
|
const cardinfo = (0, querystring_1.parse)(item);
|
|
366
371
|
if (cardinfo.type && cardinfo.tag) {
|
package/package.json
CHANGED
package/src/corzbot.ts
CHANGED
|
@@ -145,6 +145,7 @@ export default class CorzBot extends GptBase {
|
|
|
145
145
|
// parameters: Object.assign({ input: message[0]?.content }, this.setting.customVariables || {}, callChatOption.customVariables || {}),
|
|
146
146
|
parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}, { input: message[0]?.content })
|
|
147
147
|
}
|
|
148
|
+
if (callChatOption.userid || callChatOption.cozeUserID) worflowreq.ext = Object.assign({}, worflowreq.ext || {}, { user_id: callChatOption.userid || callChatOption.cozeUserID });
|
|
148
149
|
return worflowreq as T;
|
|
149
150
|
}
|
|
150
151
|
const worflowreq: ChatWorkflowReq = {
|
|
@@ -155,6 +156,7 @@ export default class CorzBot extends GptBase {
|
|
|
155
156
|
parameters: Object.assign({ request_src: 1 }, callChatOption.parameters || {}) //Object.assign({}, this.setting.customVariables || {}, callChatOption.customVariables || {}),
|
|
156
157
|
//parameters: { input: message[0]?.content }
|
|
157
158
|
}
|
|
159
|
+
if (callChatOption.userid || callChatOption.cozeUserID) worflowreq.ext = Object.assign({}, worflowreq.ext||{}, { user_id: callChatOption.userid || callChatOption.cozeUserID });
|
|
158
160
|
return worflowreq as T;
|
|
159
161
|
}
|
|
160
162
|
/**
|
|
@@ -301,7 +303,7 @@ export default class CorzBot extends GptBase {
|
|
|
301
303
|
(this.workflowid ? client.workflows.runs.stream(params as RunWorkflowReq) :
|
|
302
304
|
client.workflows.chat.stream(params as ChatWorkflowReq));
|
|
303
305
|
let deltaindex = 0, fullanswer: string[] = [],cardfollowup: string[] = [], followup: string[] = [], cardData: CardType[] = [];
|
|
304
|
-
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource
|
|
306
|
+
let deepThinking = '', thinkingStatus = DeepThinkingStatus.None, cardResource = '', preresponseText=''; // 是否在深度思考中
|
|
305
307
|
for await (const part of stream) {
|
|
306
308
|
if (part.event === ChatEventType.ERROR) return this.emit('chaterror', { successed: false, error: 'call failed' });
|
|
307
309
|
if (part.event === ChatEventType.CONVERSATION_MESSAGE_DELTA ||
|
|
@@ -326,10 +328,11 @@ export default class CorzBot extends GptBase {
|
|
|
326
328
|
if (thinking) {
|
|
327
329
|
deepThinking = result.content;
|
|
328
330
|
if (thinking.action === DeepThinkingAction.card) {
|
|
329
|
-
cardResource
|
|
331
|
+
cardResource += result.thinking.text;
|
|
330
332
|
// 卡片流结束,解析卡片资源数据
|
|
331
333
|
if (result.thinking.completed) {
|
|
332
|
-
const allCards = cardResource.
|
|
334
|
+
const allCards = cardResource.replace(/[\x00-\x1F\x7F]/g, '').split('|')
|
|
335
|
+
cardResource='';
|
|
333
336
|
for (const item of allCards) {
|
|
334
337
|
const cardinfo: any = parse(item);
|
|
335
338
|
if (cardinfo.type && cardinfo.tag) {
|