fix:fix
This commit is contained in:
@@ -8,10 +8,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/xpzouying/xiaohongshu-mcp/cookies"
|
||||
"github.com/xpzouying/xiaohongshu-mcp/xiaohongshu"
|
||||
@@ -401,67 +397,7 @@ func (s *AppServer) handleGetFeedDetail(ctx context.Context, args map[string]any
|
||||
}
|
||||
|
||||
logrus.Infof("MCP: 获取Feed详情 - Feed ID: %s, loadAllComments=%v, config=%+v", feedID, loadAll, config)
|
||||
loadAll := false
|
||||
if raw, ok := args["load_all_comments"]; ok {
|
||||
switch v := raw.(type) {
|
||||
case bool:
|
||||
loadAll = v
|
||||
case string:
|
||||
if parsed, err := strconv.ParseBool(v); err == nil {
|
||||
loadAll = parsed
|
||||
}
|
||||
case float64:
|
||||
loadAll = v != 0
|
||||
}
|
||||
}
|
||||
|
||||
// 解析评论配置参数,如果未提供则使用默认值
|
||||
config := xiaohongshu.DefaultCommentLoadConfig()
|
||||
|
||||
if raw, ok := args["click_more_replies"]; ok {
|
||||
switch v := raw.(type) {
|
||||
case bool:
|
||||
config.ClickMoreReplies = v
|
||||
case string:
|
||||
if parsed, err := strconv.ParseBool(v); err == nil {
|
||||
config.ClickMoreReplies = parsed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if raw, ok := args["max_replies_threshold"]; ok {
|
||||
switch v := raw.(type) {
|
||||
case float64:
|
||||
config.MaxRepliesThreshold = int(v)
|
||||
case string:
|
||||
if parsed, err := strconv.Atoi(v); err == nil {
|
||||
config.MaxRepliesThreshold = parsed
|
||||
}
|
||||
case int:
|
||||
config.MaxRepliesThreshold = v
|
||||
}
|
||||
}
|
||||
|
||||
if raw, ok := args["max_comment_items"]; ok {
|
||||
switch v := raw.(type) {
|
||||
case float64:
|
||||
config.MaxCommentItems = int(v)
|
||||
case string:
|
||||
if parsed, err := strconv.Atoi(v); err == nil {
|
||||
config.MaxCommentItems = parsed
|
||||
}
|
||||
case int:
|
||||
config.MaxCommentItems = v
|
||||
}
|
||||
}
|
||||
|
||||
if raw, ok := args["scroll_speed"].(string); ok && raw != "" {
|
||||
config.ScrollSpeed = raw
|
||||
}
|
||||
|
||||
logrus.Infof("MCP: 获取Feed详情 - Feed ID: %s, loadAllComments=%v, config=%+v", feedID, loadAll, config)
|
||||
|
||||
result, err := s.xiaohongshuService.GetFeedDetailWithConfig(ctx, feedID, xsecToken, loadAll, config)
|
||||
result, err := s.xiaohongshuService.GetFeedDetailWithConfig(ctx, feedID, xsecToken, loadAll, config)
|
||||
if err != nil {
|
||||
return &MCPToolResult{
|
||||
|
||||
Reference in New Issue
Block a user