feat: 添加搜索功能 (#16)
- 新增 SearchFeeds 服务方法,支持关键词搜索小红书内容 - 添加 search_feeds MCP 工具,提供搜索接口 - 新增 /api/v1/feeds/search API 端点 - 实现搜索页面的浏览器自动化操作 - 优化 MCP 协议支持,处理 notifications/initialized 和 notifications/cancelled 通知 - 更新文档,添加搜索功能说明和使用示例 - 重构类型定义,优化数据结构 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -82,6 +82,27 @@ func (s *AppServer) listFeedsHandler(c *gin.Context) {
|
||||
respondSuccess(c, result, "获取Feeds列表成功")
|
||||
}
|
||||
|
||||
// searchFeedsHandler 搜索Feeds
|
||||
func (s *AppServer) searchFeedsHandler(c *gin.Context) {
|
||||
keyword := c.Query("keyword")
|
||||
if keyword == "" {
|
||||
respondError(c, http.StatusBadRequest, "MISSING_KEYWORD",
|
||||
"缺少关键词参数", "keyword parameter is required")
|
||||
return
|
||||
}
|
||||
|
||||
// 搜索 Feeds
|
||||
result, err := s.xiaohongshuService.SearchFeeds(c.Request.Context(), keyword)
|
||||
if err != nil {
|
||||
respondError(c, http.StatusInternalServerError, "SEARCH_FEEDS_FAILED",
|
||||
"搜索Feeds失败", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.Set("account", "ai-report")
|
||||
respondSuccess(c, result, "搜索Feeds成功")
|
||||
}
|
||||
|
||||
// healthHandler 健康检查
|
||||
func healthHandler(c *gin.Context) {
|
||||
respondSuccess(c, map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user