diff --git a/cogs/ashwin.py b/cogs/ashwin.py new file mode 100644 index 0000000..205772b --- /dev/null +++ b/cogs/ashwin.py @@ -0,0 +1,20 @@ +import discord +from discord.ext import commands +from util.llmrequest import run + + +class AshwinCog(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def orca(self, ctx): + await ctx.send("Generating message") + result = run("this is an orca prompt") + + await ctx.send(result) + + + +def setup(bot): + bot.add_cog(AshwinCog(bot)) diff --git a/main.py b/main.py index 21fee6e..c523df3 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import discord from discord.ext import commands from dotenv import load_dotenv +from cogs.ashwin import AshwinCog from cogs.greeting import ExampleCog # Load the env file @@ -16,10 +17,8 @@ @bot.event async def on_ready(): - print(f"We have logged in as {bot.user}") - for filename in os.listdir("./cogs"): - if filename.endswith(".py"): - await bot.add_cog(ExampleCog(bot)) + await bot.add_cog(ExampleCog(bot)); + await bot.add_cog(AshwinCog(bot)); bot.run(os.getenv("DISCORD_TOKEN")) diff --git a/util/llm-request.py b/util/llmrequest.py similarity index 87% rename from util/llm-request.py rename to util/llmrequest.py index 025d2da..8491842 100644 --- a/util/llm-request.py +++ b/util/llmrequest.py @@ -3,11 +3,12 @@ import json # For local streaming, the websockets are hosted without ssl - http:// -HOST = "codeapi.forest-anderson.ca" -# HOST = "generalapi.forest-anderson.ca" +#HOST = "codeapi.forest-anderson.ca" +HOST = "generalapi.forest-anderson.ca" URI = f"https://{HOST}/api/v1/generate" + def run(prompt): request = { 'prompt': prompt, @@ -57,7 +58,8 @@ def run(prompt): result = response.json()['results'][0]['text'] print(prompt + result) + return result; -if __name__ == '__main__': - prompt = "In order to make homemade bread, follow these steps:\n1)" - run(prompt) \ No newline at end of file + if __name__ == '__main__': + prompt = "In order to make homemade bread, follow these steps:\n1)" + run(prompt) \ No newline at end of file