后端新增《蚕茧识别V2》模块
This commit is contained in:
+7
-4
@@ -4,6 +4,7 @@ from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from uvicorn import Config, Server
|
||||
|
||||
from config.yolo import YOLOSingleton
|
||||
from mcp_local.mcp_pipe import init_mcp_server
|
||||
from routers.Bot import botRouter
|
||||
from routers.Chat import chatRouter
|
||||
@@ -21,7 +22,7 @@ async def ai_lab():
|
||||
app = FastAPI(title="BBIT_AI")
|
||||
|
||||
origins = [
|
||||
"http://localhost:8090", # Vite dev 默认端口
|
||||
"http://localhost:8091", # Vite dev 默认端口
|
||||
"https://ai.ronsunny.cn:8090",
|
||||
"*", # ⚠️ 生产环境不要用
|
||||
]
|
||||
@@ -40,11 +41,11 @@ async def ai_lab():
|
||||
reportDataRouter,
|
||||
serviceRouter,
|
||||
botRouter,
|
||||
visionRouter,
|
||||
rqRouter,
|
||||
]
|
||||
for r in routers:
|
||||
app.include_router(r, prefix="/llm", tags=["llm"])
|
||||
app.include_router(visionRouter, prefix="/cv", tags=["cv"])
|
||||
app.include_router(publicRouter, prefix="/api/public", tags=["api"])
|
||||
config = Config(app=app, host="0.0.0.0", port=13011, log_level="info")
|
||||
server = Server(config)
|
||||
@@ -52,12 +53,14 @@ async def ai_lab():
|
||||
|
||||
|
||||
async def main():
|
||||
# 初始化模型
|
||||
YOLOSingleton.init_model()
|
||||
# 主干AI实验室FastAPI服务
|
||||
task_api = asyncio.create_task(ai_lab())
|
||||
|
||||
# MCP服务-ailab
|
||||
# endpoint_url = "wss://ai.ronsunny.cn:8090/aimcp/mcp_endpoint/mcp/?token=TsSP9lBq6Oa1WMkachHoS2TtNt4GKV/Gli24pk5Rjpk%3D"
|
||||
endpoint_url_ai_lab = "ws://ce_bot_mcp:8004/mcp_endpoint/mcp/?token=TsSP9lBq6Oa1WMkachHoS2TtNt4GKV/Gli24pk5Rjpk%3D"
|
||||
endpoint_url_ai_lab = "wss://ai.ronsunny.cn:8090/aimcp/mcp_endpoint/mcp/?token=TsSP9lBq6Oa1WMkachHoS2TtNt4GKV/Gli24pk5Rjpk%3D"
|
||||
# endpoint_url_ai_lab = "ws://ce_bot_mcp:8004/mcp_endpoint/mcp/?token=TsSP9lBq6Oa1WMkachHoS2TtNt4GKV/Gli24pk5Rjpk%3D"
|
||||
task_mcp1 = asyncio.create_task(init_mcp_server(endpoint_url_ai_lab))
|
||||
|
||||
# MCP服务-ql
|
||||
|
||||
Reference in New Issue
Block a user