Просмотр исходного кода

feat(openapi): discussions 新增 assessment(译文评估)类型与 score 字段

- POST /v3/discussions:type=assessment 时 score(0–100)与 severity(评估方法)必填,
  一句只留一条,已有评估时覆盖并返回 200
- PATCH 可改 score;severity 去掉枚举(assessment 存评估方法)
- 列表 / summary / tipitaka-discussions 的 type 增加 assessment;响应增加 score

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 16 часов назад
Родитель
Сommit
d2f5a6789b

+ 1 - 1
openapi/public/assets/protocol/main.yaml

@@ -7,7 +7,7 @@ info:
 
     由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。
     响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
-  version: 2026.10.21
+  version: 2026.10.22
 servers:
   -
     url: /api

+ 9 - 0
openapi/public/assets/protocol/resources/auto/v3-discussions-discussion-replies.yaml

@@ -61,6 +61,9 @@ get:
                     severity:
                       type: string
                       nullable: true
+                    score:
+                      type: number
+                      nullable: true
                     status:
                       type: string
                     title:
@@ -187,6 +190,9 @@ post:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:
@@ -292,6 +298,9 @@ post:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:

+ 17 - 7
openapi/public/assets/protocol/resources/auto/v3-discussions-discussion.yaml

@@ -46,6 +46,9 @@ get:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:
@@ -176,6 +179,9 @@ delete:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:
@@ -281,6 +287,7 @@ patch:
     正文不能清空,可改锚点。
     改了内容(标题、正文、锚点)时 co_editor 跟着这次写入走:人亲自改则清空,AI 代改则换成该模型;
     只改 status / type / severity 不动 co_editor。
+    评估:可改 score、severity(评估方法,不能清空)、标题、正文;没有 status,不能与其它类型互转。
 
     实现:`V3\DiscussionController@update`
   security:
@@ -324,15 +331,15 @@ patch:
                 - glossary
                 - note
                 - commentary
+                - assessment
             severity:
               type: string
-              description: '严重程度(只限话题),null 表示清空'
-              enum:
-                - error
-                - warning
-                - suggestion
-                - urgent
-                - normal
+              description: '严重程度(只限话题),null 表示清空;assessment 为评估方法,不能清空'
+              example: warning
+            score:
+              type: number
+              description: '评估分数 0–100(只限 assessment)'
+              example: 85.0
             pos_start:
               type: integer
               description: '锚点起始偏移(只限 note / commentary / issue / glossary)'
@@ -373,6 +380,9 @@ patch:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:

+ 1 - 0
openapi/public/assets/protocol/resources/auto/v3-discussions-summary.yaml

@@ -47,6 +47,7 @@ get:
           - glossary
           - note
           - commentary
+          - assessment
       description: 只数这种类型,不传则只数评论线程
   responses:
     200:

+ 28 - 13
openapi/public/assets/protocol/resources/auto/v3-discussions.yaml

@@ -8,7 +8,8 @@ get:
     只列话题(不含回复),删除了但还有回复的话题以墓碑出现(deleted_at 有值、内容为空)。
     未登录看不到不公开的话题(discussion);basic 角色在自己无权管理的对象上只看得到
     自己发起的不公开话题。各状态的数量与「能发起哪些类型」见 `GET /v3/discussions/summary`。
-    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注要显式 type=note / commentary。
+    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注与评估要显式
+    type=note / commentary / assessment。
     要一段经文(一章、一段段落区间)里的全部话题,用 `GET /v3/tipitaka-discussions/{channel}`。
 
     实现:`V3\DiscussionController@index`
@@ -57,6 +58,7 @@ get:
           - glossary
           - note
           - commentary
+          - assessment
       description: 类型,不传则只列评论线程
     -
       name: status
@@ -72,7 +74,7 @@ get:
       in: query
       schema:
         type: string
-      description: 严重程度,逗号分隔多选
+      description: '严重程度(assessment 为评估方法),逗号分隔多选'
       example: 'error,warning'
     -
       name: sort
@@ -120,6 +122,9 @@ get:
                     severity:
                       type: string
                       nullable: true
+                    score:
+                      type: number
+                      nullable: true
                     status:
                       type: string
                     title:
