Added a check to ensure the input text is a string before proceeding with parsing (#22809)

Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
crazywoola
2025-07-23 13:53:27 +08:00
committed by GitHub
parent 82cc37bf51
commit 60c37fe492
4 changed files with 26 additions and 3 deletions

View File

@@ -114,7 +114,8 @@ class LLMGenerator:
),
)
questions = output_parser.parse(cast(str, response.message.content))
text_content = response.message.get_text_content()
questions = output_parser.parse(text_content) if text_content else []
except InvokeError:
questions = []
except Exception:

View File

@@ -15,5 +15,4 @@ class SuggestedQuestionsAfterAnswerOutputParser:
json_obj = json.loads(action_match.group(0).strip())
else:
json_obj = []
return json_obj