Commit a30701ae authored by Kantz's avatar Kantz
Browse files

gegenrichtung auch angepasst

parent 20d236c1
......@@ -48,6 +48,12 @@ def get_mathpix_settings() -> MathpixSettings:
app_key=os.getenv("MATHPIX_APP_KEY")
)
def get_frontend_url() -> str:
url = os.getenv("FRONTEND_URL")
if not url:
raise ValueError("Missing FRONTEND_URL")
return url
def get_ollama_settings() -> OllamaSettings:
return OllamaSettings(
base_url=os.getenv("OLLAMA_URL", "http://localhost:11434"),
......
......@@ -3,6 +3,8 @@ from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api import canvas, chat, health, retrieval
from app.config import get_frontend_url
@asynccontextmanager
async def lifespan(_app: FastAPI):
......@@ -14,7 +16,7 @@ app = FastAPI(title="Math Tutor API", version="0.1.0", lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173"],
allow_origins=["http://localhost:5173", get_frontend_url()],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment