@gendive/chatllm 0.17.32 → 0.17.33

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.
@@ -3190,42 +3190,14 @@ ${result.content}
3190
3190
  if (activeChecklistRef.current) {
3191
3191
  const checklist = activeChecklistRef.current;
3192
3192
  const stepIndex = checklist.currentStep;
3193
- checklist.stepResults.push(accumulatedContent);
3194
- setSessions(
3195
- (prev) => prev.map((s) => {
3196
- if (s.id !== checklist.sessionId) return s;
3197
- return {
3198
- ...s,
3199
- messages: s.messages.map((m) => {
3200
- if (m.id !== checklist.messageId || !m.checklistBlock) return m;
3201
- const updatedItems = m.checklistBlock.items.map((it, idx) => ({
3202
- ...it,
3203
- status: idx <= stepIndex ? "done" : it.status,
3204
- result: idx === stepIndex ? accumulatedContent : it.result
3205
- }));
3206
- return {
3207
- ...m,
3208
- checklistBlock: { ...m.checklistBlock, items: updatedItems, currentStep: stepIndex + 1 }
3209
- };
3210
- })
3211
- };
3212
- })
3213
- );
3214
- setSessions(
3215
- (prev) => prev.map((s) => {
3216
- if (s.id !== capturedSessionId) return s;
3217
- return {
3218
- ...s,
3219
- messages: s.messages.map((m) => {
3220
- if (m.id !== assistantMessageId) return m;
3221
- return { ...m, hidden: true };
3222
- })
3223
- };
3224
- })
3225
- );
3226
- const nextStep = stepIndex + 1;
3227
- if (nextStep < checklist.items.length) {
3228
- checklist.currentStep = nextStep;
3193
+ const hasPollTag = /<poll[\s>]/i.test(accumulatedContent);
3194
+ if (hasPollTag && !checklist.waitingForPoll) {
3195
+ checklist.waitingForPoll = true;
3196
+ } else {
3197
+ if (checklist.waitingForPoll) {
3198
+ checklist.waitingForPoll = false;
3199
+ }
3200
+ checklist.stepResults.push(accumulatedContent);
3229
3201
  setSessions(
3230
3202
  (prev) => prev.map((s) => {
3231
3203
  if (s.id !== checklist.sessionId) return s;
@@ -3235,21 +3207,87 @@ ${result.content}
3235
3207
  if (m.id !== checklist.messageId || !m.checklistBlock) return m;
3236
3208
  const updatedItems = m.checklistBlock.items.map((it, idx) => ({
3237
3209
  ...it,
3238
- status: idx === nextStep ? "in_progress" : it.status
3210
+ status: idx <= stepIndex ? "done" : it.status,
3211
+ result: idx === stepIndex ? accumulatedContent : it.result
3239
3212
  }));
3240
3213
  return {
3241
3214
  ...m,
3242
- checklistBlock: { ...m.checklistBlock, items: updatedItems, currentStep: nextStep }
3215
+ checklistBlock: { ...m.checklistBlock, items: updatedItems, currentStep: stepIndex + 1 }
3243
3216
  };
3244
3217
  })
3245
3218
  };
3246
3219
  })
3247
3220
  );
