diff --git a/README.md b/README.md index d3797e5..b0d2546 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - **多 AI 角色** — 支持创建多个 AI 角色,每个角色有独立的昵称、人格提示词和 Gravatar 头像,可为不同文章指定不同角色 - **自动回复** — 监听新评论,自动调用 AI 生成回复,支持多轮对话上下文 - **多语言适配** — 根据评论语言自动用对应语言回复 -- **情感分析** — 分析评论情感倾向(正面/中性/负面),根据情感调整回复语气 +- **情感分析** — 分析评论情感倾向(非常正面/正面/中性/负面/非常负面),根据情感调整回复语气 - **草稿模式** — AI 回复先存为草稿,管理员审核后再发布,支持批量操作 - **失败重试** — AI 生成失败时自动重试,指数退避策略 - **对话轮次限制** — 同一评论线程中限制 AI 最多回复轮次,防止无限对话 @@ -67,65 +67,7 @@ pnpm dev ## 文档 -完整文档请访问 [AI回评文档站](https://nxxy335.top/comment-ai-autopilot) - -## 更新日志 - -### v1.0.0-beta.2 - -**改进** - -- 通过 Halo 官方推荐的 `ExtensionGetter` 获取 AI Foundation 的 `AiModelService`,替换原先的跨 ClassLoader 反射调用方式 -- 在 `plugin.yaml` 中声明可选插件依赖 `ai-foundation?: "*"`,建立正确的插件依赖关系 -- 新增 `store.halo.run/recommended-apps` 注解,安装后可在应用市场推荐安装 AI Foundation 插件 -- 情感分析和内容审核改用 AI Foundation 结构化输出(`OutputSpec.choice`),分类更可靠 -- AI 调用改用 `GenerateTextRequest` 并设置 `maxRetries=2`,由 SDK 自动重试瞬时错误 -- AI 对话续接时自动获取之前的回复历史并注入到 Prompt 中,AI 能更好地理解对话上下文 -- 优化 AI 自审核评分机制:改为两阶段评估(安全检查 + 质量评分 1-5 分),评分映射到 0-100 分,替代原先的二值评分 -- 精简仪表盘:移除情感分布、近7日回复趋势、平均审核评分三个卡片,快捷操作精简为回复日志、插件设置、刷新数据 -- 重做设置页面:基本设置、AI角色设置、模型设置、Prompt设置、数据清理各为独立页面,通过标签栏切换 -- 优化设置页面布局:按钮统一排版并添加图标,侧边栏新增"未保存"状态指示器 -- 优化日志页面:评分增加等级标签(优秀/良好/一般/较差),筛选下拉框修复文本与箭头重叠 -- 优化 AI Foundation 状态提示宽度,与内容区宽度一致 -- 优化插件文档:修复版本要求、变量名、链接等错误 - -**Bug 修复** - -- 修复 RateLimitService 清理线程在插件停止时未关闭导致线程泄漏 -- 修复内容审核提示词要求"重新生成"但代码未使用重新生成内容的问题 -- 修复设置页面按钮图标和文字未在同一行显示的问题 -- 修复设置页面标签栏无法点击切换的问题 -- 修复设置页面配置区域布局错误的问题 - -### v1.0.0-beta.1 - -**新功能** - -- 草稿模式:关闭"自动发布"后,AI 回复将保存为草稿,需站长审核后才发布 -- 多 AI 角色支持:支持配置多个 AI 虚拟角色,每个角色有独立的提示词、头像和模型 -- 提示词预设:内置多种回复风格预设(专业型、幽默型、简洁型等),可自由组合 -- 对话历史查看:支持查看 AI 回复的完整对话上下文 - -**Bug 修复** - -- 修复草稿模式下审批失败("AI回复已存在,无法重复发布")的问题 -- 修复批量审批时同样的去重检查冲突问题 -- 修复 AI Foundation 不可用的问题(`PluginManager` 无法通过 Spring 依赖注入获取) -- 修复 `DefaultSpringPlugin` 包级私有类反射访问权限问题 -- 修复 CI 构建失败(`gradlew` 缺少执行权限) - -**改进** - -- 审批逻辑优化:先查找已有 Reply 扩展再决定创建或更新 -- 移除不必要的 `AiFoundationConfiguration` 配置类 -- 前端 UI 优化:移除编辑功能、简化角色排序逻辑、清理无用代码 - -### v0.0.3 - -- 增强插件可靠性与可用性 -- 多 AI 角色支持 -- 草稿模式初步实现 -- 文档全面更新 +完整文档及更新日志请访问 [AI回评文档站](https://nxxy335.top/comment-ai-autopilot) ## 许可证 diff --git a/build.gradle b/build.gradle index 8b2297e..2336a4d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'top.nxxy335.commentaiautopilot' -version '1.0.0-beta.3' +version '1.0.0-b26cea' repositories { mavenCentral() diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index a49932f..f133ef3 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -41,13 +41,14 @@ export default defineConfig({ text: "其他", items: [ { text: "常见问题", link: "/guide/faq" }, + { text: "更新日志", link: "/CHANGELOG" }, ], }, ], socialLinks: [ { icon: "github", - link: "https://github.com/nxxy335/plugin-comment-ai-autopilot", + link: "https://github.com/sunny-335/plugin-comment-ai-autopilot", }, ], search: { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5be4415..e365980 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,24 @@ # 更新日志 +## v1.0.0-b26cea + +> 2026-06-18 + +### 改进 + +- **优化情感分析系统**:从 3 级分类(正面/中性/负面)升级为 5 级分类(非常正面/正面/中性/负面/非常负面),情感判断更精细 +- **优化日志页面 UI**:批量操作按钮重写样式,确保底色和白色文字清晰可见;搜索框添加搜索图标;重置按钮添加图标和底色 +- **优化评分显示**:评分数字与等级标签之间添加间距,等级标签增加底色背景(优秀/良好/一般/较差) +- **优化状态标签**:通过状态、发布状态、情感标签统一使用带底色的标签样式 +- **支持页面链接显示**:日志中新增独立页面(SinglePage)链接显示,之前仅支持文章链接 +- **ObjectMapper 统一注入**:FilterService 和 PromptBuilder 中的 `new ObjectMapper()` 改为 Spring 构造函数注入 +- **服务端过滤优化**:日志列表查询改用 `Queries.equal()` 服务端过滤 status/sentiment,减少内存过滤开销 +- **新增索引**:为 AiCommentReply 扩展添加 `spec.sentiment`、`spec.published`、`spec.postKind` 索引 +- **新增 postKind 字段**:区分关联内容类型(Post/SinglePage),支持页面评论的链接生成 +- **PromptBuilder 情感提示**:适配 5 级情感分类,新增 VERY_POSITIVE 和 VERY_NEGATIVE 的语气提示 + +--- + ## v1.0.0-beta.2 > 2026-06-17 diff --git a/docs/guide/introduction.md b/docs/guide/introduction.md index 9d87ee6..a6f6c45 100644 --- a/docs/guide/introduction.md +++ b/docs/guide/introduction.md @@ -7,7 +7,7 @@ AI回评(Comment AI Autopilot)是一个 Halo 博客系统的插件,能够 - **自动回复** — 监听新评论,自动调用AI生成回复,支持多轮对话上下文 - **多 AI 角色** — 支持创建多个 AI 角色,每个角色有独立的昵称、人格提示词和 Gravatar 头像,可为不同文章指定不同角色 - **多语言适配** — 根据评论语言自动用对应语言回复 -- **情感分析** — 分析评论情感倾向(正面/中性/负面),根据情感调整回复语气 +- **情感分析** — 分析评论情感倾向(非常正面/正面/中性/负面/非常负面),根据情感调整回复语气 - **草稿模式** — AI回复先存为草稿,管理员审核后再发布 - **失败重试** — AI生成失败时自动重试,指数退避策略 - **批量操作** — 草稿模式下支持批量通过/拒绝/删除 diff --git a/docs/guide/sentiment.md b/docs/guide/sentiment.md index d0d90a7..6645ba7 100644 --- a/docs/guide/sentiment.md +++ b/docs/guide/sentiment.md @@ -6,14 +6,16 @@ | 分类 | 说明 | AI回复语气 | |------|------|-----------| -| 正面 | 评论情绪积极、友好、感谢 | 热情友好,表达感谢和共鸣 | -| 中性 | 评论情绪平淡、普通提问 | 正常语气回复,不加额外提示 | -| 负面 | 评论情绪偏消极、不满、批评 | 理性温和,避免激化矛盾 | +| 非常正面 | 强烈的感谢、赞美、认同(如"太棒了"、"非常感谢") | 热情洋溢,表达真诚的感谢和共鸣 | +| 正面 | 友好、肯定、支持(如"不错"、"学习了") | 热情友好,表达感谢和共鸣 | +| 中性 | 提问、讨论、陈述事实(如"请问..."、"这个怎么用") | 正常语气回复,不加额外提示 | +| 负面 | 不满、质疑、批评(如"不好用"、"有问题") | 理性温和,避免激化矛盾 | +| 非常负面 | 攻击、辱骂、极端情绪(如"垃圾"、"骗子") | 非常温和理性,避免激化矛盾,展现理解和耐心 | ## 工作原理 1. 评论通过过滤检查后,调用AI对评论内容进行情感分析 -2. AI 使用结构化输出(`OutputSpec.choice`)返回情感分类结果(POSITIVE / NEUTRAL / NEGATIVE) +2. AI 使用结构化输出(`OutputSpec.choice`)返回情感分类结果(VERY_POSITIVE / POSITIVE / NEUTRAL / NEGATIVE / VERY_NEGATIVE) 3. 如果情感分析失败(如AI不可用),默认降级为 NEUTRAL 4. 情感结果传入 PromptBuilder,在生成Prompt时追加对应的语气提示 5. 情感结果同时记录在 `AiCommentReply` 的 `sentiment` 字段中 @@ -22,9 +24,11 @@ 在AI回复日志页面,每条记录会显示情感标签: -- 🟢 **正面** — 绿色标签 +- 🟢 **非常正面** — 深绿色标签 +- 🟩 **正面** — 浅绿色标签 - ⚪ **中性** — 灰色标签 -- 🔴 **负面** — 红色标签 +- 🟥 **负面** — 浅红色标签 +- 🔴 **非常负面** — 深红色标签 ## 性能影响 diff --git a/src/main/java/top/nxxy335/commentaiautopilot/CommentAiAutopilotPlugin.java b/src/main/java/top/nxxy335/commentaiautopilot/CommentAiAutopilotPlugin.java index f924091..469e763 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/CommentAiAutopilotPlugin.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/CommentAiAutopilotPlugin.java @@ -47,6 +47,8 @@ public class CommentAiAutopilotPlugin extends BasePlugin { .indexFunc(ext -> ext.getSpec().getSentiment())); indexSpecs.add(IndexSpecs.single("spec.published", String.class) .indexFunc(ext -> String.valueOf(ext.getSpec().getPublished()))); + indexSpecs.add(IndexSpecs.single("spec.postKind", String.class) + .indexFunc(ext -> ext.getSpec().getPostKind())); }); schemeManager.register(AiPersona.class); diff --git a/src/main/java/top/nxxy335/commentaiautopilot/extension/AiCommentReply.java b/src/main/java/top/nxxy335/commentaiautopilot/extension/AiCommentReply.java index d9cf6f2..b23c729 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/extension/AiCommentReply.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/extension/AiCommentReply.java @@ -33,6 +33,9 @@ public class AiCommentReply extends AbstractExtension { @Schema(description = "关联文章Slug,用于生成文章链接") private String postSlug; + @Schema(description = "关联内容类型: Post/SinglePage") + private String postKind; + @Schema(description = "AI回复内容") private String reply; diff --git a/src/main/java/top/nxxy335/commentaiautopilot/service/AiReplyOrchestrator.java b/src/main/java/top/nxxy335/commentaiautopilot/service/AiReplyOrchestrator.java index a3945ae..29b8fc6 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/service/AiReplyOrchestrator.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/service/AiReplyOrchestrator.java @@ -525,6 +525,7 @@ public class AiReplyOrchestrator { record.getSpec().setCommentId(context.commentId()); record.getSpec().setPostId(context.postId()); record.getSpec().setPostSlug(context.postSlug()); + record.getSpec().setPostKind(context.postKind()); record.getSpec().setReply(""); record.getSpec().setScore(0); record.getSpec().setStatus("PENDING"); diff --git a/src/main/java/top/nxxy335/commentaiautopilot/service/ContextExtractor.java b/src/main/java/top/nxxy335/commentaiautopilot/service/ContextExtractor.java index 82f5ba5..9fa8e67 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/service/ContextExtractor.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/service/ContextExtractor.java @@ -10,6 +10,7 @@ import run.halo.app.content.ContentWrapper; import run.halo.app.content.PostContentService; import run.halo.app.core.extension.content.Comment; import run.halo.app.core.extension.content.Post; +import run.halo.app.core.extension.content.SinglePage; import run.halo.app.core.extension.content.Reply; import run.halo.app.extension.ReactiveExtensionClient; @@ -113,7 +114,8 @@ public class ContextExtractor { isAiConversation, formatPostDate(post), commentCount, - "" + "", + "Post" )) ) ) @@ -129,7 +131,47 @@ public class ContextExtractor { isAiConversation, "", 0, - "" + "", + "Post" + )); + } + + if (subjectRef != null && "SinglePage".equals(subjectRef.getKind())) { + String postName = subjectRef.getName(); + return client.fetch(SinglePage.class, postName) + .flatMap(singlePage -> getPostContent(postName) + .flatMap(content -> getCommentCount(comment.getMetadata().getName()) + .map(commentCount -> new CommentContext( + comment.getMetadata().getName(), + postName, + singlePage.getSpec().getSlug(), + commentContent, + commentOwner, + singlePage.getSpec().getTitle(), + content, + null, + isAiConversation, + formatSinglePageDate(singlePage), + commentCount, + "", + "SinglePage" + )) + ) + ) + .defaultIfEmpty(new CommentContext( + comment.getMetadata().getName(), + postName, + "", + commentContent, + commentOwner, + "", + "", + null, + isAiConversation, + "", + 0, + "", + "SinglePage" )); } @@ -145,6 +187,7 @@ public class ContextExtractor { isAiConversation, "", 0, + "", "" )); } @@ -179,7 +222,8 @@ public class ContextExtractor { isAiConversation, formatPostDate(post), commentCount, - history + history, + "Post" )) ) ) @@ -196,7 +240,49 @@ public class ContextExtractor { isAiConversation, "", 0, - "" + "", + "Post" + )); + } + + if (subjectRef != null && "SinglePage".equals(subjectRef.getKind())) { + String postName = subjectRef.getName(); + return client.fetch(SinglePage.class, postName) + .flatMap(singlePage -> getPostContent(postName) + .flatMap(content -> getCommentCount(commentName) + .flatMap(commentCount -> historyMono + .map(history -> new CommentContext( + commentName, + postName, + singlePage.getSpec().getSlug(), + replyContent, + replyOwner, + singlePage.getSpec().getTitle(), + content, + replyName, + isAiConversation, + formatSinglePageDate(singlePage), + commentCount, + history, + "SinglePage" + )) + ) + ) + ) + .defaultIfEmpty(new CommentContext( + commentName, + postName, + "", + replyContent, + replyOwner, + "", + "", + replyName, + isAiConversation, + "", + 0, + "", + "SinglePage" )); } @@ -213,7 +299,8 @@ public class ContextExtractor { isAiConversation, "", 0, - history + history, + "" )); } @@ -290,6 +377,18 @@ public class ContextExtractor { return ""; } + private String formatSinglePageDate(SinglePage singlePage) { + var publishTime = singlePage.getSpec().getPublishTime(); + if (publishTime != null) { + return publishTime.toString().substring(0, 10); + } + var creationTimestamp = singlePage.getMetadata().getCreationTimestamp(); + if (creationTimestamp != null) { + return creationTimestamp.toString().substring(0, 10); + } + return ""; + } + private Mono getCommentCount(String commentName) { return client.list(Reply.class, reply -> commentName.equals(reply.getSpec().getCommentName()), @@ -311,6 +410,7 @@ public class ContextExtractor { boolean isAiConversation, String postDate, int commentCount, - String conversationHistory + String conversationHistory, + String postKind ) {} } diff --git a/src/main/java/top/nxxy335/commentaiautopilot/service/PromptBuilder.java b/src/main/java/top/nxxy335/commentaiautopilot/service/PromptBuilder.java index 07938c0..c9dcd55 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/service/PromptBuilder.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/service/PromptBuilder.java @@ -142,8 +142,10 @@ public class PromptBuilder { return prompt; } String sentimentHint = switch (sentiment) { + case "VERY_POSITIVE" -> "\n\n【情感提示】评论者情绪非常正面积极,请用热情洋溢的语气回复,表达真诚的感谢和共鸣。"; case "POSITIVE" -> "\n\n【情感提示】评论者情绪正面积极,请用热情友好的语气回复,可以表达感谢和共鸣。"; case "NEGATIVE" -> "\n\n【情感提示】评论者情绪偏负面,请用理性温和的语气回复,避免激化矛盾,展现理解和包容。"; + case "VERY_NEGATIVE" -> "\n\n【情感提示】评论者情绪非常负面,请用非常温和、理性的语气回复,避免任何可能激化矛盾的表达,展现充分的理解和耐心。"; default -> ""; }; return prompt + sentimentHint; diff --git a/src/main/java/top/nxxy335/commentaiautopilot/service/SentimentService.java b/src/main/java/top/nxxy335/commentaiautopilot/service/SentimentService.java index 1b144eb..2073376 100644 --- a/src/main/java/top/nxxy335/commentaiautopilot/service/SentimentService.java +++ b/src/main/java/top/nxxy335/commentaiautopilot/service/SentimentService.java @@ -17,13 +17,17 @@ public class SentimentService { } public record SentimentResult(String sentiment, double confidence) { + public static final String VERY_POSITIVE = "VERY_POSITIVE"; public static final String POSITIVE = "POSITIVE"; public static final String NEUTRAL = "NEUTRAL"; public static final String NEGATIVE = "NEGATIVE"; + public static final String VERY_NEGATIVE = "VERY_NEGATIVE"; } private static final List CHOICES = List.of( - SentimentResult.POSITIVE, SentimentResult.NEUTRAL, SentimentResult.NEGATIVE + SentimentResult.VERY_POSITIVE, SentimentResult.POSITIVE, + SentimentResult.NEUTRAL, SentimentResult.NEGATIVE, + SentimentResult.VERY_NEGATIVE ); /** @@ -31,7 +35,15 @@ public class SentimentService { * ({@code OutputSpec.choice}) for reliable classification. */ public Mono analyzeSentiment(String commentContent, String modelName) { - String systemPrompt = "你是一个情感分析助手。请分析评论的情感倾向,只返回 POSITIVE、NEUTRAL 或 NEGATIVE 之一。"; + String systemPrompt = "你是一个专业的情感分析助手。请根据以下标准分析评论的情感倾向:\n" + + "\n" + + "- VERY_POSITIVE:非常正面,包含强烈的感谢、赞美或认同(如\"太棒了\"、\"非常感谢\"、\"写得太好了\")\n" + + "- POSITIVE:正面,友好、肯定或支持的态度(如\"不错\"、\"学习了\"、\"支持\")\n" + + "- NEUTRAL:中性,提问、讨论、陈述事实,无明显情感倾向(如\"请问...\"、\"这个怎么用\"、\"我觉得\")\n" + + "- NEGATIVE:负面,不满、质疑或批评(如\"不好用\"、\"有问题\"、\"不太行\")\n" + + "- VERY_NEGATIVE:非常负面,攻击、辱骂或极端负面情绪(如\"垃圾\"、\"骗子\"、\"太差了\")\n" + + "\n" + + "只返回 VERY_POSITIVE、POSITIVE、NEUTRAL、NEGATIVE 或 VERY_NEGATIVE 之一。"; String userPrompt = "分析以下评论的情感倾向:\n\n" + commentContent; return aiFoundationClient.classify(systemPrompt, userPrompt, CHOICES, modelName) diff --git a/src/main/resources/plugin.yaml b/src/main/resources/plugin.yaml index a66e927..2ad1b40 100644 --- a/src/main/resources/plugin.yaml +++ b/src/main/resources/plugin.yaml @@ -30,4 +30,4 @@ spec: url: "https://github.com/sunny-335/plugin-comment-ai-autopilot/blob/main/LICENSE" settingName: "comment-ai-autopilot-settings" configMapName: "comment-ai-autopilot-configmap" - version: "1.0.0-beta.3" + version: "1.0.0-b26cea" diff --git a/ui/src/views/LogsView.vue b/ui/src/views/LogsView.vue index 0d0b5bd..aff3a9b 100644 --- a/ui/src/views/LogsView.vue +++ b/ui/src/views/LogsView.vue @@ -11,27 +11,27 @@
- 已选择 {{ selectedNames.size }} 项 + 已选择 {{ selectedNames.size }} 项
@@ -112,26 +122,26 @@
{{ getStatusLabel(reply.spec.status) }} {{ reply.spec.published ? '已发布' : '未发布' }} 对话 {{ getSentimentLabel(reply.spec.sentiment) }} @@ -151,11 +161,11 @@
- - 评分 {{ reply.spec.score }} - {{ getScoreLabel(reply.spec.score) }} + + 评分 {{ reply.spec.score }} + {{ getScoreLabel(reply.spec.score) }} - + 文章 + + 页面 + {{ reply.spec.postSlug }} + + + + 重试 {{ reply.spec.retryCount }} @@ -318,6 +340,7 @@ interface AiCommentReplyItem { commentId: string postId: string postSlug: string + postKind: string reply: string score: number status: string @@ -509,6 +532,14 @@ const getScoreClass = (score: number) => { return "text-red-600" } +const getScoreLabelClass = (score: number) => { + if (score >= 85) return "score-label--excellent" + if (score >= 70) return "score-label--good" + if (score >= 50) return "score-label--average" + if (score > 0) return "score-label--poor" + return "" +} + const getScoreLabel = (score: number) => { if (score >= 85) return "优秀" if (score >= 70) return "良好" @@ -520,15 +551,15 @@ const getScoreLabel = (score: number) => { const getStatusClass = (status: string) => { switch (status) { case "PASS": - return "bg-green-100 text-green-700" + return "status-tag--pass" case "FAIL": - return "bg-red-100 text-red-700" + return "status-tag--fail" case "PENDING": - return "bg-gray-100 text-gray-700" + return "status-tag--pending" case "REJECTED": - return "bg-red-100 text-red-700" + return "status-tag--rejected" default: - return "bg-gray-100 text-gray-700" + return "status-tag--pending" } } @@ -549,23 +580,31 @@ const getStatusLabel = (status: string) => { const getSentimentClass = (sentiment: string) => { switch (sentiment) { + case "VERY_POSITIVE": + return "status-tag--very-positive" case "POSITIVE": - return "bg-green-50 text-green-600" + return "status-tag--positive" case "NEGATIVE": - return "bg-red-50 text-red-600" + return "status-tag--negative" + case "VERY_NEGATIVE": + return "status-tag--very-negative" case "NEUTRAL": - return "bg-gray-100 text-gray-600" + return "status-tag--neutral-sentiment" default: - return "bg-gray-100 text-gray-600" + return "status-tag--neutral-sentiment" } } const getSentimentLabel = (sentiment: string) => { switch (sentiment) { + case "VERY_POSITIVE": + return "非常正面" case "POSITIVE": return "正面" case "NEGATIVE": return "负面" + case "VERY_NEGATIVE": + return "非常负面" case "NEUTRAL": return "中性" default: @@ -582,6 +621,10 @@ const getPostUrl = (slug: string) => { return `${window.location.origin}/archives/${slug}` } +const getPageUrl = (slug: string) => { + return `${window.location.origin}/pages/${slug}` +} + /** * Strip HTML tags for plain text display (card preview) */ @@ -649,4 +692,206 @@ onMounted(fetchReplies) -webkit-box-orient: vertical; overflow: hidden; } + +/* ===== Batch Operation Buttons ===== */ +.batch-btn { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 4px 12px; + font-size: 12px; + font-weight: 500; + border-radius: 6px; + border: none; + cursor: pointer; + transition: all 0.15s ease; + line-height: 1.5; +} +.batch-btn--approve { + background-color: #16a34a; + color: #fff; +} +.batch-btn--approve:hover { + background-color: #15803d; +} +.batch-btn--reject { + background-color: #f97316; + color: #fff; +} +.batch-btn--reject:hover { + background-color: #ea580c; +} +.batch-btn--delete { + background-color: #dc2626; + color: #fff; +} +.batch-btn--delete:hover { + background-color: #b91c1c; +} +.batch-btn--cancel { + background: none; + color: #6b7280; + margin-left: auto; +} +.batch-btn--cancel:hover { + color: #374151; + background: #f3f4f6; +} + +/* ===== Filter Bar ===== */ +.filter-select { + padding: 6px 32px 6px 12px; + font-size: 13px; + border: 1px solid #e5e7eb; + border-radius: 8px; + background: #f9fafb; + color: #374151; + outline: none; + cursor: pointer; + appearance: none; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 8px center; + background-size: 16px; + transition: all 0.15s ease; +} +.filter-select:focus { + border-color: #3b82f6; + background-color: #fff; + box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); +} +.filter-search-icon { + position: absolute; + left: 10px; + top: 50%; + transform: translateY(-50%); + width: 16px; + height: 16px; + color: #9ca3af; + pointer-events: none; +} +.filter-input { + width: 100%; + padding: 6px 12px 6px 34px; + font-size: 13px; + border: 1px solid #e5e7eb; + border-radius: 8px; + background: #f9fafb; + color: #374151; + outline: none; + transition: all 0.15s ease; +} +.filter-input:focus { + border-color: #3b82f6; + background-color: #fff; + box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); +} +.filter-input::placeholder { + color: #9ca3af; +} +.filter-reset-btn { + display: inline-flex; + align-items: center; + gap: 4px; + padding: 6px 12px; + font-size: 13px; + color: #6b7280; + background: #f3f4f6; + border: 1px solid #e5e7eb; + border-radius: 8px; + cursor: pointer; + transition: all 0.15s ease; +} +.filter-reset-btn:hover { + color: #374151; + background: #e5e7eb; +} + +/* ===== Status Tags ===== */ +.status-tag { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border-radius: 4px; + font-size: 11px; + font-weight: 500; + line-height: 1.5; +} +.status-tag--pass { + background: #dcfce7; + color: #166534; +} +.status-tag--fail { + background: #fee2e2; + color: #991b1b; +} +.status-tag--pending { + background: #f3f4f6; + color: #374151; +} +.status-tag--rejected { + background: #fee2e2; + color: #991b1b; +} +.status-tag--published { + background: #dbeafe; + color: #1e40af; +} +.status-tag--unpublished { + background: #f3f4f6; + color: #9ca3af; +} +.status-tag--conversation { + background: #ede9fe; + color: #5b21b6; +} + +/* Sentiment tags */ +.status-tag--very-positive { + background: #dcfce7; + color: #166534; +} +.status-tag--positive { + background: #bbf7d0; + color: #15803d; +} +.status-tag--neutral-sentiment { + background: #f3f4f6; + color: #4b5563; +} +.status-tag--negative { + background: #fecaca; + color: #b91c1c; +} +.status-tag--very-negative { + background: #fee2e2; + color: #991b1b; +} + +/* ===== Score Label ===== */ +.score-label { + display: inline-flex; + align-items: center; + padding: 1px 6px; + border-radius: 4px; + font-size: 11px; + font-weight: 500; + margin-left: 4px; +} +.score-label--excellent { + background: #dcfce7; + color: #166534; +} +.score-label--good { + background: #dbeafe; + color: #1e40af; +} +.score-label--average { + background: #fef3c7; + color: #92400e; +} +.score-label--poor { + background: #fee2e2; + color: #991b1b; +}