v2.0.0 - Validation Étape 1 et configuration des fournisseurs
Build and Push Docker Image / build-and-push (push) Failing after 27s
Build and Push Docker Image / build-and-push (push) Failing after 27s
This commit is contained in:
1 parent
1e7b07452b
commit
42aaf4a629
8 files changed
+213
-686
No files matched your search
@@ -0,0 +1,5 @@
|
||||
FROM python:3.13-slim
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5001", "--reload"]
|
||||
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
# Détecte le dossier parent (racine du projet) dynamiquement
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
SESSIONS_DIR = os.path.join(BASE_DIR, "sessions")
|
||||
CONFIG_FILE = os.path.join(SESSIONS_DIR, "app_config.json")
|
||||
|
||||
def load_config():
|
||||
os.makedirs(SESSIONS_DIR, exist_ok=True)
|
||||
if not os.path.exists(CONFIG_FILE):
|
||||
default_config = {
|
||||
"api_keys": {"openrouter": "", "groq": "", "gemini": ""},
|
||||
"smtp": {"host": "", "port": 587, "user": "", "password": ""},
|
||||
"custom_providers": []
|
||||
}
|
||||
save_config(default_config)
|
||||
return default_config
|
||||
with open(CONFIG_FILE, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
def save_config(config_data):
|
||||
os.makedirs(SESSIONS_DIR, exist_ok=True)
|
||||
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
||||
json.dump(config_data, f, indent=4, ensure_ascii=False)
|
||||
@@ -0,0 +1,28 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.responses import HTMLResponse
|
||||
import os
|
||||
import config
|
||||
|
||||
app = FastAPI(title="AETHAS38 API")
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
FRONTEND_DIR = os.path.join(BASE_DIR, "frontend")
|
||||
|
||||
# Montage dynamique
|
||||
app.mount("/static", StaticFiles(directory=FRONTEND_DIR), name="static")
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def serve_admin():
|
||||
index_path = os.path.join(FRONTEND_DIR, "index.html")
|
||||
with open(index_path, "r", encoding="utf-8") as f:
|
||||
return f.read()
|
||||
|
||||
@app.get("/api/config")
|
||||
async def get_config():
|
||||
return config.load_config()
|
||||
|
||||
@app.post("/api/config")
|
||||
async def update_config(data: dict):
|
||||
config.save_config(data)
|
||||
return {"status": "success", "message": "Configuration sauvegardée avec succès."}
|
||||
@@ -0,0 +1,11 @@
|
||||
python-fasthtml
|
||||
requests
|
||||
python-dotenv
|
||||
pyotp
|
||||
qrcode
|
||||
psutil
|
||||
openpyxl
|
||||
fastapi
|
||||
uvicorn
|
||||
pydantic
|
||||
python-dotenv
|
||||
Reference in new issue
Block a user