Spaces:
Paused
Paused
Update LLM.py
Browse files
LLM.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# LLM.py (V18.
|
| 2 |
import os, traceback, json, time, re
|
| 3 |
import httpx
|
| 4 |
from datetime import datetime
|
|
@@ -229,7 +229,10 @@ class LLMService:
|
|
| 229 |
current_data['latest_news_score'] = latest_news_score
|
| 230 |
|
| 231 |
# 3. إنشاء الـ Prompt (باللغة الإنجليزية)
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
# (اختياري: حفظ الـ Prompt للتدقيق)
|
| 235 |
if self.r2_service:
|
|
@@ -369,11 +372,13 @@ OUTPUT (JSON Object ONLY):
|
|
| 369 |
|
| 370 |
return "\n".join(prompt_sections)
|
| 371 |
|
| 372 |
-
|
| 373 |
-
|
|
|
|
| 374 |
trade_data: Dict[str, Any],
|
| 375 |
current_data: Dict[str, Any],
|
| 376 |
learning_context: str) -> str:
|
|
|
|
| 377 |
"""
|
| 378 |
(معدل V8.1)
|
| 379 |
إنشاء الـ Prompt (باللغة الإنجليزية) لإعادة تحليل صفقة مفتوحة (Reflector Brain).
|
|
@@ -402,7 +407,10 @@ OUTPUT (JSON Object ONLY):
|
|
| 402 |
# --- 4. (العقل) بيانات التعلم الإحصائي ---
|
| 403 |
statistical_feedback = ""
|
| 404 |
if self.learning_hub:
|
|
|
|
|
|
|
| 405 |
statistical_feedback = await self.learning_hub.get_statistical_feedback_for_llm(original_strategy)
|
|
|
|
| 406 |
|
| 407 |
# --- 5. بناء أقسام الـ Prompt (الإنجليزية) ---
|
| 408 |
|
|
|
|
| 1 |
+
# LLM.py (V18.2 - Async Fix)
|
| 2 |
import os, traceback, json, time, re
|
| 3 |
import httpx
|
| 4 |
from datetime import datetime
|
|
|
|
| 229 |
current_data['latest_news_score'] = latest_news_score
|
| 230 |
|
| 231 |
# 3. إنشاء الـ Prompt (باللغة الإنجليزية)
|
| 232 |
+
# 🔴 --- START OF CHANGE (V18.2 - Async Fix) --- 🔴
|
| 233 |
+
# (يجب استخدام await لأن الدالة أصبحت async)
|
| 234 |
+
prompt = await self._create_reanalysis_prompt(trade_data, current_data, learning_context_prompt)
|
| 235 |
+
# 🔴 --- END OF CHANGE --- 🔴
|
| 236 |
|
| 237 |
# (اختياري: حفظ الـ Prompt للتدقيق)
|
| 238 |
if self.r2_service:
|
|
|
|
| 372 |
|
| 373 |
return "\n".join(prompt_sections)
|
| 374 |
|
| 375 |
+
# 🔴 --- START OF CHANGE (V18.2 - Async Fix) --- 🔴
|
| 376 |
+
# (يجب أن تكون الدالة async)
|
| 377 |
+
async def _create_reanalysis_prompt(self,
|
| 378 |
trade_data: Dict[str, Any],
|
| 379 |
current_data: Dict[str, Any],
|
| 380 |
learning_context: str) -> str:
|
| 381 |
+
# 🔴 --- END OF CHANGE --- 🔴
|
| 382 |
"""
|
| 383 |
(معدل V8.1)
|
| 384 |
إنشاء الـ Prompt (باللغة الإنجليزية) لإعادة تحليل صفقة مفتوحة (Reflector Brain).
|
|
|
|
| 407 |
# --- 4. (العقل) بيانات التعلم الإحصائي ---
|
| 408 |
statistical_feedback = ""
|
| 409 |
if self.learning_hub:
|
| 410 |
+
# 🔴 --- START OF CHANGE (V18.2 - Async Fix) --- 🔴
|
| 411 |
+
# (هذا هو السطر الذي تسبب بالخطأ - يجب استخدام await)
|
| 412 |
statistical_feedback = await self.learning_hub.get_statistical_feedback_for_llm(original_strategy)
|
| 413 |
+
# 🔴 --- END OF CHANGE --- 🔴
|
| 414 |
|
| 415 |
# --- 5. بناء أقسام الـ Prompt (الإنجليزية) ---
|
| 416 |
|