followup prompts
Browse files227 unmodified lines2282292302312322332342352362374 unmodified lines2422432442452462479 unmodified lines2572582592602612629 unmodified lines27227327427527627711 unmodified lines2892902912922932944 unmodified lines2993003013023033048 unmodified lines3133143153163173183 unmodified lines322323324325326327227 unmodified linesWrite clean, idiomatic, and runnable {language} code for the user's request. If possible, include comments and best practices. Output ONLY the code inside a ``` code block, and do not include any explanations or extra text. If the user provides a file or other context, use it as a reference. If the code is for a script or app, make it as self-contained as possible. Do NOT add the language name at the top of the code output."""# Follow-up system prompt for modifying existing HTML filesFollowUpSystemPrompt = f"""You are an expert web developer modifying an existing HTML file.The user wants to apply changes based on their request.You MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.Format Rules:1. Start with {SEARCH_START}2. Provide the exact lines from the current code that need to be replaced.4 unmodified lines7. To insert code, use an empty SEARCH block (only {SEARCH_START} and {DIVIDER} on their lines) if inserting at the very beginning, otherwise provide the line *before* the insertion point in the SEARCH block and include that line plus the new lines in the REPLACE block.8. To delete code, provide the lines to delete in the SEARCH block and leave the REPLACE block empty (only {DIVIDER} and {REPLACE_END} on their lines).9. IMPORTANT: The SEARCH block must *exactly* match the current code, including indentation and whitespace.Example Modifying Code:```Some explanation...9 unmodified lines</body>{REPLACE_END}```Example Deleting Code:```Removing the paragraph...9 unmodified linesYou MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.The transformers.js application consists of three files: index.html, index.js, and style.css.When making changes, specify which file you're modifying by starting your search/replace blocks with the file name.11 unmodified linesExample Modifying HTML:```Changing the title in index.html...{SEARCH_START}<title>Old Title</title>{DIVIDER}4 unmodified linesExample Modifying JavaScript:```Adding a new function to index.js...{SEARCH_START}// Existing code{DIVIDER}8 unmodified linesExample Modifying CSS:```Changing background color in style.css...{SEARCH_START}body {{background-color: white;3 unmodified linesbackground-color: #f0f0f0;}}{REPLACE_END}```"""# Available models227 unmodified lines2282292302312322332342352362372382392402412422432442452462472482494 unmodified lines2542552562572582592602619 unmodified lines2712722732742752762772782792802812822832842852862872882892902919 unmodified lines30130230330430530630730830931031131211 unmodified lines3243253263273283293304 unmodified lines3353363373383393403418 unmodified lines3503513523533543553563 unmodified lines360361362363364365366367368369370371372373374375376227 unmodified linesWrite clean, idiomatic, and runnable {language} code for the user's request. If possible, include comments and best practices. Output ONLY the code inside a ``` code block, and do not include any explanations or extra text. If the user provides a file or other context, use it as a reference. If the code is for a script or app, make it as self-contained as possible. Do NOT add the language name at the top of the code output."""# Follow-up system prompt for modifying existing HTML filesFollowUpSystemPrompt = f"""You are an expert web developer modifying an existing project.The user wants to apply changes based on their request.You MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.IMPORTANT: When the user reports an ERROR MESSAGE, analyze it carefully to determine which file needs fixing:- ImportError/ModuleNotFoundError β Fix requirements.txt by adding missing packages- Syntax errors in Python code β Fix app.py or the main Python file- HTML/CSS/JavaScript errors β Fix the respective HTML/CSS/JS files- Configuration errors β Fix config files, Docker files, etc.For Python applications (Gradio/Streamlit), the project structure typically includes:- app.py (main application file)- requirements.txt (dependencies)- Other supporting files as neededFormat Rules:1. Start with {SEARCH_START}2. Provide the exact lines from the current code that need to be replaced.4 unmodified lines7. To insert code, use an empty SEARCH block (only {SEARCH_START} and {DIVIDER} on their lines) if inserting at the very beginning, otherwise provide the line *before* the insertion point in the SEARCH block and include that line plus the new lines in the REPLACE block.8. To delete code, provide the lines to delete in the SEARCH block and leave the REPLACE block empty (only {DIVIDER} and {REPLACE_END} on their lines).9. IMPORTANT: The SEARCH block must *exactly* match the current code, including indentation and whitespace.10. For multi-file projects, specify which file you're modifying by starting with the filename before the search/replace block.Example Modifying Code:```Some explanation...9 unmodified lines</body>{REPLACE_END}```Example Fixing Dependencies (requirements.txt):```Adding missing dependency to fix ImportError...=== requirements.txt ==={SEARCH_START}gradiostreamlit{DIVIDER}gradiostreamlitmistral-common{REPLACE_END}```Example Deleting Code:```Removing the paragraph...9 unmodified linesYou MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.IMPORTANT: When the user reports an ERROR MESSAGE, analyze it carefully to determine which file needs fixing:- JavaScript errors/module loading issues β Fix index.js- HTML rendering/DOM issues β Fix index.html- Styling/visual issues β Fix style.css- CDN/library loading errors β Fix script tags in index.htmlThe transformers.js application consists of three files: index.html, index.js, and style.css.When making changes, specify which file you're modifying by starting your search/replace blocks with the file name.11 unmodified linesExample Modifying HTML:```Changing the title in index.html...=== index.html ==={SEARCH_START}<title>Old Title</title>{DIVIDER}4 unmodified linesExample Modifying JavaScript:```Adding a new function to index.js...=== index.js ==={SEARCH_START}// Existing code{DIVIDER}8 unmodified linesExample Modifying CSS:```Changing background color in style.css...=== style.css ==={SEARCH_START}body {{background-color: white;3 unmodified linesbackground-color: #f0f0f0;}}{REPLACE_END}```Example Fixing Library Loading Error:```Fixing transformers.js CDN loading error...=== index.html ==={SEARCH_START}<script type="module" src="https://cdn.jsdelivr.net/npm/@xenova/transformers@2.6.0"></script>{DIVIDER}<script type="module" src="https://cdn.jsdelivr.net/npm/@xenova/transformers@2.17.2"></script>{REPLACE_END}```"""# Available models
app.py+50-1