Update config.py
Browse files
config.py
CHANGED
|
@@ -2,51 +2,17 @@
|
|
| 2 |
|
| 3 |
"""
|
| 4 |
Centralized configuration for the AnyCoder application.
|
| 5 |
-
|
| 6 |
-
This module contains all static data and configuration values, such as
|
| 7 |
-
system prompts, available models, demo examples, and UI constants.
|
| 8 |
-
Separating configuration from logic makes the application easier to
|
| 9 |
-
manage and update.
|
| 10 |
"""
|
| 11 |
from typing import List, Dict, Union
|
| 12 |
|
| 13 |
-
# --- System Prompts ---
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
- Create a modern, responsive design with improved typography and spacing.
|
| 20 |
-
If an image is provided, analyze it and use the visual information to better understand the user's requirements.
|
| 21 |
-
Always output only the HTML code inside a ```html ... ``` code block, and do not include any explanations or extra text.
|
| 22 |
-
"""
|
| 23 |
-
|
| 24 |
-
GENERIC_SYSTEM_PROMPT = """You are an expert {language} developer. Write 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."""
|
| 25 |
|
| 26 |
-
|
| 27 |
-
"ALWAYS GIVE THE RESPONSE INTO A SINGLE HTML FILE",
|
| 28 |
-
"You have access to real-time web search. When needed, use web search to find the latest information, best practices, or specific technologies. ALWAYS GIVE THE RESPONSE INTO A SINGLE HTML FILE"
|
| 29 |
-
)
|
| 30 |
-
|
| 31 |
-
GENERIC_SYSTEM_PROMPT_WITH_SEARCH = GENERIC_SYSTEM_PROMPT.replace(
|
| 32 |
-
"You are an expert",
|
| 33 |
-
"You are an expert {language} developer. You have access to real-time web search. When needed, use web search to find the latest information, best practices, or specific technologies for {language}."
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
FOLLOW_UP_SYSTEM_PROMPT = """You are an expert web developer modifying an existing HTML file.
|
| 37 |
-
The user wants to apply changes based on their request.
|
| 38 |
-
You MUST output ONLY the changes required using the following SEARCH/REPLACE block format. Do NOT output the entire file.
|
| 39 |
-
Explain the changes briefly *before* the blocks if necessary, but the code changes THEMSELVES MUST be within the blocks.
|
| 40 |
-
Format Rules:
|
| 41 |
-
1. Start with <<<<<<< SEARCH
|
| 42 |
-
2. Provide the exact lines from the current code that need to be replaced.
|
| 43 |
-
3. Use ======= to separate the search block from the replacement.
|
| 44 |
-
4. Provide the new lines that should replace the original lines.
|
| 45 |
-
5. End with >>>>>>> REPLACE
|
| 46 |
-
6. IMPORTANT: The SEARCH block must *exactly* match the current code, including indentation and whitespace.
|
| 47 |
-
"""
|
| 48 |
-
|
| 49 |
-
# --- Search/Replace Constants ---
|
| 50 |
SEARCH_START = "<<<<<<< SEARCH"
|
| 51 |
DIVIDER = "======="
|
| 52 |
REPLACE_END = ">>>>>>> REPLACE"
|
|
@@ -54,21 +20,37 @@ REPLACE_END = ">>>>>>> REPLACE"
|
|
| 54 |
# --- Models & UI ---
|
| 55 |
|
| 56 |
AVAILABLE_MODELS: List[Dict[str, str]] = [
|
| 57 |
-
|
| 58 |
-
{"name": "
|
| 59 |
-
{"name": "
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
{"name": "
|
| 63 |
-
{"name": "
|
| 64 |
-
{"name": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
]
|
| 66 |
|
| 67 |
MULTIMODAL_MODELS: List[str] = [
|
| 68 |
-
"baidu/ERNIE-4.5-VL-424B-A47B-Base-PT",
|
| 69 |
-
"THUDM/GLM-4.1V-9B-Thinking",
|
| 70 |
]
|
| 71 |
|
|
|
|
|
|
|
| 72 |
DEMO_LIST: List[Dict[str, str]] = [
|
| 73 |
{"title": "Todo App", "description": "Create a simple todo application with add, delete, and mark as complete functionality"},
|
| 74 |
{"title": "Calculator", "description": "Build a basic calculator with standard arithmetic operations"},
|
|
|
|
| 2 |
|
| 3 |
"""
|
| 4 |
Centralized configuration for the AnyCoder application.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"""
|
| 6 |
from typing import List, Dict, Union
|
| 7 |
|
| 8 |
+
# --- System Prompts --- (No changes needed)
|
| 9 |
+
HTML_SYSTEM_PROMPT = """..."""
|
| 10 |
+
GENERIC_SYSTEM_PROMPT = """..."""
|
| 11 |
+
HTML_SYSTEM_PROMPT_WITH_SEARCH = """..."""
|
| 12 |
+
GENERIC_SYSTEM_PROMPT_WITH_SEARCH = """..."""
|
| 13 |
+
FOLLOW_UP_SYSTEM_PROMPT = """..."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# --- Search/Replace Constants --- (No changes needed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
SEARCH_START = "<<<<<<< SEARCH"
|
| 17 |
DIVIDER = "======="
|
| 18 |
REPLACE_END = ">>>>>>> REPLACE"
|
|
|
|
| 20 |
# --- Models & UI ---
|
| 21 |
|
| 22 |
AVAILABLE_MODELS: List[Dict[str, str]] = [
|
| 23 |
+
# --- OpenAI Models ---
|
| 24 |
+
{"name": "OpenAI GPT-4o", "id": "openai/gpt-4o"},
|
| 25 |
+
{"name": "OpenAI GPT-4 Turbo", "id": "openai/gpt-4-turbo"},
|
| 26 |
+
|
| 27 |
+
# --- Groq Models (Fastest) ---
|
| 28 |
+
{"name": "Groq Llama3 70b", "id": "groq/llama3-70b-8192"},
|
| 29 |
+
{"name": "Groq Llama3 8b", "id": "groq/llama3-8b-8192"},
|
| 30 |
+
{"name": "Groq Mixtral 8x7b", "id": "groq/mixtral-8x7b-32768"},
|
| 31 |
+
|
| 32 |
+
# --- Google Gemini Models ---
|
| 33 |
+
{"name": "Google Gemini 1.5 Pro", "id": "gemini/gemini-1.5-pro-latest"},
|
| 34 |
+
|
| 35 |
+
# --- DeepSeek Models (Direct API) ---
|
| 36 |
+
{"name": "DeepSeek Coder V2", "id": "deepseek/deepseek-coder-v2-instruct"},
|
| 37 |
+
{"name": "DeepSeek Chat V2", "id": "deepseek/deepseek-chat"},
|
| 38 |
+
|
| 39 |
+
# --- Fireworks AI Models ---
|
| 40 |
+
{"name": "Fireworks Firefunction V1", "id": "fireworks/accounts/fireworks/models/firefunction-v1"},
|
| 41 |
+
|
| 42 |
+
# --- Hugging Face Multimodal Models ---
|
| 43 |
+
{"name": "HuggingFace ERNIE-VL", "id": "huggingface/baidu/ERNIE-4.5-VL-424B-A47B-Base-PT"},
|
| 44 |
+
{"name": "HuggingFace GLM-VL", "id": "huggingface/THUDM/GLM-4.1V-9B-Thinking"},
|
| 45 |
]
|
| 46 |
|
| 47 |
MULTIMODAL_MODELS: List[str] = [
|
| 48 |
+
"huggingface/baidu/ERNIE-4.5-VL-424B-A47B-Base-PT",
|
| 49 |
+
"huggingface/THUDM/GLM-4.1V-9B-Thinking",
|
| 50 |
]
|
| 51 |
|
| 52 |
+
# (DEMO_LIST and GRADIO_SUPPORTED_LANGUAGES remain the same)
|
| 53 |
+
|
| 54 |
DEMO_LIST: List[Dict[str, str]] = [
|
| 55 |
{"title": "Todo App", "description": "Create a simple todo application with add, delete, and mark as complete functionality"},
|
| 56 |
{"title": "Calculator", "description": "Build a basic calculator with standard arithmetic operations"},
|