3221
+ setSessions(
3222
+ (prev) => prev.map((s) => {
3223
+ if (s.id !== capturedSessionId) return s;
3224
+ return {
3225
+ ...s,
3226
+ messages: s.messages.map((m) => {
3227
+ if (m.id !== assistantMessageId) return m;
3228
+ return { ...m, hidden: true };
3229
+ })
3230
+ };
3231
+ })
3232
+ );
3233
+ const nextStep = stepIndex + 1;
3234
+ if (nextStep < checklist.items.length) {
3235
+ checklist.currentStep = nextStep;
3236
+ setSessions(
3237
+ (prev) => prev.map((s) => {
3238
+ if (s.id !== checklist.sessionId) return s;
3239
+ return {
3240
+ ...s,
3241
+ messages: s.messages.map((m) => {
3242
+ if (m.id !== checklist.messageId || !m.checklistBlock) return m;
3243
+ const updatedItems = m.checklistBlock.items.map((it, idx) => ({
3244
+ ...it,
3245
+ status: idx === nextStep ? "in_progress" : it.status
3246
+ }));
3247
+ return {
3248
+ ...m,
3249
+ checklistBlock: { ...m.checklistBlock, items: updatedItems, currentStep: nextStep }
3250
+ };
3251
+ })
3252
+ };
3253
+ })
3254
+ );
3255
+ skipNextChecklistParsingRef.current = true;
3256
+ setTimeout(() => {
3257
+ sendMessage(
3258
+ `\uCCB4\uD06C\uB9AC\uC2A4\uD2B8 ${nextStep + 1}/${checklist.items.length}\uB2E8\uACC4\uB97C \uC2E4\uD589\uD558\uC138\uC694: "${checklist.items[nextStep].title}".
3259
+ \uC774\uC804 \uB2E8\uACC4 \uACB0\uACFC\uB97C \uCC38\uACE0\uD558\uB418, \uC774 \uB2E8\uACC4\uC5D0\uB9CC \uC9D1\uC911\uD558\uC5EC \uACB0\uACFC\uB97C \uC791\uC131\uD558\uC138\uC694. checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`,
3260
+ { hiddenUserMessage: true }
3261
+ );
3262
+ }, 100);
3263
+ saveMessagesOnEarlyReturn();
3264
+ setIsLoading(false);
3265
+ abortControllerRef.current = null;
3266
+ return;
3267
+ }
3268
+ const stepSummary = checklist.stepResults.map((r, i) => `### ${i + 1}. ${checklist.items[i].title}
3269
+ ${r}`).join("\n\n");
3270
+ setSessions(
3271
+ (prev) => prev.map((s) => {
3272
+ if (s.id !== checklist.sessionId) return s;
3273
+ return {
3274
+ ...s,
3275
+ messages: s.messages.map((m) => {
3276
+ if (m.id !== checklist.messageId || !m.checklistBlock) return m;
3277
+ return { ...m, checklistBlock: { ...m.checklistBlock, completed: true } };
3278
+ })
3279
+ };
3280
+ })
3281
+ );
3282
+ activeChecklistRef.current = null;
3248
3283
  skipNextChecklistParsingRef.current = true;
3249
3284
  setTimeout(() => {
3250
3285
  sendMessage(
3251
- `\uCCB4\uD06C\uB9AC\uC2A4\uD2B8 ${nextStep + 1}/${checklist.items.length}\uB2E8\uACC4\uB97C \uC2E4\uD589\uD558\uC138\uC694: "${checklist.items[nextStep].title}".
3252
- \uC774\uC804 \uB2E8\uACC4 \uACB0\uACFC\uB97C \uCC38\uACE0\uD558\uB418, \uC774 \uB2E8\uACC4\uC5D0\uB9CC \uC9D1\uC911\uD558\uC5EC \uACB0\uACFC\uB97C \uC791\uC131\uD558\uC138\uC694. checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`,
3286
+ `\uBAA8\uB4E0 \uCCB4\uD06C\uB9AC\uC2A4\uD2B8 \uB2E8\uACC4\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC544\uB798\uB294 \uAC01 \uB2E8\uACC4\uBCC4 \uACB0\uACFC\uC785\uB2C8\uB2E4:
3287
+
3288
+ ${stepSummary}
3289
+
3290
+ \uC704 \uACB0\uACFC\uB97C \uC885\uD569\uD558\uC5EC \uCD5C\uC885 \uACB0\uACFC\uBB3C\uC744 \uC644\uC131\uD574\uC8FC\uC138\uC694. checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`,
3253
3291
  { hiddenUserMessage: true }
3254
3292
  );
3255
3293
  }, 100);
@@ -3258,36 +3296,6 @@ ${result.content}
3258
3296
  abortControllerRef.current = null;
3259
3297
  return;
3260
3298
  }
