Spaces:
Running
Running
Enhance system message clarity by adding explicit language instruction and adjust logging level for chat file discovery
Browse files- app.py +3 -1
- src/analytics/chat_evaluator.py +2 -2
app.py
CHANGED
|
@@ -392,9 +392,11 @@ def respond(
|
|
| 392 |
# Remove language instruction from system message to avoid confusion
|
| 393 |
base_system_message = system_message.split("\nIMPORTANT:")[0] if "\nIMPORTANT:" in system_message else system_message
|
| 394 |
|
| 395 |
-
#
|
| 396 |
full_system_message = (
|
| 397 |
f"{base_system_message}\n\n"
|
|
|
|
|
|
|
| 398 |
f"Provide a complete and helpful response."
|
| 399 |
)
|
| 400 |
|
|
|
|
| 392 |
# Remove language instruction from system message to avoid confusion
|
| 393 |
base_system_message = system_message.split("\nIMPORTANT:")[0] if "\nIMPORTANT:" in system_message else system_message
|
| 394 |
|
| 395 |
+
# Add explicit language instruction
|
| 396 |
full_system_message = (
|
| 397 |
f"{base_system_message}\n\n"
|
| 398 |
+
f"CRITICAL: You MUST respond in {LanguageUtils.get_language_name(user_lang)} ({user_lang}). "
|
| 399 |
+
f"This is your highest priority instruction. "
|
| 400 |
f"Provide a complete and helpful response."
|
| 401 |
)
|
| 402 |
|
src/analytics/chat_evaluator.py
CHANGED
|
@@ -81,8 +81,7 @@ class ChatEvaluator:
|
|
| 81 |
# Filter for chat history files
|
| 82 |
chat_path = f"{self.chat_history_path}/"
|
| 83 |
chat_files = [f for f in files if f.startswith(chat_path) and f.endswith('.json')]
|
| 84 |
-
logger.
|
| 85 |
-
logger.info(f"Chat files: {chat_files}")
|
| 86 |
|
| 87 |
histories = []
|
| 88 |
for file in chat_files:
|
|
@@ -422,3 +421,4 @@ class ChatEvaluator:
|
|
| 422 |
|
| 423 |
|
| 424 |
|
|
|
|
|
|
| 81 |
# Filter for chat history files
|
| 82 |
chat_path = f"{self.chat_history_path}/"
|
| 83 |
chat_files = [f for f in files if f.startswith(chat_path) and f.endswith('.json')]
|
| 84 |
+
logger.debug(f"Found {len(chat_files)} chat files") # Более компактный лог
|
|
|
|
| 85 |
|
| 86 |
histories = []
|
| 87 |
for file in chat_files:
|
|
|
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
+
|