@yeaft/webchat-agent 0.0.13 → 0.0.15
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/conversation.js +0 -10
- package/package.json +1 -1
package/conversation.js
CHANGED
|
@@ -406,16 +406,8 @@ export function handleAskUserQuestion(conversationId, input, toolCtx) {
|
|
|
406
406
|
questions: input.questions || []
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
-
// 设置超时(5 分钟)
|
|
410
|
-
const timeout = setTimeout(() => {
|
|
411
|
-
console.log(`[AskUser] ${requestId} timed out, auto-resolving with empty answers`);
|
|
412
|
-
ctx.pendingUserQuestions.delete(requestId);
|
|
413
|
-
resolve({ behavior: 'allow', updatedInput: { questions: input.questions, answers: {} } });
|
|
414
|
-
}, 5 * 60 * 1000);
|
|
415
|
-
|
|
416
409
|
ctx.pendingUserQuestions.set(requestId, {
|
|
417
410
|
resolve,
|
|
418
|
-
timeout,
|
|
419
411
|
conversationId,
|
|
420
412
|
input
|
|
421
413
|
});
|
|
@@ -423,7 +415,6 @@ export function handleAskUserQuestion(conversationId, input, toolCtx) {
|
|
|
423
415
|
// 监听 abort signal
|
|
424
416
|
if (toolCtx?.signal) {
|
|
425
417
|
toolCtx.signal.addEventListener('abort', () => {
|
|
426
|
-
clearTimeout(timeout);
|
|
427
418
|
ctx.pendingUserQuestions.delete(requestId);
|
|
428
419
|
reject(new Error('aborted'));
|
|
429
420
|
});
|
|
@@ -438,7 +429,6 @@ export function handleAskUserAnswer(msg) {
|
|
|
438
429
|
const pending = ctx.pendingUserQuestions.get(msg.requestId);
|
|
439
430
|
if (pending) {
|
|
440
431
|
console.log(`[AskUser] Received answer for ${msg.requestId}`);
|
|
441
|
-
clearTimeout(pending.timeout);
|
|
442
432
|
ctx.pendingUserQuestions.delete(msg.requestId);
|
|
443
433
|
pending.resolve({
|
|
444
434
|
behavior: 'allow',
|