Implement file selection to update SYSTEM_PROMPT_PATH

This commit is contained in:
2024-08-21 08:09:35 -05:00
parent 8036ecaec5
commit b8f716d532
+7 -2
View File
@@ -40,6 +40,11 @@ async def button_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
subdir = data.split(":")[1]
await query.edit_message_text(f"Navigating to [{subdir}] is not yet implemented.")
elif data.startswith("file:"):
# Handle file selection (for future implementation)
# Handle file selection
file = data.split(":")[1]
await query.edit_message_text(f"Viewing contents of {file} is not yet implemented.")
file_path = os.path.join('prompts', file)
os.environ['SYSTEM_PROMPT_PATH'] = file_path
await query.edit_message_text(f"Selected: {file}. SYSTEM_PROMPT_PATH updated.")
# Optionally, you may want to reload the system prompt here if needed.
# bot.system_prompt = bot.load_system_prompt() # Uncomment if you have access to the bot instance.