Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
马一丁
2025-12-11 21:50:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8fcd497a64801f5d4edb5b26dd9f38018773dfa4
8fcd497a
1 parent
2ca84801
Remove the rating information from the SWOT analysis
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
33 deletions
ReportEngine/ir/schema.py
ReportEngine/ir/validator.py
ReportEngine/prompts/prompts.py
ReportEngine/renderers/html_renderer.py
ReportEngine/ir/schema.py
View file @
8fcd497
...
...
@@ -188,12 +188,12 @@ swot_item_schema: Dict[str, Any] = {
"enum"
:
[
"低"
,
"中低"
,
"中"
,
"中高"
,
"高"
,
"极高"
],
"description"
:
"影响评级,只允许填写:低/中低/中/中高/高/极高"
,
},
"score"
:
{
"type"
:
"number"
,
"minimum"
:
0
,
"maximum"
:
10
,
"description"
:
"评分,只允许0-10的数字"
,
},
# "score": {
# "type": "number",
# "minimum": 0,
# "maximum": 10,
# "description": "评分,只允许0-10的数字",
# },
"priority"
:
{
"type"
:
[
"string"
,
"number"
]},
},
"required"
:
[],
...
...
ReportEngine/ir/validator.py
View file @
8fcd497
...
...
@@ -177,23 +177,23 @@ class IRValidator:
f
"当前值: {impact};如需详细说明请写入 detail 字段"
)
# 校验 score 字段:只允许 0-10 的数字
score
=
item
.
get
(
"score"
)
if
score
is
not
None
:
valid_score
=
False
if
isinstance
(
score
,
(
int
,
float
)):
valid_score
=
0
<=
score
<=
10
elif
isinstance
(
score
,
str
):
# 兼容字符串形式的数字
try
:
numeric_score
=
float
(
score
)
valid_score
=
0
<=
numeric_score
<=
10
except
ValueError
:
valid_score
=
False
if
not
valid_score
:
errors
.
append
(
f
"{path}.score 只允许填写 0-10 的数字,当前值: {score}"
)
# # 校验 score 字段:只允许 0-10 的数字(已禁用)
# score = item.get("score")
# if score is not None:
# valid_score = False
# if isinstance(score, (int, float)):
# valid_score = 0 <= score <= 10
# elif isinstance(score, str):
# # 兼容字符串形式的数字
# try:
# numeric_score = float(score)
# valid_score = 0 <= numeric_score <= 10
# except ValueError:
# valid_score = False
# if not valid_score:
# errors.append(
# f"{path}.score 只允许填写 0-10 的数字,当前值: {score}"
# )
def
_validate_blockquote_block
(
self
,
block
:
Dict
[
str
,
Any
],
path
:
str
,
errors
:
List
[
str
]
...
...
ReportEngine/prompts/prompts.py
View file @
8fcd497
...
...
@@ -304,7 +304,7 @@ SYSTEM_PROMPT_CHAPTER_JSON = f"""
3. 所有段落都放入paragraph.inlines,混排样式通过marks表示(bold/italic/color/link等)。
4. 所有heading必须包含anchor,锚点与编号保持模板一致,比如section-2-1。
5. 表格需给出rows/cells/align,KPI卡请使用kpiGrid,分割线用hr。
6. SWOT分析必须优先使用 block.type="swotTable":分别填写 strengths/weaknesses/opportunities/threats 数组,单项至少包含 title/label/text 之一,可附加 detail/evidence/impact
/score 字段;title/summary 字段用于概览说明。**特别注意:impact 字段只允许填写影响评级("低"/"中低"/"中"/"中高"/"高"/"极高"),score 字段只允许填写 0-10 的数字
;任何关于影响的文字叙述、详细说明、佐证或扩展描述必须写入 detail 字段,禁止在 impact 字段中混入描述性文字。**
6. SWOT分析必须优先使用 block.type="swotTable":分别填写 strengths/weaknesses/opportunities/threats 数组,单项至少包含 title/label/text 之一,可附加 detail/evidence/impact
字段;title/summary 字段用于概览说明。**特别注意:impact 字段只允许填写影响评级("低"/"中低"/"中"/"中高"/"高"/"极高")
;任何关于影响的文字叙述、详细说明、佐证或扩展描述必须写入 detail 字段,禁止在 impact 字段中混入描述性文字。**
7. 如需引用图表/交互组件,统一用widgetType表示(例如chart.js/line、chart.js/doughnut)。
8. 鼓励结合outline中列出的子标题,生成多层heading与细粒度内容,同时可补充callout、blockquote等。
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。
...
...
ReportEngine/renderers/html_renderer.py
View file @
8fcd497
...
...
@@ -1286,7 +1286,7 @@ class HTMLRenderer:
item_detail
=
item
.
get
(
"detail"
)
or
item
.
get
(
"description"
)
or
""
item_evidence
=
item
.
get
(
"evidence"
)
or
item
.
get
(
"source"
)
or
""
item_impact
=
item
.
get
(
"impact"
)
or
item
.
get
(
"priority"
)
or
""
item_score
=
item
.
get
(
"score"
)
# item_score = item.get("score") # 评分功能已禁用
# 构建详情内容
detail_parts
=
[]
...
...
@@ -1300,8 +1300,8 @@ class HTMLRenderer:
tags
=
[]
if
item_impact
:
tags
.
append
(
f
'<span class="swot-pdf-tag">{self._escape_html(item_impact)}</span>'
)
if
item_score
not
in
(
None
,
""
):
tags
.
append
(
f
'<span class="swot-pdf-tag swot-pdf-tag--score">评分 {self._escape_html(item_score)}</span>'
)
# if item_score not in (None, ""): # 评分功能已禁用
# tags.append(f'<span class="swot-pdf-tag swot-pdf-tag--score">评分 {self._escape_html(item_score)}</span>')
tags_html
=
" "
.
join
(
tags
)
# 第一行需要合并象限标题单元格
...
...
@@ -1354,7 +1354,7 @@ class HTMLRenderer:
<th class="swot-pdf-th-num">序号</th>
<th class="swot-pdf-th-title">要点</th>
<th class="swot-pdf-th-detail">详细说明</th>
<th class="swot-pdf-th-tags">影响
/评分
</th>
<th class="swot-pdf-th-tags">影响</th>
</tr>
{summary_row}
</thead>
...
...
@@ -1387,7 +1387,7 @@ class HTMLRenderer:
detail
=
entry
.
get
(
"detail"
)
or
entry
.
get
(
"description"
)
evidence
=
entry
.
get
(
"evidence"
)
or
entry
.
get
(
"source"
)
impact
=
entry
.
get
(
"impact"
)
or
entry
.
get
(
"priority"
)
score
=
entry
.
get
(
"score"
)
# score = entry.get("score") # 评分功能已禁用
if
not
title
and
isinstance
(
detail
,
str
):
title
=
detail
detail
=
None
...
...
@@ -1399,7 +1399,7 @@ class HTMLRenderer:
"detail"
:
detail
,
"evidence"
:
evidence
,
"impact"
:
impact
,
"score"
:
score
,
# "score": score, # 评分功能已禁用
}
)
return
normalized
...
...
@@ -1410,12 +1410,12 @@ class HTMLRenderer:
detail
=
item
.
get
(
"detail"
)
or
item
.
get
(
"description"
)
evidence
=
item
.
get
(
"evidence"
)
or
item
.
get
(
"source"
)
impact
=
item
.
get
(
"impact"
)
or
item
.
get
(
"priority"
)
score
=
item
.
get
(
"score"
)
# score = item.get("score") # 评分功能已禁用
tags
:
List
[
str
]
=
[]
if
impact
:
tags
.
append
(
f
'<span class="swot-tag">{self._escape_html(impact)}</span>'
)
if
score
not
in
(
None
,
""
):
tags
.
append
(
f
'<span class="swot-tag neutral">评分 {self._escape_html(score)}</span>'
)
# if score not in (None, ""): # 评分功能已禁用
# tags.append(f'<span class="swot-tag neutral">评分 {self._escape_html(score)}</span>')
tags_html
=
f
'<span class="swot-item-tags">{"".join(tags)}</span>'
if
tags
else
""
detail_html
=
f
'<div class="swot-item-desc">{self._escape_html(detail)}</div>'
if
detail
else
""
evidence_html
=
f
'<div class="swot-item-evidence">佐证:{self._escape_html(evidence)}</div>'
if
evidence
else
""
...
...
Please
register
or
login
to post a comment