Skip to content

Commit

Permalink
🐛 fix cohere api errro
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceunx committed May 2, 2024
1 parent 96d5d16 commit 06bd400
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gpt_server/routers/cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


async def get_content(data):
signal = False
async with aiohttp.ClientSession(headers=headers) as sess:
async with sess.post(url, json=data) as res:
async for chunk in res.content:
Expand All @@ -29,6 +30,7 @@ async def get_content(data):
if 'text' not in tmp:
continue
if tmp["is_finished"]:
Singal = True
yield "[DONE]"
else:
yield json.dumps({
Expand All @@ -43,6 +45,8 @@ async def get_content(data):
yield '{"choices":[{"index":0,"delta":{"content":"error from claude"}}]}'
yield "[DONE]"
break
if not Singal:
yield "[DONE]"


@router.post("/chat", status_code=200)
Expand Down

0 comments on commit 06bd400

Please sign in to comment.