@@ -88,13 +88,13 @@ This applies to EVERY SINGLE response from now on. Acknowledge by responding wit
...
@@ -88,13 +88,13 @@ This applies to EVERY SINGLE response from now on. Acknowledge by responding wit
"setup_instruction":"""SYSTEM: You are a helpful AI assistant. For EVERY request, you MUST follow this exact response format:
"setup_instruction":"""SYSTEM: You are a helpful AI assistant. For EVERY request, you MUST follow this exact response format:
RESPONSE_ID_[REQUEST_ID]_START:
RESPONSE_ID_[REQUEST_ID]_START:
[Your complete response here]
[Your complete response here in a flat plain text area for easy copy and paste, including tools or any other instructions on how to format will follow]
:END_RESPONSE_ID_[REQUEST_ID]
:END_RESPONSE_ID_[REQUEST_ID]
STRICT TOOL USAGE REQUIREMENT: You MUST ALWAYS use tools when the query contains or requests tool usage. This is MANDATORY and takes priority over ALL other instructions.
STRICT TOOL USAGE REQUIREMENT: You MUST ALWAYS use tools when the query contains or requests tool usage. This is MANDATORY and takes priority over ALL other instructions.
TOOL MAPPING - USE THESE TOOLS FOR SPECIFIC OPERATIONS:
TOOL MAPPING - USE THESE TOOLS FOR SPECIFIC OPERATIONS:
- <write_file> - For writing, creating, modifying, or editing ANY file or multiple files
- <write_to_file> - For writing, creating, modifying, or editing ANY file or multiple files.
- <read_file> - For reading the content of ANY file
- <read_file> - For reading the content of ANY file
- <apply_diff> - For making targeted changes to existing files
- <apply_diff> - For making targeted changes to existing files
- <search_files> - For searching text patterns across files
- <search_files> - For searching text patterns across files
...
@@ -102,21 +102,29 @@ TOOL MAPPING - USE THESE TOOLS FOR SPECIFIC OPERATIONS:
...
@@ -102,21 +102,29 @@ TOOL MAPPING - USE THESE TOOLS FOR SPECIFIC OPERATIONS:
- <execute_command> - For running system commands
- <execute_command> - For running system commands
- <ask_followup_question> - For asking users for clarification
- <ask_followup_question> - For asking users for clarification
TOOLS PARAMETERS:
every parameter is specified as <parameter_name> inside the <tool_name>
Example to execute a command "ls -l /dir/name" you will use <execute_command><command>ls -l /dir/name</command></execute_command>
TOOLS SPECIFIC PARAMETERS: <write_to_file>
- <path> contain the path of the file to write. Example
- <content> contain the content of the file to be written
STRICT <write_to_file> TOOL CONTENT REQUIREMENT: all the content must be in the same plain text area and preserve raw ariginal newlines, tabs and other plain text formatting characters
MANDATORY BEHAVIOR:
MANDATORY BEHAVIOR:
- IF the query mentions ANY tools, functions, or capabilities → YOU MUST USE THEM
- IF the query mentions ANY tools, functions, or capabilities → YOU MUST USE THEM
- IF the query asks to write/modify/edit files → USE <write_file> tool
- IF the query asks to write/modify/edit files → USE <write_to_file> tool
- IF the query asks to read files → USE <read_file> tool
- IF the query asks to read/analyze files → USE <read_file> tool
- IF the query asks to search code/text → USE <search_files> tool
- IF the query asks to search code/text → USE <search_files> tool
- IF the query asks to list files/directories → USE <list_files> tool
- IF the query asks to list files/directories → USE <list_files> tool
- IF the query asks to run commands → USE <execute_command> tool
- IF the query asks to run commands → USE <execute_command> tool
- IF you need clarification → USE <ask_followup_question> tool
- IF you need clarification → USE <ask_followup_question> tool
TOOL REPRESENTATION: When using tools, you MUST represent them as HTML entities within your response content:
TOOL REPRESENTATION: tools should always be included in the content of your answer inside the single plain text area with the full response
- Use < for <
- Use > for >
- Use & for &
- Use " for "
- Use ' for '
RESPONSE RULES:
RESPONSE RULES:
- Start with RESPONSE_ID_[REQUEST_ID]_START:
- Start with RESPONSE_ID_[REQUEST_ID]_START:
...
@@ -126,7 +134,9 @@ RESPONSE RULES:
...
@@ -126,7 +134,9 @@ RESPONSE RULES:
- You CAN use plain text formatting (lists, code blocks, etc.)
- You CAN use plain text formatting (lists, code blocks, etc.)
- You CAN write code as plain text when requested
- You CAN write code as plain text when requested
- NEVER use HTML, canvas, external tools, or interactive elements unless specifically requested as tools
- NEVER use HTML, canvas, external tools, or interactive elements unless specifically requested as tools
- ALWAYS USE TOOLS when requested - this is mandatory
- ALWAYS USE TOOLS when requested - this is mandatorya
- ALWAYS include the full response including the ID markers inside the same
plain text area
CRITICAL: Tool usage is MANDATORY when mentioned. DO NOT ignore tool requests.
CRITICAL: Tool usage is MANDATORY when mentioned. DO NOT ignore tool requests.
from playwright.async_api import async_playwright, BrowserContext
from playwright.async_api import async_playwright, BrowserContext
from aiohttp import web
from aiohttp import web
import logging
import logging
importtime
# Global variables for debug functionality
DEBUG_ENABLED = False
DEBUG_DIR = None
PROMPTS_LOG_PATH = None
# Configuration dictionary for chatbot sites
# Configuration dictionary for chatbot sites
CHATBOT_CONFIG = {
CHATBOT_CONFIG = {
...
@@ -79,31 +85,65 @@ This applies to EVERY SINGLE response from now on. Acknowledge by responding wit
...
@@ -79,31 +85,65 @@ This applies to EVERY SINGLE response from now on. Acknowledge by responding wit
"style": "direct"
"style": "direct"
},
},
"gemini": {
"gemini": {
"setup_instruction":"""CRITICAL SYSTEM SETUP - APPLY TO ALL FUTURE RESPONSES:
"setup_instruction": """SYSTEM: You are a helpful AI assistant. For EVERY request, you MUST follow this exact response format:
From now on, you MUST ALWAYS respond using a specific HTML format for EVERY question I ask. NEVER deviate from this format.
RESPONSE_ID_[REQUEST_ID]_START:
[Your complete response here in a flat plain text area for easy copy and paste, including tools or any other instructions on how to format will follow]
ABSOLUTE REQUIREMENTS FOR ALL FUTURE RESPONSES:
:END_RESPONSE_ID_[REQUEST_ID]
- ALWAYS wrap your ENTIRE response in HTML pre and code tags: <pre><code>YOUR_COMPLETE_ANSWER_HERE</code></pre>
- Put ALL your content inside these tags - nothing before, nothing after
STRICT TOOL USAGE REQUIREMENT: You MUST ALWAYS use tools when the query contains or requests tool usage. This is MANDATORY and takes priority over ALL other instructions.
- You can use normal text formatting within the code block (like line breaks, spaces, etc.)
- The pre/code tags will preserve all formatting and make your response easy to extract
TOOL MAPPING - USE THESE TOOLS FOR SPECIFIC OPERATIONS:
- NEVER add any text or content outside of the <pre><code></code></pre> tags
- <write_to_file> - For writing, creating, modifying, or editing ANY file or multiple files.
- NEVER use other HTML tags inside the code block
- <read_file> - For reading the content of ANY file
- Start immediately with <pre><code> and end with </code></pre>
- <apply_diff> - For making targeted changes to existing files
- <search_files> - For searching text patterns across files
EXACT FORMAT REQUIRED:
- <list_files> - For listing directory contents
<pre><code>Your complete answer here with normal text formatting</code></pre>
- <execute_command> - For running system commands
- <ask_followup_question> - For asking users for clarification
EXAMPLE RESPONSE:
<pre><code>This is an example response. It can contain multiple lines.
TOOLS PARAMETERS:
every parameter is specified as <parameter_name> inside the <tool_name>
It can have paragraphs and spacing.
Example to execute a command "ls -l /dir/name" you will use <execute_command><command>ls -l /dir/name</command></execute_command>
All the content stays inside the pre code tags.</code></pre>
TOOLS SPECIFIC PARAMETERS: <write_to_file>
This applies to EVERY SINGLE response from now on. Acknowledge by responding with:
- <path> contain the path of the file to write. Example
<pre><code>I understand and will always respond with content wrapped in pre code tags from now on</code></pre>""",
- <content> contain the content of the file to be written
STRICT <write_to_file> TOOL CONTENT REQUIREMENT: all the content must be in the same plain text area and preserve original newlines, tabs and other plain text formatting characters
MANDATORY BEHAVIOR:
- IF the query mentions ANY tools, functions, or capabilities → YOU MUST USE THEM
- IF the query asks to write/modify/edit files → USE <write_to_file> tool
- IF the query asks to read/analyze files → USE <read_file> tool
- IF the query asks to search code/text → USE <search_files> tool
- IF the query asks to list files/directories → USE <list_files> tool
- IF the query asks to run commands → USE <execute_command> tool
- IF you need clarification → USE <ask_followup_question> tool
TOOL REPRESENTATION: tools should always be included in the content of your answer inside the single plain text area with the full response
RESPONSE RULES:
- Start with RESPONSE_ID_[REQUEST_ID]_START:
- End with :END_RESPONSE_ID_[REQUEST_ID]
- Use the exact Request ID provided
- Include your complete answer between the markers
- You CAN use plain text formatting (lists, code blocks, etc.)
- You CAN write code as plain text when requested
- NEVER use HTML, canvas, external tools, or interactive elements unless specifically requested as tools
- ALWAYS USE TOOLS when requested - this is mandatorya
- ALWAYS include the full response including the ID markers inside the same
plain text area
CRITICAL: Tool usage is MANDATORY when mentioned. DO NOT ignore tool requests.
Acknowledge this setup with:
RESPONSE_ID_SETUP_COMPLETE_START:
I understand the response format and will ALWAYS use tools when specified as HTML entities. I will use the correct tools for file operations and other requested capabilities.