Skip to content

Commit

Permalink
Fix error handling when API returns empty
Browse files Browse the repository at this point in the history
  • Loading branch information
yym68686 committed Aug 1, 2024
1 parent 6916ae4 commit e7d701b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ async def new_generator():

return new_generator()
except StopAsyncIteration:
# 处理生成器为空的情况
return async_generator(["data: {'error': 'No data returned'}\n\n"])
raise HTTPException(status_code=status_code, detail="data: {'error': 'No data returned'}")

def post_all_models(token, config, api_list):
all_models = []
Expand Down

0 comments on commit e7d701b

Please sign in to comment.