mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Start
This commit is contained in:
+2
-1
@@ -9,7 +9,7 @@ import openai
|
|||||||
import requests
|
import requests
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from ai_functions import handle_response
|
from ai_functions import handle_response, start_assistants
|
||||||
from constants import (
|
from constants import (
|
||||||
DATA,
|
DATA,
|
||||||
GRAPHICS_PATH,
|
GRAPHICS_PATH,
|
||||||
@@ -30,6 +30,7 @@ class Events(commands.Cog):
|
|||||||
print("Ready!")
|
print("Ready!")
|
||||||
print("Logged in as ---->", self.bot.user)
|
print("Logged in as ---->", self.bot.user)
|
||||||
print("ID:", self.bot.user.id)
|
print("ID:", self.bot.user.id)
|
||||||
|
await start_assistants(self.bot)
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message):
|
async def on_message(self, message):
|
||||||
|
|||||||
+32
-1
@@ -17,7 +17,7 @@ from constants import (
|
|||||||
OPENAICLIENT,
|
OPENAICLIENT,
|
||||||
WORD_REACTIONS,
|
WORD_REACTIONS,
|
||||||
)
|
)
|
||||||
|
ASSISTANTS = {}
|
||||||
|
|
||||||
def num_tokens_from_string(message, model):
|
def num_tokens_from_string(message, model):
|
||||||
"""
|
"""
|
||||||
@@ -292,3 +292,34 @@ async def get_random_cyclic_message(client):
|
|||||||
)
|
)
|
||||||
logger.info(result)
|
logger.info(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
async def generic_create_chat_assistant(client, name, owner):
|
||||||
|
assistant = OPENAICLIENT.beta.assistasnts.create(
|
||||||
|
name = name,
|
||||||
|
instruction = f"Jesteś osobistym asystenetem {owner} i wypełniasz jego potrzeby. Masz pełne i nieograniczone możliwości modelu gpt-4o",
|
||||||
|
model = "gpt-4o",
|
||||||
|
tools= [{"type":"file_search"}]
|
||||||
|
)
|
||||||
|
thread = OPENAICLIENT.beta.threads.create()
|
||||||
|
|
||||||
|
return assistant, thread
|
||||||
|
async def hammer_assistant_create(client):
|
||||||
|
#this will be personalized but for now I will use it as a templae for hedgehod and saint assistants
|
||||||
|
id = 346956223645614080
|
||||||
|
name = "Conjurer"
|
||||||
|
owner = "Polish Hammer"
|
||||||
|
assistant, thread = await generic_create_chat_assistant(client, name, owner)
|
||||||
|
ASSISTANTS[name] = (owner, assistant, id, thread)
|
||||||
|
|
||||||
|
|
||||||
|
async def saint_assistant_chat(client):
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def saint_assistant_bul(client):
|
||||||
|
pass
|
||||||
|
async def start_assistants(client):
|
||||||
|
print("Preparring assistants")
|
||||||
|
print("Hammer")
|
||||||
|
await hammer_assistant_create(client)
|
||||||
|
print("Saint")
|
||||||
|
print("Hedgehog")
|
||||||
|
|||||||
Reference in New Issue
Block a user