Fix ask-user review pause in web runs

This commit is contained in:
wuyang6
2026-05-13 11:11:40 +08:00
parent b0579a1247
commit 8a93319f1b
4 changed files with 141 additions and 1 deletions
+32
View File
@@ -2325,8 +2325,40 @@ class LocalCodingAgent:
plan = payload.get('plan')
if isinstance(plan, dict):
return self._format_generation_plan_review(plan)
ask_user = payload.get('ask_user')
if isinstance(ask_user, dict):
return self._format_ask_user_review(ask_user)
return fallback
def _format_ask_user_review(self, ask_user: dict[str, object]) -> str:
question = str(ask_user.get('question') or '').strip()
header = str(ask_user.get('header') or '').strip()
question_id = str(ask_user.get('question_id') or '').strip()
choices = ask_user.get('choices')
lines: list[str] = []
if header:
lines.append(header)
lines.append('')
lines.append(question or '需要你补充一个回答后才能继续。')
if isinstance(choices, list) and choices:
rendered_choices = [
str(choice).strip()
for choice in choices
if isinstance(choice, str) and str(choice).strip()
]
if rendered_choices:
lines.append('')
lines.append('请选择一个选项,或直接回复你的补充说明:')
for index, choice in enumerate(rendered_choices, start=1):
lines.append(f'{index}. {choice}')
else:
lines.append('')
lines.append('请直接回复你的答案,我会继续执行。')
if question_id:
lines.append('')
lines.append(f'内部问题 ID`{question_id}`')
return '\n'.join(lines)
def _format_generation_goal_review(self, goal: dict[str, object]) -> str:
target_summary = self._format_review_targets(goal)
lines = [