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:
@@ -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:
|
||||
|
@@ -15,5 +15,4 @@ class SuggestedQuestionsAfterAnswerOutputParser:
|
||||
json_obj = json.loads(action_match.group(0).strip())
|
||||
else:
|
||||
json_obj = []
|
||||
|
||||
return json_obj
|
||||
|
Reference in New Issue
Block a user