Files
sweet-hut-agent/main.py
2026-07-02 22:17:33 +08:00

26 lines
599 B
Python

from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import StreamingResponse
from modes.agent import QueryRequest
from services import query_bill_agent
app = FastAPI(title="Integrate Agent API")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.post("/query/bill")
async def query_agent(query: QueryRequest):
"""流式对话"""
return StreamingResponse(
query_bill_agent(query),
media_type="text/event-stream"
)