Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# app.py (V14.
|
| 2 |
import os
|
| 3 |
import sys
|
| 4 |
import traceback
|
|
@@ -57,7 +57,7 @@ async def initialize_system():
|
|
| 57 |
if sys_state.ready:
|
| 58 |
return
|
| 59 |
|
| 60 |
-
print("\n๐ [System V14.
|
| 61 |
|
| 62 |
try:
|
| 63 |
# 1. ุงูุจููุฉ ุงูุชุญุชูุฉ ูุงูุจูุงูุงุช (Infrastructure Layer)
|
|
@@ -318,8 +318,17 @@ async def _run_explorer_mode_full():
|
|
| 318 |
# LAYER 3: Omniscient Brain Validation (LLM)
|
| 319 |
# ----------------------------------------------------------------------
|
| 320 |
print("\n--- ๐ง Layer 3: Omniscient Brain Validation ---")
|
| 321 |
-
approved_targets = []
|
| 322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
for cand in layer3_input_candidates:
|
| 324 |
symbol = cand['symbol']
|
| 325 |
print(f" โ๏ธ Submitting {symbol} to Omniscient Brain for final verdict...")
|
|
@@ -327,7 +336,12 @@ async def _run_explorer_mode_full():
|
|
| 327 |
decision = await llm_service.get_trading_decision(cand)
|
| 328 |
|
| 329 |
if decision and decision.get('action') == 'WATCH':
|
| 330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
print(f" ๐ BRAIN APPROVED: {symbol} | Confidence: {confidence:.2f}")
|
| 332 |
cand['llm_decision'] = decision
|
| 333 |
approved_targets.append(cand)
|
|
@@ -359,7 +373,7 @@ async def lifespan(app: FastAPI):
|
|
| 359 |
if data_manager: await data_manager.close()
|
| 360 |
print("๐ [System] Shutdown complete.")
|
| 361 |
|
| 362 |
-
app = FastAPI(lifespan=lifespan, title="Titan Hybrid System V14.
|
| 363 |
|
| 364 |
@app.get("/")
|
| 365 |
async def root():
|
|
|
|
| 1 |
+
# app.py (V14.3 - Production Fix & Enhanced Logging)
|
| 2 |
import os
|
| 3 |
import sys
|
| 4 |
import traceback
|
|
|
|
| 57 |
if sys_state.ready:
|
| 58 |
return
|
| 59 |
|
| 60 |
+
print("\n๐ [System V14.3] Starting Full Initialization Sequence...")
|
| 61 |
|
| 62 |
try:
|
| 63 |
# 1. ุงูุจููุฉ ุงูุชุญุชูุฉ ูุงูุจูุงูุงุช (Infrastructure Layer)
|
|
|
|
| 318 |
# LAYER 3: Omniscient Brain Validation (LLM)
|
| 319 |
# ----------------------------------------------------------------------
|
| 320 |
print("\n--- ๐ง Layer 3: Omniscient Brain Validation ---")
|
|
|
|
| 321 |
|
| 322 |
+
# ๐ [ุฌุฏูุฏ] ุทุจุงุนุฉ ูุงุฆู
ุฉ ุงูู
ุชุฃูููู ููุฏู
ุงุบ ูุจู ุงูุฅุฑุณุงู
|
| 323 |
+
if layer3_input_candidates:
|
| 324 |
+
print("๐ [L3 Qualification] The following candidates are advancing to Omniscient Brain:")
|
| 325 |
+
for i, cand in enumerate(layer3_input_candidates, 1):
|
| 326 |
+
l1 = cand.get('enhanced_final_score', 0)
|
| 327 |
+
l2 = cand.get('layer2_score', 0)
|
| 328 |
+
print(f" #{i} {cand['symbol']:<10} | L1: {l1:.3f} -> L2 Enhanced: {l2:.3f}")
|
| 329 |
+
print("-" * 50)
|
| 330 |
+
|
| 331 |
+
approved_targets = []
|
| 332 |
for cand in layer3_input_candidates:
|
| 333 |
symbol = cand['symbol']
|
| 334 |
print(f" โ๏ธ Submitting {symbol} to Omniscient Brain for final verdict...")
|
|
|
|
| 336 |
decision = await llm_service.get_trading_decision(cand)
|
| 337 |
|
| 338 |
if decision and decision.get('action') == 'WATCH':
|
| 339 |
+
# ๐ก๏ธ [FIX] ุชุญููู ุขู
ู ูู
ุณุชูู ุงูุซูุฉ ูู
ูุน ุงูููุงุฑ ุงูุชูุณูู
|
| 340 |
+
try:
|
| 341 |
+
confidence = float(decision.get('confidence_level', 0.0))
|
| 342 |
+
except (ValueError, TypeError):
|
| 343 |
+
confidence = 0.0
|
| 344 |
+
|
| 345 |
print(f" ๐ BRAIN APPROVED: {symbol} | Confidence: {confidence:.2f}")
|
| 346 |
cand['llm_decision'] = decision
|
| 347 |
approved_targets.append(cand)
|
|
|
|
| 373 |
if data_manager: await data_manager.close()
|
| 374 |
print("๐ [System] Shutdown complete.")
|
| 375 |
|
| 376 |
+
app = FastAPI(lifespan=lifespan, title="Titan Hybrid System V14.3 (Production Fixes)")
|
| 377 |
|
| 378 |
@app.get("/")
|
| 379 |
async def root():
|