3261
- const stepSummary = checklist.stepResults.map((r, i) => `### ${i + 1}. ${checklist.items[i].title}
3262
- ${r}`).join("\n\n");
3263
- setSessions(
3264
- (prev) => prev.map((s) => {
3265
- if (s.id !== checklist.sessionId) return s;
3266
- return {
3267
- ...s,
3268
- messages: s.messages.map((m) => {
3269
- if (m.id !== checklist.messageId || !m.checklistBlock) return m;
3270
- return { ...m, checklistBlock: { ...m.checklistBlock, completed: true } };
3271
- })
3272
- };
3273
- })
3274
- );
3275
- activeChecklistRef.current = null;
3276
- skipNextChecklistParsingRef.current = true;
3277
- setTimeout(() => {
3278
- sendMessage(
3279
- `\uBAA8\uB4E0 \uCCB4\uD06C\uB9AC\uC2A4\uD2B8 \uB2E8\uACC4\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC544\uB798\uB294 \uAC01 \uB2E8\uACC4\uBCC4 \uACB0\uACFC\uC785\uB2C8\uB2E4:
3280
-
3281
- ${stepSummary}
3282
-
3283
- \uC704 \uACB0\uACFC\uB97C \uC885\uD569\uD558\uC5EC \uCD5C\uC885 \uACB0\uACFC\uBB3C\uC744 \uC644\uC131\uD574\uC8FC\uC138\uC694. checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`,
3284
- { hiddenUserMessage: true }
3285
- );
3286
- }, 100);
3287
- saveMessagesOnEarlyReturn();
3288
- setIsLoading(false);
3289
- abortControllerRef.current = null;
3290
- return;
3291
3299
  }
3292
3300
  if (!skipNextChecklistParsingRef.current) {
3293
3301
  const { checklistBlock, cleanContent: checklistCleanContent } = parseChecklistFromContent(accumulatedContent);
@@ -3642,6 +3650,32 @@ ${allResults}
3642
3650
  });
3643
3651
  const hasValidResponses = formattedParts.length > 0;
3644
3652
  const isAutoGenerate = responses.every((r) => r.skipped);
3653
+ if (activeChecklistRef.current?.waitingForPoll) {
3654
+ const checklist = activeChecklistRef.current;
3655
+ const stepTitle = checklist.items[checklist.currentStep]?.title || "";
3656
+ setSessions(
3657
+ (prev) => prev.map((s) => {
3658
+ if (s.id !== currentSessionId) return s;
3659
+ return {
3660
+ ...s,
3661
+ messages: s.messages.map((m) => {
3662
+ if (m.id !== messageId) return m;
3663
+ return { ...m, pollBlock: void 0, hidden: true };
3664
+ })
3665
+ };
3666
+ })
3667
+ );
3668
+ skipNextPollParsingRef.current = true;
3669
+ skipNextChecklistParsingRef.current = true;
3670
+ const hiddenPrompt2 = isAutoGenerate ? `\uCCB4\uD06C\uB9AC\uC2A4\uD2B8 \uB2E8\uACC4 "${stepTitle}"\uC744 \uC2E4\uD589\uD558\uC138\uC694. \uC0AC\uC6A9\uC790\uAC00 \uC790\uB3D9 \uC120\uD0DD\uC744 \uC694\uCCAD\uD588\uC73C\uBBC0\uB85C, \uCD5C\uC801\uC758 \uC635\uC158\uC744 \uC120\uD0DD\uD558\uC5EC \uC774 \uB2E8\uACC4\uB97C \uC644\uB8CC\uD574\uC8FC\uC138\uC694. poll \uD0DC\uADF8\uC640 checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.` : `\uCCB4\uD06C\uB9AC\uC2A4\uD2B8 \uB2E8\uACC4 "${stepTitle}"\uC744 \uACC4\uC18D\uD569\uB2C8\uB2E4. \uC0AC\uC6A9\uC790\uC758 \uC120\uD0DD:
3671
+ ${formattedParts.join("\n")}
3672
+
3673
+ \uC704 \uC120\uD0DD\uC744 \uBC18\uC601\uD558\uC5EC \uC774 \uB2E8\uACC4\uC758 \uACB0\uACFC\uB97C \uC644\uC131\uD574\uC8FC\uC138\uC694. poll \uD0DC\uADF8\uC640 checklist \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`;
3674
+ setTimeout(() => {
3675
+ sendMessage(hiddenPrompt2, { hiddenUserMessage: true });
3676
+ }, 100);
3677
+ return;
3678
+ }
3645
3679
  setSessions(
3646
3680
  (prev) => prev.map((s) => {
3647
3681
  if (s.id !== currentSessionId) return s;