Spaces:
Running
Running
fix system prompt
Browse files- anycoder_app/deploy.py +10 -5
anycoder_app/deploy.py
CHANGED
|
@@ -36,17 +36,18 @@ from .models import (
|
|
| 36 |
history_to_chatbot_messages, strip_placeholder_thinking,
|
| 37 |
is_placeholder_thinking_only, extract_last_thinking_line
|
| 38 |
)
|
|
|
|
| 39 |
from .prompts import (
|
| 40 |
HTML_SYSTEM_PROMPT,
|
| 41 |
TRANSFORMERS_JS_SYSTEM_PROMPT, STREAMLIT_SYSTEM_PROMPT,
|
| 42 |
REACT_SYSTEM_PROMPT, REACT_FOLLOW_UP_SYSTEM_PROMPT,
|
| 43 |
-
|
| 44 |
GENERIC_SYSTEM_PROMPT, MULTIPAGE_HTML_SYSTEM_PROMPT,
|
| 45 |
DYNAMIC_MULTIPAGE_HTML_SYSTEM_PROMPT,
|
| 46 |
FollowUpSystemPrompt, GradioFollowUpSystemPrompt,
|
| 47 |
TransformersJSFollowUpSystemPrompt
|
| 48 |
)
|
| 49 |
-
from .docs_manager import get_comfyui_system_prompt, update_gradio_system_prompts
|
| 50 |
|
| 51 |
|
| 52 |
def check_authentication(profile: Optional[gr.OAuthProfile] = None, token: Optional[gr.OAuthToken] = None) -> Tuple[bool, str]:
|
|
@@ -227,9 +228,11 @@ Generate the exact search/replace blocks needed to make these changes."""
|
|
| 227 |
else:
|
| 228 |
session_id = str(uuid.uuid4())
|
| 229 |
|
| 230 |
-
# Update
|
| 231 |
if language == "gradio":
|
| 232 |
update_gradio_system_prompts()
|
|
|
|
|
|
|
| 233 |
|
| 234 |
# Choose system prompt based on context
|
| 235 |
# Special case: If user is asking about model identity, use neutral prompt
|
|
@@ -255,11 +258,13 @@ Generate the exact search/replace blocks needed to make these changes."""
|
|
| 255 |
elif language == "react":
|
| 256 |
system_prompt = REACT_SYSTEM_PROMPT
|
| 257 |
elif language == "gradio":
|
| 258 |
-
|
|
|
|
| 259 |
elif language == "streamlit":
|
| 260 |
system_prompt = STREAMLIT_SYSTEM_PROMPT
|
| 261 |
elif language == "json":
|
| 262 |
-
|
|
|
|
| 263 |
elif language == "comfyui":
|
| 264 |
system_prompt = get_comfyui_system_prompt()
|
| 265 |
else:
|
|
|
|
| 36 |
history_to_chatbot_messages, strip_placeholder_thinking,
|
| 37 |
is_placeholder_thinking_only, extract_last_thinking_line
|
| 38 |
)
|
| 39 |
+
from . import prompts
|
| 40 |
from .prompts import (
|
| 41 |
HTML_SYSTEM_PROMPT,
|
| 42 |
TRANSFORMERS_JS_SYSTEM_PROMPT, STREAMLIT_SYSTEM_PROMPT,
|
| 43 |
REACT_SYSTEM_PROMPT, REACT_FOLLOW_UP_SYSTEM_PROMPT,
|
| 44 |
+
JSON_SYSTEM_PROMPT,
|
| 45 |
GENERIC_SYSTEM_PROMPT, MULTIPAGE_HTML_SYSTEM_PROMPT,
|
| 46 |
DYNAMIC_MULTIPAGE_HTML_SYSTEM_PROMPT,
|
| 47 |
FollowUpSystemPrompt, GradioFollowUpSystemPrompt,
|
| 48 |
TransformersJSFollowUpSystemPrompt
|
| 49 |
)
|
| 50 |
+
from .docs_manager import get_comfyui_system_prompt, update_gradio_system_prompts, update_json_system_prompts
|
| 51 |
|
| 52 |
|
| 53 |
def check_authentication(profile: Optional[gr.OAuthProfile] = None, token: Optional[gr.OAuthToken] = None) -> Tuple[bool, str]:
|
|
|
|
| 228 |
else:
|
| 229 |
session_id = str(uuid.uuid4())
|
| 230 |
|
| 231 |
+
# Update system prompts if needed
|
| 232 |
if language == "gradio":
|
| 233 |
update_gradio_system_prompts()
|
| 234 |
+
elif language == "json":
|
| 235 |
+
update_json_system_prompts()
|
| 236 |
|
| 237 |
# Choose system prompt based on context
|
| 238 |
# Special case: If user is asking about model identity, use neutral prompt
|
|
|
|
| 258 |
elif language == "react":
|
| 259 |
system_prompt = REACT_SYSTEM_PROMPT
|
| 260 |
elif language == "gradio":
|
| 261 |
+
# Access GRADIO_SYSTEM_PROMPT from prompts module to get updated value
|
| 262 |
+
system_prompt = prompts.GRADIO_SYSTEM_PROMPT
|
| 263 |
elif language == "streamlit":
|
| 264 |
system_prompt = STREAMLIT_SYSTEM_PROMPT
|
| 265 |
elif language == "json":
|
| 266 |
+
# Access JSON_SYSTEM_PROMPT from prompts module to get updated value
|
| 267 |
+
system_prompt = prompts.JSON_SYSTEM_PROMPT
|
| 268 |
elif language == "comfyui":
|
| 269 |
system_prompt = get_comfyui_system_prompt()
|
| 270 |
else:
|