@@ -184,7 +189,7 @@ get:
     422:
       $ref: '../../main.yaml#/components/responses/ProblemValidation'
 post:
-  summary: 发起话题或新建批注
+  summary: 发起话题、新建批注或评估
   tags:
     - discussions
   operationId: post_api_v3_discussions
@@ -195,6 +200,10 @@ post:
     批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
     标题可省、正文必填,commentary 的正文必须是义注句子模板 `{{book-para-start-end}}`
     (可多句并列);可带锚点 pos_* / quote_*;不发通知。
+    assessment(译文评估:用某种方法给这句译文打分)只能加在句子上,且只有该句所在 channel 的编辑者能加
+    (AI 凭授权代写);score(0–100)必填,severity 必填、填评估方法(1–16 位字母数字 . _ -),
+    标题可省,理由写 content;不收锚点、不发通知。**一句只留一条**:已有评估时就地覆盖
+    (分数、方法、理由、署名都换成这次的,回复保留),返回 200;没有才新建,返回 201。
     glossary(外挂术语:不改译文,给锚点处的译文挂上术语)是评论线程,title 必填、填术语词头;
     与批注一样只能挂在句子上、只有该句所在 channel 的编辑者能发,对所有人公开可见。
     锚点只有 note / commentary / issue / glossary 收,其它类型传了 422。
@@ -233,22 +242,22 @@ post:
                 - glossary
                 - note
                 - commentary
+                - assessment
               default: discussion
             title:
               type: string
-              description: '标题,最长 256 字符;评论线程必填(glossary 填术语词头),批注可省'
+              description: '标题,最长 256 字符;评论线程必填(glossary 填术语词头),批注与评估可省'
             content:
               type: string
-              description: 正文(markdown);批注必填
+              description: 正文(markdown);批注必填,评估写打分理由
             severity:
               type: string
-              description: 严重程度
-              enum:
-                - error
-                - warning
-                - suggestion
-                - urgent
-                - normal
+              description: '严重程度:issue 为 error / warning / suggestion,help 为 urgent / normal;assessment 必填,填评估方法(1–16 位字母数字 . _ -)'
+              example: error
+            score:
+              type: number
+              description: '评估分数 0–100(只限且必填于 assessment)'
+              example: 85.0
             pos_start:
               type: integer
               description: '锚点在句子文本中的起始偏移(只限 note / commentary / issue / glossary)'
@@ -276,7 +285,7 @@ post:
             - target_id
   responses:
     200:
-      description: 成功
+      description: '覆盖了该句已有的评估(只限 assessment)'
       content:
         application/json:
           schema:
@@ -299,6 +308,9 @@ post:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:
@@ -404,6 +416,9 @@ post:
                   severity:
                     type: string
                     nullable: true
+                  score:
+                    type: number
+                    nullable: true
                   status:
                     type: string
                   title:

+ 6 - 3
openapi/public/assets/protocol/resources/auto/v3-tipitaka-discussions-channel.yaml

@@ -7,8 +7,8 @@ get:
   description: |-
     只列挂在该 channel 句子上的话题(不含回复),按经文顺序(书、段、句)排列,同一句里按时间;
     每条带 `sentence`(所在句子的坐标)。删除了但还有回复的话题以墓碑出现。
-    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注要显式
-    type=note / commentary。可见性同 `GET /v3/discussions`:未登录看不到 discussion;
+    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注与评估要显式
+    type=note / commentary / assessment。可见性同 `GET /v3/discussions`:未登录看不到 discussion;
     basic 角色在自己不能编辑的 channel 上只看得到自己发起的 discussion。
     channel 不存在或范围内没有讨论都返回空列表;chapter 不存在 404。
 
@@ -81,7 +81,7 @@ get:
       in: query
       schema:
         type: string
-      description: 严重程度,逗号分隔多选
+      description: '严重程度(assessment 为评估方法),逗号分隔多选'
       example: 'error,warning'
     -
       name: page
@@ -117,6 +117,9 @@ get:
                     severity:
                       type: string
                       nullable: true
+                    score:
+                      type: number
+                      nullable: true
                     status:
                       type: string
                     title: