新增评论通知功能:MCP工具 + REST端点 + 前端通知面板

- 新增 xhs_get_comment_notifications / xhs_reply_notification MCP工具
- 通知获取前先读取首页未读小红点数字,无未读则直接返回空,避免重复处理
- 新增 REST 端点 GET /notifications/comments 和 POST /notifications/reply
- 前端小红书页面新增「通知」按钮和 NotificationPanel slide-over 组件
- 通知面板支持查看评论通知列表和行内回复
This commit is contained in:
2026-03-02 18:46:52 +08:00
parent 54a3d9708a
commit 64dbc45265
11 changed files with 637 additions and 0 deletions
+15
View File
@@ -11,6 +11,7 @@ import type {
ApiResponse,
PublishResult,
CommentResult,
CommentNotification,
} from './types';
// Health (no auth required)
@@ -112,6 +113,20 @@ export const replyComment = (data: {
body: JSON.stringify(data),
});
// Notifications
export const getCommentNotifications = (maxCount = 20) =>
apiFetch<ApiResponse<CommentNotification[]>>(`/api/xhs/notifications/comments?max_count=${maxCount}`);
export const replyNotification = (data: {
user_id: string;
comment_content: string;
reply_content: string;
}) =>
apiFetch<ApiResponse<CommentResult>>('/api/xhs/notifications/reply', {
method: 'POST',
body: JSON.stringify(data),
});
export const toggleLike = (feedId: string, xsecToken: string) =>
apiFetch<ApiResponse<{ success: boolean; liked: boolean }>>('/api/xhs/like', {
method: 'POST',
+12
View File
@@ -77,6 +77,18 @@ export interface UserProfile {
feeds: Feed[];
}
export interface CommentNotification {
userId: string;
nickname: string;
avatar: string;
content: string;
type: string;
time: string;
feedId: string;
xsecToken: string;
noteImage: string;
}
export interface SearchFilters {
sort?: 'general' | 'time_descending' | 'popularity_descending';
type?: 'all' | 'note' | 'video';