jonbot fixes
This commit is contained in:
@@ -33,7 +33,8 @@ if not logger.hasHandlers():
|
||||
|
||||
openai.api_key = config.OPENAI_TOKEN
|
||||
jonkey = config.JONBOT_TOKEN
|
||||
model = config.TXT_MODEL
|
||||
txtmodel = config.TXT_MODEL
|
||||
sysprompt = config.SYSTEM_PROMPT
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.messages = True
|
||||
@@ -47,7 +48,7 @@ client = commands.Bot(
|
||||
|
||||
@client.event
|
||||
async def on_ready():
|
||||
print(f"Logged in as {client.user.name} running {model}.", flush=True)
|
||||
print(f"Logged in as {client.user.name} running {txtmodel}.", flush=True)
|
||||
|
||||
@client.command(name="chat")
|
||||
async def jonchat(ctx, *, prompt):
|
||||
@@ -80,12 +81,12 @@ oai = AsyncOpenAI(
|
||||
base_url=config.BASE_URL,
|
||||
)
|
||||
|
||||
async def generate_chat(self, question: str) -> str:
|
||||
async def generate_chat(question: str) -> str:
|
||||
try:
|
||||
response = await oai.chat.completions.create(
|
||||
model=self.txtmodel,
|
||||
model=txtmodel,
|
||||
messages=[
|
||||
{"role": "system", "content": self.sysprompt},
|
||||
{"role": "system", "content": sysprompt},
|
||||
{"role": "user", "content": question},
|
||||
],
|
||||
max_tokens=400,
|
||||
|
||||
Reference in New Issue
Block a user