Skip to content

Commit

Permalink
disable logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr88 committed Dec 26, 2024
1 parent 6930c55 commit 9be3731
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions plugins/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ async def generate_image(self, prompt, size=None, style=None, quality=None):
async def set_chatgpt(self, message: Message, key: str, value: str, allow_user=False):
"""set the chatgpt key"""
settings_key = self.SETTINGS_KEY
await self.helper.log(f"set_chatgpt {key} {value}")
#await self.helper.log(f"set_chatgpt {key} {value}")
if value is True:
value = "true"
elif value is False:
Expand All @@ -968,7 +968,7 @@ async def set_chatgpt(self, message: Message, key: str, value: str, allow_user=F
async def set_chatgpt_setting(self, key: str, value: str):
"""set the chatgpt key"""
settings_key = self.SETTINGS_KEY
await self.helper.log(f"set_chatgpt {key} {value}")
#await self.helper.log(f"set_chatgpt {key} {value}")
if value is True:
value = "true"
elif value is False:
Expand Down Expand Up @@ -1360,13 +1360,13 @@ async def is_memories_enabled(self, message: Message):
it_is_true = ["true", "True", "", None, True]
if self.get_chatgpt_setting("chatgpt_memories_direct") and message.is_direct_message:
if self.get_chatgpt_setting(f"chatgpt_memories_{message.user_id}_direct") in it_is_true:
await self.helper.log(f"memories_enabled: {True} for {message.user_id} in direct")
#await self.helper.log(f"memories_enabled: {True} for {message.user_id} in direct")
return True
if self.get_chatgpt_setting("chatgpt_memories_channel") and not message.is_direct_message :
if self.get_chatgpt_setting(f"chatgpt_memories_{message.user_id}_channel_{message.channel_id}") in it_is_true:
await self.helper.log(f"memories_enabled: {True} for {message.user_id} in channel {message.channel_id}")
#await self.helper.log(f"memories_enabled: {True} for {message.user_id} in channel {message.channel_id}")
return True
await self.helper.log(f"memories_enabled: {False} for {message.user_id} in channel {message.channel_id} and direct is {message.is_direct_message}")
#await self.helper.log(f"memories_enabled: {False} for {message.user_id} in channel {message.channel_id} and direct is {message.is_direct_message}")
return False
# soon to be deprecated
# @listen_to(".+", needs_mention=True)
Expand Down Expand Up @@ -1437,7 +1437,7 @@ async def chat(self, message: Message, model: str = None):
# user=message.user_id,
# usage_context=rag_usage_context,
#)
await self.helper.log(f"memories_enabled: {memories_enabled}")
#await self.helper.log(f"memories_enabled: {memories_enabled}")
# add memories context just before the user message
# This function checks if the thread exists in valkey and if not, fetches all posts in the thread and adds them to valkey
thread_id = message.reply_id
Expand All @@ -1459,10 +1459,10 @@ async def chat(self, message: Message, model: str = None):
user_text = message.text
message_files = self.extract_file_details(message)
# log the type and filename of the files
for file in message_files:
await self.helper.log(
f"file: {file.get('filename')} type: {file.get('type')}"
)
#for file in message_files:
# await self.helper.log(
# f"file: {file.get('filename')} type: {file.get('type')}"
# )
m = {"role": "user"}
# get username from user_id
username = self.users.id2u(message.user_id)
Expand Down Expand Up @@ -1664,13 +1664,13 @@ def update_status(status_msg):
if self.valkey.hexists(call_key, tool_function["tool_call_id"]):
continue
function_name = tool_function["function_name"]
await self.helper.log(f"function_name: {function_name}")
#await self.helper.log(f"function_name: {function_name}")
tool_call_id = tool_function["tool_call_id"]
# self.helper.slog(f"function_name: {function_name}")
# get function name from the tool manager
tool = self.tools_manager.get_tool(function_name)
function = tool.function
await self.helper.log(f"tool: {tool}")
#await self.helper.log(f"tool: {tool}")
if not tool:
await self.helper.log(
f"Error: function not found: {function_name}"
Expand All @@ -1697,8 +1697,8 @@ def update_status(status_msg):
arguments["message"] = message
if tool.needs_self:
arguments["self"] = self
await self.helper.log(f"tool: {tool}")
await self.helper.log(f"a: {arguments}")
#await self.helper.log(f"tool: {tool}")
#await self.helper.log(f"a: {arguments}")
if tool.returns_files:
# Execute the function
function_result, filename = await function(**arguments)
Expand Down Expand Up @@ -1934,9 +1934,9 @@ async def chat_gpt4_mention(self, message: Message):
"""listen to everything and respond when mentioned"""
# if direct and starting with names bail
if message.is_direct_message and message.text.startswith("@"):
await self.helper.log(
"ignoring private message starting with @ from function chat_gpt4_mention"
)
#await self.helper.log(
# "ignoring private message starting with @ from function chat_gpt4_mention"
#)
return
for name in self.names:
if message.text.startswith(name):
Expand Down

0 comments on commit 9be3731

Please sign in to comment.