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:26:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2ca84801d67a0ea2e6d9c74681a915731d42c18e
2ca84801
1 parent
24f04012
Optimize SWOT prompts and information processing methods
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
3 deletions
ReportEngine/ir/schema.py
ReportEngine/ir/validator.py
ReportEngine/prompts/prompts.py
ReportEngine/ir/schema.py
View file @
2ca8480
...
...
@@ -183,8 +183,17 @@ swot_item_schema: Dict[str, Any] = {
"detail"
:
{
"type"
:
"string"
},
"description"
:
{
"type"
:
"string"
},
"evidence"
:
{
"type"
:
"string"
},
"impact"
:
{
"type"
:
"string"
},
"score"
:
{
"type"
:
[
"number"
,
"string"
]},
"impact"
:
{
"type"
:
"string"
,
"enum"
:
[
"低"
,
"中低"
,
"中"
,
"中高"
,
"高"
,
"极高"
],
"description"
:
"影响评级,只允许填写:低/中低/中/中高/高/极高"
,
},
"score"
:
{
"type"
:
"number"
,
"minimum"
:
0
,
"maximum"
:
10
,
"description"
:
"评分,只允许0-10的数字"
,
},
"priority"
:
{
"type"
:
[
"string"
,
"number"
]},
},
"required"
:
[],
...
...
ReportEngine/ir/validator.py
View file @
2ca8480
...
...
@@ -147,6 +147,9 @@ class IRValidator:
for
idx
,
entry
in
enumerate
(
entries
):
self
.
_validate_swot_item
(
entry
,
f
"{path}.{name}[{idx}]"
,
errors
)
# SWOT impact 字段允许的评级值
ALLOWED_IMPACT_VALUES
=
{
"低"
,
"中低"
,
"中"
,
"中高"
,
"高"
,
"极高"
}
def
_validate_swot_item
(
self
,
item
:
Any
,
path
:
str
,
errors
:
List
[
str
]):
"""单个SWOT条目支持字符串或带字段的对象"""
if
isinstance
(
item
,
str
):
...
...
@@ -165,6 +168,33 @@ class IRValidator:
if
title
is
None
:
errors
.
append
(
f
"{path} 缺少 title/label/text/description 等文字字段"
)
# 校验 impact 字段:只允许评级值
impact
=
item
.
get
(
"impact"
)
if
impact
is
not
None
:
if
not
isinstance
(
impact
,
str
)
or
impact
not
in
self
.
ALLOWED_IMPACT_VALUES
:
errors
.
append
(
f
"{path}.impact 只允许填写影响评级(低/中低/中/中高/高/极高),"
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}"
)
def
_validate_blockquote_block
(
self
,
block
:
Dict
[
str
,
Any
],
path
:
str
,
errors
:
List
[
str
]
):
...
...
ReportEngine/prompts/prompts.py
View file @
2ca8480
...
...
@@ -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 字段用于概览说明。
6. SWOT分析必须优先使用 block.type="swotTable":分别填写 strengths/weaknesses/opportunities/threats 数组,单项至少包含 title/label/text 之一,可附加 detail/evidence/impact/score 字段;title/summary 字段用于概览说明。
**特别注意:impact 字段只允许填写影响评级("低"/"中低"/"中"/"中高"/"高"/"极高"),score 字段只允许填写 0-10 的数字;任何关于影响的文字叙述、详细说明、佐证或扩展描述必须写入 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。
...
...
Please
register
or
login
to post a comment