mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-20 01:09:26 +00:00
Merge branch 'main' into fix-#548
This commit is contained in:
commit
4e77e5e25c
1 changed files with 17 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
from pathlib import Path
|
||||
import platform
|
||||
from typing import Literal
|
||||
|
|
@ -829,11 +830,22 @@ Based on the user query, determine the type and provide appropriate response."""
|
|||
content = resp.msgs[0].content
|
||||
if not content:
|
||||
return True
|
||||
normalized = content.strip().lower()
|
||||
if normalized in ["yes", "complex"]:
|
||||
return True
|
||||
return sse_json("wait_confirm", {"content": content, "question": prompt})
|
||||
|
||||
content_stripped = content.strip()
|
||||
if content_stripped.startswith('{') and content_stripped.endswith('}'):
|
||||
try:
|
||||
parsed_json = json.loads(content_stripped)
|
||||
result = QuestionAnalysisResult(**parsed_json)
|
||||
except (json.JSONDecodeError, ValueError) as e:
|
||||
logger.warning(f"Failed to parse JSON from content: {e}")
|
||||
normalized = content.strip().lower()
|
||||
if normalized in ["yes", "complex"]:
|
||||
return True
|
||||
return sse_json("wait_confirm", {"content": content, "question": prompt})
|
||||
else:
|
||||
normalized = content.strip().lower()
|
||||
if normalized in ["yes", "complex"]:
|
||||
return True
|
||||
return sse_json("wait_confirm", {"content": content, "question": prompt})
|
||||
if result.type == "simple" and result.answer:
|
||||
return sse_json("wait_confirm", {"content": result.answer, "question": prompt})
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue