Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Remove apply_tool_instructions usage

Abi Raja3a3fe53f1dbc
diff --git a/backend/prompts/agentic_instructions.py b/backend/prompts/agentic_instructions.py
deleted file mode 100644
index cea91e32..00000000
--- a/backend/prompts/agentic_instructions.py
+++ /dev/null
@@ -1,28 +0,0 @@
-TOOL_USE_INSTRUCTIONS = """
-Tooling instructions:
-- You have access to tools: create_file, edit_file, generate_images, remove_background, retrieve_option.
-- The main file is a single HTML file. Use path "index.html" unless told otherwise.
-- For a brand new app, call create_file exactly once with the full HTML.
-- For updates, call edit_file using exact string replacements. Do NOT regenerate the entire file.
-- Do not output raw HTML in chat. Any code changes must go through tools.
-- Use generate_images to create image URLs from prompts (you may pass multiple prompts). The image generation AI is not capable of generating images with a transparent background.
-- Use remove_background to remove the background from a provided image URL when needed.
-- Use retrieve_option to fetch the full HTML for a specific option (1-based option_number) when a user references another option.
-- Any non-tool output should be short, user-facing chat updates.
-"""
-
-
-def apply_tool_instructions(system_prompt: str, should_generate_images: bool) -> str:
- image_flag = "enabled" if should_generate_images else "disabled"
- stripped_system_prompt = system_prompt.strip()
- stripped_tool_instructions = TOOL_USE_INSTRUCTIONS.strip()
-
- if stripped_tool_instructions in stripped_system_prompt:
- return stripped_system_prompt + f"\n\nImage generation is {image_flag}."
-
- return (
- stripped_system_prompt
- + "\n\n"
- + stripped_tool_instructions
- + f"\n\nImage generation is {image_flag}."
- )
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index 1c85fcbc..e5be34c8 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -54,7 +54,6 @@ MessageType = Literal[
"toolResult",
]
from prompts import create_prompt
-from prompts.agentic_instructions import apply_tool_instructions
from prompts.types import Stack, PromptContent
from agent.runner import AgenticRunner
@@ -778,15 +777,6 @@ class PromptCreationMiddleware(Middleware):
context.prompt_messages = await prompt_creator.create_prompt(
context.extracted_params,
)
- if context.prompt_messages:
- first_message = cast(Dict[str, Any], context.prompt_messages[0])
- first_content = first_message.get("content")
- if first_content:
- first_message["content"] = apply_tool_instructions(
- str(first_content),
- context.extracted_params.should_generate_images,
- )
-
await next_func()