Reply to target message in AskAI

This commit is contained in:
Nexus 2024-04-18 00:46:04 +01:00
parent 42215bff2a
commit c5ca971134
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -891,15 +891,14 @@ class Ollama(commands.Cog):
await ctx.delete(delay=0.1)
messages = self.history.get_history(thread)
embed = discord.Embed(description="*Waking Ollama up...*")
embed.add_field(
name="\u200b",
value="[in reply to message from {0.author.display_name}]({0.jump_url})".format(message),
)
async with self.lock:
await ctx.respond(embed=embed)
msg = await message.reply(embed=embed)
last_edit = time.time()
with client.new_chat("orca-mini:3b", messages) as handler:
deleted = False
async for ln in handler:
if not deleted:
await ctx.delete()
done = ln.get("done") is True
embed.description = handler.result
if len(embed.description) >= 4096:
@ -916,7 +915,7 @@ class Ollama(commands.Cog):
if done:
break
embed.colour = discord.Colour.dark_theme()
return await ctx.edit(embed=embed)
return await msg.edit(embed=embed)
def setup(bot):