Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,22 @@ if os.path.exists(ZIP_PATH) and not os.path.exists(EXTRACT_DIR):
|
|
| 17 |
# --- 2️⃣ Ajouter le dossier MCP au PYTHONPATH ---
|
| 18 |
sys.path.append(EXTRACT_DIR)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# --- 3️⃣ Importer FastMCP instance ---
|
| 21 |
try:
|
| 22 |
from main import get_mcp_instance
|
|
|
|
| 17 |
# --- 2️⃣ Ajouter le dossier MCP au PYTHONPATH ---
|
| 18 |
sys.path.append(EXTRACT_DIR)
|
| 19 |
|
| 20 |
+
# Patch rapide pour corriger les f-strings avec strftime
|
| 21 |
+
main_path = "app/MistralHackathonMCP/main.py"
|
| 22 |
+
if os.path.exists(main_path):
|
| 23 |
+
with open(main_path, "r", encoding="utf-8") as f:
|
| 24 |
+
lines = f.readlines()
|
| 25 |
+
|
| 26 |
+
fixed_lines = []
|
| 27 |
+
for line in lines:
|
| 28 |
+
# Remplace f"[{current_time.strftime("%Y-%m-%d %H:%M:%S")}] ..." par f"[{current_time.strftime('%Y-%m-%d %H:%M:%S')}] ..."
|
| 29 |
+
fixed_lines.append(line.replace('strftime("%Y-%m-%d %H:%M:%S")', "strftime('%Y-%m-%d %H:%M:%S')"))
|
| 30 |
+
|
| 31 |
+
with open(main_path, "w", encoding="utf-8") as f:
|
| 32 |
+
f.writelines(fixed_lines)
|
| 33 |
+
|
| 34 |
+
print("✅ Patch f-strings strftime appliqué sur main.py")
|
| 35 |
+
|
| 36 |
# --- 3️⃣ Importer FastMCP instance ---
|
| 37 |
try:
|
| 38 |
from main import get_mcp_instance
|