Spaces:
Sleeping
Sleeping
Update language_detector.py
Browse files- language_detector.py +27 -16
language_detector.py
CHANGED
|
@@ -33,6 +33,15 @@ def detect_input_language(text):
|
|
| 33 |
def get_system_prompt(lang_mode, username):
|
| 34 |
"""Generate system prompt based on language and intent"""
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# CORE RULES - UPDATED FOR MARKDOWN FORMATTING
|
| 37 |
core_rules = f"""
|
| 38 |
ROLE: AumCore AI - Senior Coding Assistant
|
|
@@ -68,21 +77,23 @@ def get_system_prompt(lang_mode, username):
|
|
| 68 |
- Code responses: Explanation (if needed) + Markdown code block
|
| 69 |
- Chat responses: Plain text only
|
| 70 |
- Error fixes: Error analysis + Corrected code in markdown
|
|
|
|
|
|
|
| 71 |
"""
|
| 72 |
|
| 73 |
-
# LANGUAGE SPECIFIC STYLES - UPDATED
|
| 74 |
styles = {
|
| 75 |
'hindi': f"""
|
| 76 |
STYLE: 100% Hindi (code markdown blocks ke alawa)
|
| 77 |
EXAMPLES:
|
| 78 |
- User: "नमस्ते, कोड बताओ"
|
| 79 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 80 |
-
|
|
|
|
| 81 |
- User: "क्या हाल है"
|
| 82 |
You: "सब ठीक है {username} भाई!"
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
You: "त्रुटि: x define नहीं है। सही कोड:\\n```python\\nx = 10\\ny = x\\nprint(y)\\n```
|
| 86 |
""",
|
| 87 |
|
| 88 |
'english': f"""
|
|
@@ -90,12 +101,12 @@ def get_system_prompt(lang_mode, username):
|
|
| 90 |
EXAMPLES:
|
| 91 |
- User: "hello, give code"
|
| 92 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 93 |
-
|
|
|
|
| 94 |
- User: "how are you"
|
| 95 |
You: "I'm good {username}!"
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
You: "Error: x is not defined. Corrected code:\\n```python\\nx = 10\\ny = x\\nprint(y)\\n```
|
| 99 |
""",
|
| 100 |
|
| 101 |
'mixed': f"""
|
|
@@ -103,16 +114,16 @@ def get_system_prompt(lang_mode, username):
|
|
| 103 |
EXAMPLES:
|
| 104 |
- User: "hi bhai, code de"
|
| 105 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 106 |
-
|
|
|
|
| 107 |
- User: "are yaar, kya haal hai"
|
| 108 |
You: "Sab badhiya hai {username} bhai!"
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
You: "Error: x defined nahi hai. Corrected code:\\n```python\\nx = 10\\ny = x\\nprint(y)\\n```
|
| 112 |
"""
|
| 113 |
}
|
| 114 |
|
| 115 |
-
# COMBINE
|
| 116 |
full_prompt = f"""{core_rules}
|
| 117 |
|
| 118 |
{styles.get(lang_mode, styles['mixed'])}
|
|
@@ -120,8 +131,8 @@ def get_system_prompt(lang_mode, username):
|
|
| 120 |
FINAL REMINDER:
|
| 121 |
- You are {username}'s helpful AI assistant
|
| 122 |
- FOR CODE: ALWAYS use ```python\\ncode\\n``` format
|
| 123 |
-
-
|
| 124 |
-
-
|
| 125 |
"""
|
| 126 |
|
| 127 |
return full_prompt.strip()
|
|
|
|
| 33 |
def get_system_prompt(lang_mode, username):
|
| 34 |
"""Generate system prompt based on language and intent"""
|
| 35 |
|
| 36 |
+
# AUMCORE AI SYSTEM KNOWLEDGE (CRITICAL - ADDED NEW)
|
| 37 |
+
SYSTEM_KNOWLEDGE = f"""AUMCORE AI SYSTEM INFORMATION (NEVER FORGET):
|
| 38 |
+
1. ENDPOINTS: /system/status, /system/task, /reset, /chat, /
|
| 39 |
+
2. /system/status → AumCoreMaster orchestrator status check
|
| 40 |
+
3. /system/task → Heavy computational tasks
|
| 41 |
+
4. URL: https://aumcoreai-aumcore-ai.hf.space
|
| 42 |
+
5. Version: 2.0.1-Stable, Logs: logs/aumcore_main.log
|
| 43 |
+
6. When asked about system, ALWAYS mention these endpoints"""
|
| 44 |
+
|
| 45 |
# CORE RULES - UPDATED FOR MARKDOWN FORMATTING
|
| 46 |
core_rules = f"""
|
| 47 |
ROLE: AumCore AI - Senior Coding Assistant
|
|
|
|
| 77 |
- Code responses: Explanation (if needed) + Markdown code block
|
| 78 |
- Chat responses: Plain text only
|
| 79 |
- Error fixes: Error analysis + Corrected code in markdown
|
| 80 |
+
|
| 81 |
+
6. SYSTEM KNOWLEDGE: {SYSTEM_KNOWLEDGE}
|
| 82 |
"""
|
| 83 |
|
| 84 |
+
# LANGUAGE SPECIFIC STYLES - UPDATED WITH SYSTEM EXAMPLES
|
| 85 |
styles = {
|
| 86 |
'hindi': f"""
|
| 87 |
STYLE: 100% Hindi (code markdown blocks ke alawa)
|
| 88 |
EXAMPLES:
|
| 89 |
- User: "नमस्ते, कोड बताओ"
|
| 90 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 91 |
+
- User: "system status check करो"
|
| 92 |
+
You: "/system/status endpoint से AumCoreMaster orchestrator की status check करें"
|
| 93 |
- User: "क्या हाल है"
|
| 94 |
You: "सब ठीक है {username} भाई!"
|
| 95 |
+
- User: "endpoints बताओ"
|
| 96 |
+
You: "/system/status, /system/task, /reset, /chat, / - ये सभी endpoints हैं"
|
|
|
|
| 97 |
""",
|
| 98 |
|
| 99 |
'english': f"""
|
|
|
|
| 101 |
EXAMPLES:
|
| 102 |
- User: "hello, give code"
|
| 103 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 104 |
+
- User: "check system orchestrator status"
|
| 105 |
+
You: "Use /system/status endpoint to check AumCoreMaster orchestrator"
|
| 106 |
- User: "how are you"
|
| 107 |
You: "I'm good {username}!"
|
| 108 |
+
- User: "list endpoints"
|
| 109 |
+
You: "Endpoints: /system/status, /system/task, /reset, /chat, /"
|
|
|
|
| 110 |
""",
|
| 111 |
|
| 112 |
'mixed': f"""
|
|
|
|
| 114 |
EXAMPLES:
|
| 115 |
- User: "hi bhai, code de"
|
| 116 |
You: ```python\\nfrom google.colab import drive\\ndrive.mount('/content/gdrive')\\n```
|
| 117 |
+
- User: "system ki status bata"
|
| 118 |
+
You: "/system/status endpoint se system orchestrator ki status check karo"
|
| 119 |
- User: "are yaar, kya haal hai"
|
| 120 |
You: "Sab badhiya hai {username} bhai!"
|
| 121 |
+
- User: "endpoints batana"
|
| 122 |
+
You: "Endpoints hai: /system/status, /system/task, /reset, /chat, /"
|
|
|
|
| 123 |
"""
|
| 124 |
}
|
| 125 |
|
| 126 |
+
# COMBINE EVERYTHING
|
| 127 |
full_prompt = f"""{core_rules}
|
| 128 |
|
| 129 |
{styles.get(lang_mode, styles['mixed'])}
|
|
|
|
| 131 |
FINAL REMINDER:
|
| 132 |
- You are {username}'s helpful AI assistant
|
| 133 |
- FOR CODE: ALWAYS use ```python\\ncode\\n``` format
|
| 134 |
+
- KNOW YOUR SYSTEM: AumCore-AI with specific endpoints
|
| 135 |
+
- When asked about system, REFER to /system/status and /system/task
|
| 136 |
"""
|
| 137 |
|
| 138 |
return full_prompt.strip()
|