Skip to content

feat: add word_count check dimension to reviewer #128

Description

@guorui999

📋 概述

在 reviewer 审查维度中新增 word_count 维度,用于检测章节字数是否低于最低门槛。此前 reviewer 的五维度(setting/timeline/continuity/character/logic)均不涉及字数检查。

🔄 复现步骤

  1. 写一章不足2500字的章节
  2. 运行 /webnovel-review N
  3. reviewer 输出不提示字数问题,五维度全 pass

🌐 环境信息

  • 版本:v6.2.1
  • 涉及命令:webnovel-reviewwebnovel-write Step 3
  • reviewer 模式:默认(2500字门槛)/ --fast(1500字门槛)

📦 改动清单(共5个文件,+32行)

1. Python 核心验证(必须改,否则 category 被静默回退)

--- a/webnovel-writer/scripts/data_modules/review_schema.py
+++ b/webnovel-writer/scripts/data_modules/review_schema.py
 VALID_CATEGORIES = {
     "continuity", "setting", "character", "timeline",
-    "ai_flavor", "logic", "pacing", "other",
+    "ai_flavor", "logic", "pacing", "word_count", "other",
 }
 SCORE_CATEGORIES = (
     "continuity",
     "setting",
     "character",
     "timeline",
     "ai_flavor",
     "logic",
     "pacing",
+    "word_count",
     "other",
 )

2. 测试用例

+def test_word_count_category_valid():
+    issue = ReviewIssue(severity="low", category="word_count", ...)
+    assert issue.category == "word_count"
+
+def test_word_count_issue_in_metrics():
+    result = ReviewResult(chapter=5, issues=[word_count_issue], ...)
+    metrics = result.to_metrics_dict()
+    assert "word_count" in metrics["categories"]

3. review-schema.md

category 字段枚举新增 word_count

4-5. webnovel-review + webnovel-write SKILL.md

reviewer 提示词中增加字数要求说明

✅ 验证方式

  1. pytest tests/test_review_schema.py -k word_count — 新增测试通过
  2. category=word_count 的 issue 输出后不会被自动回退到 other
  3. to_metrics_dict() 的 categories 和 dimension_scores 中包含 word_count

🔒 隐私说明

纯审查逻辑增强,不涉及用户数据、API Key 或个人信息。


完整改动在本地分支 feat/wordcount-check,共2个commit、+32行。因 token 权限不足无法直接推送,可联系 contributor 获取完整 diff 或据此指引手动修改。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions