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
commit 60c37fe492
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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