From 88713a95c10388ec971486cf5ffd1cbdd8021edc Mon Sep 17 00:00:00 2001 From: cyclop-bot <178948048+cyclop-bot@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:04:26 -0500 Subject: [PATCH 1/3] Add get_bot_status abstract method to InferenceBot --- inference_bot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inference_bot.py b/inference_bot.py index 0c516d9..198bae9 100644 --- a/inference_bot.py +++ b/inference_bot.py @@ -43,4 +43,9 @@ class InferenceBot(ABC): An attribute (e.g., a dictionary) to store the processing status for users. Example usage in subclass: self.processing_status.get(user_id) """ - pass \ No newline at end of file + pass + + @abstractmethod + def get_bot_status(self): + """Returns a human-readable message describing the model in use and the system prompt path.""" + pass From 9c9b5991b6624770dc70acea6bd4c79e929c7d49 Mon Sep 17 00:00:00 2001 From: cyclop-bot <178948048+cyclop-bot@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:04:27 -0500 Subject: [PATCH 2/3] Implement get_bot_status method to report enabled model and prompt path --- openai_compatible_inference_bot.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/openai_compatible_inference_bot.py b/openai_compatible_inference_bot.py index f9f5e78..2a483dc 100644 --- a/openai_compatible_inference_bot.py +++ b/openai_compatible_inference_bot.py @@ -31,6 +31,7 @@ class OpenAICompatibleInferenceBot(InferenceBot): self.allowed_function_tags = allowed_function_tags if allowed_function_tags else None self.conversation_history = {} self._processing_status = {} + self.system_prompt_path = system_prompt_path # Store the prompt path for status # MODIFIED to pass arguments self.system_prompt = self.load_system_prompt( file_path=system_prompt_path @@ -118,6 +119,14 @@ class OpenAICompatibleInferenceBot(InferenceBot): logging.error(f"API call to model {self.model} failed: {e}") raise + def get_bot_status(self): + """ + Returns a message with the currently enabled model and the system prompt path being used. + """ + model_name = self.model if hasattr(self, 'model') else None + prompt_path = self.system_prompt_path or os.getenv("SYSTEM_PROMPT_PATH") or "(default prompt in use)" + return f"Current model: {model_name}\nSystem prompt path: {prompt_path}" + async def handle_message(self, user_id, user_message): if user_id not in self.conversation_history or not self.conversation_history[user_id]: self.conversation_history[user_id] = [] @@ -281,7 +290,7 @@ class OpenAICompatibleInferenceBot(InferenceBot): if function_call_arguments is None: function_args = {} else: - logging.error(f"Unexpected type for function_call_arguments for {function_call_name}: {type(function_call_arguments)}. Arguments: {function_call_arguments}") + logging.error(f"Unexpected type for function_call_arguments for {function_name}: {type(function_call_arguments)}. Arguments: {function_call_arguments}") return f"Error: Invalid argument type for tool call: {type(function_call_arguments)}" for tool in self.tools: @@ -378,4 +387,4 @@ def main(): return if __name__ == '__main__': - main() \ No newline at end of file + main() From aeb9acd97c9012c9c5685013e485801771d1001d Mon Sep 17 00:00:00 2001 From: cyclop-bot <178948048+cyclop-bot@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:06:59 -0500 Subject: [PATCH 3/3] Ensure browse_command updates bot.system_prompt_path when prompt file is selected --- browse_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/browse_command.py b/browse_command.py index b263146..2122b17 100644 --- a/browse_command.py +++ b/browse_command.py @@ -62,5 +62,7 @@ async def button_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) -> # Handle file selection file_path = data.split(":")[1] os.environ['SYSTEM_PROMPT_PATH'] = file_path + if hasattr(browse_command_bot, 'system_prompt_path'): + browse_command_bot.system_prompt_path = file_path browse_command_bot.system_prompt = browse_command_bot.load_system_prompt() - await query.edit_message_text(f"Selected: {file_path}. System prompt updated.") \ No newline at end of file + await query.edit_message_text(f"Selected: {file_path}. System prompt updated.")