File size: 858 Bytes
0e365b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

# Router importu
from app.routes import chat   # <--- chat.py dosyan buradan geliyor

app = FastAPI(
    title="AI Memory Graph",
    version="0.1.0",
    description="Triplet extraction, graph, query & QA"
)

# CORS (UI veya farklı origin’den çağrı için)
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # ilk aşamada geniş bırak
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# 🔗 Chat router'ını ekle
app.include_router(chat.router, prefix="", tags=["memory-graph"])

# ✅ Root path: GET + HEAD
@app.api_route("/", methods=["GET", "HEAD"])
def root():
    return {"status": "ok", "service": "ai-memory-graph"}

# Health endpoint (kontrol için)
@app.get("/healthz")
def healthz():
    return {"status": "ok"}