Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kav-K committed Apr 18, 2023
1 parent ff9dee8 commit efc75ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cogs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ async def summarize_action(self, ctx, message: discord.Message):
name="chat",
description="Chat with GPT connected to the internet!",
guild_ids=ALLOWED_GUILDS,
checks=[Check.check_gpt_roles()],
checks=[Check.check_search_roles()],
)
@discord.option(
name="search_scope",
Expand Down
9 changes: 7 additions & 2 deletions cogs/search_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ async def on_message(self, message):
pass

agent = self.chat_agents[message.channel.id]
response = await self.bot.loop.run_in_executor(None, agent.run, prompt)
try:
response = await self.bot.loop.run_in_executor(None, agent.run, prompt)
except Exception as e:
response = f"Error: {e}"
traceback.print_exc()
if len(response) > 2000:
embed_pages = await self.paginate_chat_embed(response)
paginator = pages.Paginator(
Expand Down Expand Up @@ -245,7 +249,6 @@ async def search_chat_command(
)

if use_gpt4:
print("using GPT4")
llm = ChatOpenAI(
model="gpt-4", temperature=0.7, openai_api_key=OPENAI_API_KEY
)
Expand All @@ -260,6 +263,8 @@ async def search_chat_command(
agent=AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION,
verbose=True,
memory=memory,
max_execution_time=120,
early_stopping_method="generate",
)

self.chat_agents[thread.id] = agent_chain
Expand Down
2 changes: 1 addition & 1 deletion gpt3discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from models.openai_model import Model


__version__ = "11.3.1"
__version__ = "11.3.2"


PID_FILE = Path("bot.pid")
Expand Down

0 comments on commit efc75ae

Please sign in to comment.