mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Fix the ollama ratelimit
This commit is contained in:
parent
7fde67efe0
commit
6aeba86c1e
1 changed files with 1 additions and 1 deletions
|
@ -1877,7 +1877,6 @@ class OtherCog(commands.Cog):
|
||||||
) as response:
|
) as response:
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
return await msg.edit(content="Failed to generate text: `%s`" % response.text)
|
return await msg.edit(content="Failed to generate text: `%s`" % response.text)
|
||||||
last_edit = msg.edited_at.timestamp() if msg.edited_at else msg.created_at.timestamp()
|
|
||||||
async for chunk in ollama_stream_reader(response):
|
async for chunk in ollama_stream_reader(response):
|
||||||
print(chunk)
|
print(chunk)
|
||||||
if "done" not in chunk.keys() or "response" not in chunk.keys():
|
if "done" not in chunk.keys() or "response" not in chunk.keys():
|
||||||
|
@ -1887,6 +1886,7 @@ class OtherCog(commands.Cog):
|
||||||
if chunk["done"] is True:
|
if chunk["done"] is True:
|
||||||
content = None
|
content = None
|
||||||
output.description += chunk["response"]
|
output.description += chunk["response"]
|
||||||
|
last_edit = msg.edited_at.timestamp() if msg.edited_at else msg.created_at.timestamp()
|
||||||
if (time() - last_edit) >= 5 or chunk["done"] is True:
|
if (time() - last_edit) >= 5 or chunk["done"] is True:
|
||||||
await msg.edit(content=content, embed=output)
|
await msg.edit(content=content, embed=output)
|
||||||
await msg.edit(content=None, embed=output)
|
await msg.edit(content=None, embed=output)
|
||||||
|
|
Loading…
Reference in a new issue