feat: 植物识别百科ai助手迁移

This commit is contained in:
Blizzard
2026-05-24 01:41:22 +08:00
parent ae6d03d351
commit 076ed1509b
29 changed files with 1121 additions and 372 deletions
+12 -2
View File
@@ -573,7 +573,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
{Method: http.MethodPost, Path: "/update", Handler: myPlant.UpdatePlantHandler(serverCtx)},
{Method: http.MethodPost, Path: "/deletePlant", Handler: myPlant.DeletePlantHandler(serverCtx)},
{Method: http.MethodPost, Path: "/deletePlan", Handler: myPlant.DeleteCarePlanHandler(serverCtx)},
{Method: http.MethodPost, Path: "/plan/add", Handler: myPlant.AddCarePlanHandler(serverCtx)},
{Method: http.MethodPost, Path: "/plan/add", Handler: legacy.AddCarePlanHandler(serverCtx)},
{Method: http.MethodGet, Path: "/plan/delete", Handler: legacy.DeletePlanHandler(serverCtx)},
{Method: http.MethodGet, Path: "/todayTask", Handler: myPlant.GetTodayTaskListHandler(serverCtx)},
{Method: http.MethodPost, Path: "/completeTask", Handler: complete.CompleteTaskHandler(serverCtx)},
@@ -604,7 +604,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
{Method: http.MethodPost, Path: "/topic/page", Handler: topic.GetTopicListHandler(serverCtx)},
{Method: http.MethodGet, Path: "/topic/detail", Handler: legacy.TopicDetailHandler(serverCtx)},
{Method: http.MethodPost, Path: "/classify/plant", Handler: ocr.OcrClassifyHandler(serverCtx)},
{Method: http.MethodPost, Path: "/classify/myClassifyLog", Handler: ocr.GetMyClassifyLogHandler(serverCtx)},
{Method: http.MethodPost, Path: "/classify/deleteClassifyLog", Handler: ocr.DeleteClassifyLogHandler(serverCtx)},
@@ -626,4 +625,15 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/plant"),
)
// SSE 流式问答 & 百度 OCR 识别:需要禁用 go-zero 默认超时(TimeoutHandler 会中断长连接)
server.AddRoutes(
[]rest.Route{
{Method: http.MethodGet, Path: "/chat/stream", Handler: legacy.AiChatStreamHandler(serverCtx)},
{Method: http.MethodPost, Path: "/classify/plant", Handler: legacy.ClassifyPlantHandler(serverCtx)},
},
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/plant"),
rest.WithTimeout(0),
)
}