first commit
This commit is contained in:
30
main.py
Normal file
30
main.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from src.routers import chat
|
||||
|
||||
app_server = FastAPI(
|
||||
title="Gemini Furniture Designer API",
|
||||
description="基于 LangGraph + Gemini 2.0 Flash 的家具设计 Agent 接口",
|
||||
version="1.0.0"
|
||||
)
|
||||
|
||||
# 配置跨域,方便前端调用
|
||||
app_server.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# 包含路由
|
||||
app_server.include_router(chat.router)
|
||||
|
||||
|
||||
@app_server.get("/")
|
||||
async def root():
|
||||
return {"message": "Furniture Design Agent API is running."}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run("main:app_server", host="0.0.0.0", port=7777, reload=True)
|
||||
Reference in New Issue
Block a user