Showing
4 changed files
with
33 additions
and
33 deletions
| @@ -188,12 +188,12 @@ swot_item_schema: Dict[str, Any] = { | @@ -188,12 +188,12 @@ swot_item_schema: Dict[str, Any] = { | ||
| 188 | "enum": ["低", "中低", "中", "中高", "高", "极高"], | 188 | "enum": ["低", "中低", "中", "中高", "高", "极高"], |
| 189 | "description": "影响评级,只允许填写:低/中低/中/中高/高/极高", | 189 | "description": "影响评级,只允许填写:低/中低/中/中高/高/极高", |
| 190 | }, | 190 | }, |
| 191 | - "score": { | ||
| 192 | - "type": "number", | ||
| 193 | - "minimum": 0, | ||
| 194 | - "maximum": 10, | ||
| 195 | - "description": "评分,只允许0-10的数字", | ||
| 196 | - }, | 191 | + # "score": { |
| 192 | + # "type": "number", | ||
| 193 | + # "minimum": 0, | ||
| 194 | + # "maximum": 10, | ||
| 195 | + # "description": "评分,只允许0-10的数字", | ||
| 196 | + # }, | ||
| 197 | "priority": {"type": ["string", "number"]}, | 197 | "priority": {"type": ["string", "number"]}, |
| 198 | }, | 198 | }, |
| 199 | "required": [], | 199 | "required": [], |
| @@ -177,23 +177,23 @@ class IRValidator: | @@ -177,23 +177,23 @@ class IRValidator: | ||
| 177 | f"当前值: {impact};如需详细说明请写入 detail 字段" | 177 | f"当前值: {impact};如需详细说明请写入 detail 字段" |
| 178 | ) | 178 | ) |
| 179 | 179 | ||
| 180 | - # 校验 score 字段:只允许 0-10 的数字 | ||
| 181 | - score = item.get("score") | ||
| 182 | - if score is not None: | ||
| 183 | - valid_score = False | ||
| 184 | - if isinstance(score, (int, float)): | ||
| 185 | - valid_score = 0 <= score <= 10 | ||
| 186 | - elif isinstance(score, str): | ||
| 187 | - # 兼容字符串形式的数字 | ||
| 188 | - try: | ||
| 189 | - numeric_score = float(score) | ||
| 190 | - valid_score = 0 <= numeric_score <= 10 | ||
| 191 | - except ValueError: | ||
| 192 | - valid_score = False | ||
| 193 | - if not valid_score: | ||
| 194 | - errors.append( | ||
| 195 | - f"{path}.score 只允许填写 0-10 的数字,当前值: {score}" | ||
| 196 | - ) | 180 | + # # 校验 score 字段:只允许 0-10 的数字(已禁用) |
| 181 | + # score = item.get("score") | ||
| 182 | + # if score is not None: | ||
| 183 | + # valid_score = False | ||
| 184 | + # if isinstance(score, (int, float)): | ||
| 185 | + # valid_score = 0 <= score <= 10 | ||
| 186 | + # elif isinstance(score, str): | ||
| 187 | + # # 兼容字符串形式的数字 | ||
| 188 | + # try: | ||
| 189 | + # numeric_score = float(score) | ||
| 190 | + # valid_score = 0 <= numeric_score <= 10 | ||
| 191 | + # except ValueError: | ||
| 192 | + # valid_score = False | ||
| 193 | + # if not valid_score: | ||
| 194 | + # errors.append( | ||
| 195 | + # f"{path}.score 只允许填写 0-10 的数字,当前值: {score}" | ||
| 196 | + # ) | ||
| 197 | 197 | ||
| 198 | def _validate_blockquote_block( | 198 | def _validate_blockquote_block( |
| 199 | self, block: Dict[str, Any], path: str, errors: List[str] | 199 | self, block: Dict[str, Any], path: str, errors: List[str] |
| @@ -304,7 +304,7 @@ SYSTEM_PROMPT_CHAPTER_JSON = f""" | @@ -304,7 +304,7 @@ SYSTEM_PROMPT_CHAPTER_JSON = f""" | ||
| 304 | 3. 所有段落都放入paragraph.inlines,混排样式通过marks表示(bold/italic/color/link等)。 | 304 | 3. 所有段落都放入paragraph.inlines,混排样式通过marks表示(bold/italic/color/link等)。 |
| 305 | 4. 所有heading必须包含anchor,锚点与编号保持模板一致,比如section-2-1。 | 305 | 4. 所有heading必须包含anchor,锚点与编号保持模板一致,比如section-2-1。 |
| 306 | 5. 表格需给出rows/cells/align,KPI卡请使用kpiGrid,分割线用hr。 | 306 | 5. 表格需给出rows/cells/align,KPI卡请使用kpiGrid,分割线用hr。 |
| 307 | -6. SWOT分析必须优先使用 block.type="swotTable":分别填写 strengths/weaknesses/opportunities/threats 数组,单项至少包含 title/label/text 之一,可附加 detail/evidence/impact/score 字段;title/summary 字段用于概览说明。**特别注意:impact 字段只允许填写影响评级("低"/"中低"/"中"/"中高"/"高"/"极高"),score 字段只允许填写 0-10 的数字;任何关于影响的文字叙述、详细说明、佐证或扩展描述必须写入 detail 字段,禁止在 impact 字段中混入描述性文字。** | 307 | +6. SWOT分析必须优先使用 block.type="swotTable":分别填写 strengths/weaknesses/opportunities/threats 数组,单项至少包含 title/label/text 之一,可附加 detail/evidence/impact 字段;title/summary 字段用于概览说明。**特别注意:impact 字段只允许填写影响评级("低"/"中低"/"中"/"中高"/"高"/"极高");任何关于影响的文字叙述、详细说明、佐证或扩展描述必须写入 detail 字段,禁止在 impact 字段中混入描述性文字。** |
| 308 | 7. 如需引用图表/交互组件,统一用widgetType表示(例如chart.js/line、chart.js/doughnut)。 | 308 | 7. 如需引用图表/交互组件,统一用widgetType表示(例如chart.js/line、chart.js/doughnut)。 |
| 309 | 8. 鼓励结合outline中列出的子标题,生成多层heading与细粒度内容,同时可补充callout、blockquote等。 | 309 | 8. 鼓励结合outline中列出的子标题,生成多层heading与细粒度内容,同时可补充callout、blockquote等。 |
| 310 | 9. engineQuote 仅用于呈现单Agent的原话:使用 block.type="engineQuote",engine 取值 insight/media/query,title 必须固定为对应Agent名字(insight->Insight Agent,media->Media Agent,query->Query Agent,不可自定义),内部 blocks 只允许 paragraph,paragraph.inlines 的 marks 仅可使用 bold/italic(可留空),禁止在 engineQuote 中放表格/图表/引用/公式等;当 reports 或 forumLogs 中有明确的文字段落、结论、数字/时间等可直接引用时,优先分别从 Query/Media/Insight 三个 Agent 摘出关键原文或文字版数据放入 engineQuote,尽量覆盖三类 Agent 而非只用单一来源,严禁臆造内容或把表格/图表改写进 engineQuote。 | 310 | 9. engineQuote 仅用于呈现单Agent的原话:使用 block.type="engineQuote",engine 取值 insight/media/query,title 必须固定为对应Agent名字(insight->Insight Agent,media->Media Agent,query->Query Agent,不可自定义),内部 blocks 只允许 paragraph,paragraph.inlines 的 marks 仅可使用 bold/italic(可留空),禁止在 engineQuote 中放表格/图表/引用/公式等;当 reports 或 forumLogs 中有明确的文字段落、结论、数字/时间等可直接引用时,优先分别从 Query/Media/Insight 三个 Agent 摘出关键原文或文字版数据放入 engineQuote,尽量覆盖三类 Agent 而非只用单一来源,严禁臆造内容或把表格/图表改写进 engineQuote。 |
| @@ -1286,7 +1286,7 @@ class HTMLRenderer: | @@ -1286,7 +1286,7 @@ class HTMLRenderer: | ||
| 1286 | item_detail = item.get("detail") or item.get("description") or "" | 1286 | item_detail = item.get("detail") or item.get("description") or "" |
| 1287 | item_evidence = item.get("evidence") or item.get("source") or "" | 1287 | item_evidence = item.get("evidence") or item.get("source") or "" |
| 1288 | item_impact = item.get("impact") or item.get("priority") or "" | 1288 | item_impact = item.get("impact") or item.get("priority") or "" |
| 1289 | - item_score = item.get("score") | 1289 | + # item_score = item.get("score") # 评分功能已禁用 |
| 1290 | 1290 | ||
| 1291 | # 构建详情内容 | 1291 | # 构建详情内容 |
| 1292 | detail_parts = [] | 1292 | detail_parts = [] |
| @@ -1300,8 +1300,8 @@ class HTMLRenderer: | @@ -1300,8 +1300,8 @@ class HTMLRenderer: | ||
| 1300 | tags = [] | 1300 | tags = [] |
| 1301 | if item_impact: | 1301 | if item_impact: |
| 1302 | tags.append(f'<span class="swot-pdf-tag">{self._escape_html(item_impact)}</span>') | 1302 | tags.append(f'<span class="swot-pdf-tag">{self._escape_html(item_impact)}</span>') |
| 1303 | - if item_score not in (None, ""): | ||
| 1304 | - tags.append(f'<span class="swot-pdf-tag swot-pdf-tag--score">评分 {self._escape_html(item_score)}</span>') | 1303 | + # if item_score not in (None, ""): # 评分功能已禁用 |
| 1304 | + # tags.append(f'<span class="swot-pdf-tag swot-pdf-tag--score">评分 {self._escape_html(item_score)}</span>') | ||
| 1305 | tags_html = " ".join(tags) | 1305 | tags_html = " ".join(tags) |
| 1306 | 1306 | ||
| 1307 | # 第一行需要合并象限标题单元格 | 1307 | # 第一行需要合并象限标题单元格 |
| @@ -1354,7 +1354,7 @@ class HTMLRenderer: | @@ -1354,7 +1354,7 @@ class HTMLRenderer: | ||
| 1354 | <th class="swot-pdf-th-num">序号</th> | 1354 | <th class="swot-pdf-th-num">序号</th> |
| 1355 | <th class="swot-pdf-th-title">要点</th> | 1355 | <th class="swot-pdf-th-title">要点</th> |
| 1356 | <th class="swot-pdf-th-detail">详细说明</th> | 1356 | <th class="swot-pdf-th-detail">详细说明</th> |
| 1357 | - <th class="swot-pdf-th-tags">影响/评分</th> | 1357 | + <th class="swot-pdf-th-tags">影响</th> |
| 1358 | </tr> | 1358 | </tr> |
| 1359 | {summary_row} | 1359 | {summary_row} |
| 1360 | </thead> | 1360 | </thead> |
| @@ -1387,7 +1387,7 @@ class HTMLRenderer: | @@ -1387,7 +1387,7 @@ class HTMLRenderer: | ||
| 1387 | detail = entry.get("detail") or entry.get("description") | 1387 | detail = entry.get("detail") or entry.get("description") |
| 1388 | evidence = entry.get("evidence") or entry.get("source") | 1388 | evidence = entry.get("evidence") or entry.get("source") |
| 1389 | impact = entry.get("impact") or entry.get("priority") | 1389 | impact = entry.get("impact") or entry.get("priority") |
| 1390 | - score = entry.get("score") | 1390 | + # score = entry.get("score") # 评分功能已禁用 |
| 1391 | if not title and isinstance(detail, str): | 1391 | if not title and isinstance(detail, str): |
| 1392 | title = detail | 1392 | title = detail |
| 1393 | detail = None | 1393 | detail = None |
| @@ -1399,7 +1399,7 @@ class HTMLRenderer: | @@ -1399,7 +1399,7 @@ class HTMLRenderer: | ||
| 1399 | "detail": detail, | 1399 | "detail": detail, |
| 1400 | "evidence": evidence, | 1400 | "evidence": evidence, |
| 1401 | "impact": impact, | 1401 | "impact": impact, |
| 1402 | - "score": score, | 1402 | + # "score": score, # 评分功能已禁用 |
| 1403 | } | 1403 | } |
| 1404 | ) | 1404 | ) |
| 1405 | return normalized | 1405 | return normalized |
| @@ -1410,12 +1410,12 @@ class HTMLRenderer: | @@ -1410,12 +1410,12 @@ class HTMLRenderer: | ||
| 1410 | detail = item.get("detail") or item.get("description") | 1410 | detail = item.get("detail") or item.get("description") |
| 1411 | evidence = item.get("evidence") or item.get("source") | 1411 | evidence = item.get("evidence") or item.get("source") |
| 1412 | impact = item.get("impact") or item.get("priority") | 1412 | impact = item.get("impact") or item.get("priority") |
| 1413 | - score = item.get("score") | 1413 | + # score = item.get("score") # 评分功能已禁用 |
| 1414 | tags: List[str] = [] | 1414 | tags: List[str] = [] |
| 1415 | if impact: | 1415 | if impact: |
| 1416 | tags.append(f'<span class="swot-tag">{self._escape_html(impact)}</span>') | 1416 | tags.append(f'<span class="swot-tag">{self._escape_html(impact)}</span>') |
| 1417 | - if score not in (None, ""): | ||
| 1418 | - tags.append(f'<span class="swot-tag neutral">评分 {self._escape_html(score)}</span>') | 1417 | + # if score not in (None, ""): # 评分功能已禁用 |
| 1418 | + # tags.append(f'<span class="swot-tag neutral">评分 {self._escape_html(score)}</span>') | ||
| 1419 | tags_html = f'<span class="swot-item-tags">{"".join(tags)}</span>' if tags else "" | 1419 | tags_html = f'<span class="swot-item-tags">{"".join(tags)}</span>' if tags else "" |
| 1420 | detail_html = f'<div class="swot-item-desc">{self._escape_html(detail)}</div>' if detail else "" | 1420 | detail_html = f'<div class="swot-item-desc">{self._escape_html(detail)}</div>' if detail else "" |
| 1421 | evidence_html = f'<div class="swot-item-evidence">佐证:{self._escape_html(evidence)}</div>' if evidence else "" | 1421 | evidence_html = f'<div class="swot-item-evidence">佐证:{self._escape_html(evidence)}</div>' if evidence else "" |
-
Please register or login to post a comment