Skip to content

Commit

Permalink
fix: switch model issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Zero6992 committed Mar 12, 2023
1 parent 78465ad commit 90bb6ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ async def replyall(interaction: discord.Interaction):
async def chat_model(interaction: discord.Interaction, choices: app_commands.Choice[str]):
await interaction.response.defer(ephemeral=False)
if choices.value == "OFFICIAL":
responses.chatbot = responses.get_chatbot_model("OFFICIAL")
os.environ["CHAT_MODEL"] = "OFFICIAL"
await interaction.followup.send(
"> **Info: You are now in Official GPT-3.5 model.**\n> You need to set your `OPENAI_API_KEY` in `env` file.")
logger.warning("\x1b[31mSwitch to OFFICIAL chat model\x1b[0m")
elif choices.value == "UNOFFCIAL":
elif choices.value == "UNOFFICIAL":
responses.chatbot = responses.get_chatbot_model("UNOFFICIAL")
os.environ["CHAT_MODEL"] = "UNOFFICIAL"
await interaction.followup.send(
"> **Info: You are now in Website ChatGPT model.**\n> You need to set your `SESSION_TOKEN` or `OPENAI_EMAIL` and `OPENAI_PASSWORD` in `env` file.")
Expand All @@ -213,9 +215,9 @@ async def chat_model(interaction: discord.Interaction, choices: app_commands.Cho
async def reset(interaction: discord.Interaction):
chat_model = os.getenv("CHAT_MODEL")
if chat_model == "OFFICIAL":
responses.offical_chatbot.reset()
responses.chatbot.reset()
elif chat_model == "UNOFFICIAL":
responses.unofficial_chatbot.reset_chat()
responses.chatbot.reset_chat()
await interaction.response.defer(ephemeral=False)
await interaction.followup.send("> **Info: I have forgotten everything.**")
logger.warning(
Expand Down

0 comments on commit 90bb6ad

Please sign in to comment.