Skip to content

Commit

Permalink
Merge pull request netease-youdao#225 from truthsun22/master
Browse files Browse the repository at this point in the history
'NoneType' object is not subscriptable错误不明确,此修改定位到明确错误信息
  • Loading branch information
xixihahaliu authored Apr 26, 2024
2 parents 4b115b2 + 8cd2a90 commit b4fc352
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qanything_kernel/connector/llm/llm_for_fastchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ def _call(self, prompt: str, history: List[List[str]], streaming: bool=False) ->
if not isinstance(event, dict):
event = event.model_dump()

event_text = event["choices"][0]['delta']['content']
if event["choices"] is None:
event_text = event["text"] + " error_code:" + str(event["error_code"])
else:
event_text = event["choices"][0]['delta']['content']
if isinstance(event_text, str) and event_text != "":
# logging.info(f"[debug] event_text = [{event_text}]")
delta = {'answer': event_text}
Expand Down

0 comments on commit b4fc352

Please sign in to comment.