feat:更新智能体架构

This commit is contained in:
2026-07-02 22:17:33 +08:00
parent c66d3a871e
commit 20e45d5c8b
21 changed files with 270 additions and 218 deletions

25
main.py
View File

@@ -1,22 +1,25 @@
from dotenv import load_dotenv
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from router import router
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import StreamingResponse
# 初始化FastAPI
app = FastAPI(
title="Sweet Hut Agent",
description="智能体",
version="0.1.0"
)
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=["*"],
)
load_dotenv()
app.include_router(router)
@app.post("/query/bill")
async def query_agent(query: QueryRequest):
"""流式对话"""
return StreamingResponse(
query_bill_agent(query),
media_type="text/event-stream"
)