source/main.py aktualisiert
This commit is contained in:
@@ -22,6 +22,8 @@ from fastapi.responses import RedirectResponse
|
|||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
from dotenv import load_dotenv, set_key
|
from dotenv import load_dotenv, set_key
|
||||||
|
from fastapi.middleware.trustedhost import TrustedHostMiddleware
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
# Basis-Verzeichnis (source/)
|
# Basis-Verzeichnis (source/)
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -818,6 +820,19 @@ async def get_models(provider: str, url: str = None):
|
|||||||
print(f"Fehler beim Abrufen der Modelle für {provider}: {str(e)}")
|
print(f"Fehler beim Abrufen der Modelle für {provider}: {str(e)}")
|
||||||
return {"models": []} # Gibt eine leere Liste zurück -> Frontend nutzt Fallback
|
return {"models": []} # Gibt eine leere Liste zurück -> Frontend nutzt Fallback
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
TrustedHostMiddleware,
|
||||||
|
allowed_hosts=["jarvis.pi-farm.de", "192.168.178.13", "localhost"]
|
||||||
|
)
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"],
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
@app.get("/debug_keys")
|
@app.get("/debug_keys")
|
||||||
async def debug_keys():
|
async def debug_keys():
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user