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-19 15:29:44 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd05ff93d9cf5d3d27cf4e931a0c732553865401
dd05ff93
1 parent
307723cc
Optimize GraphRAG storage
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
ReportEngine/graphrag/graph_storage.py
ReportEngine/graphrag/graph_storage.py
View file @
dd05ff9
...
...
@@ -377,13 +377,30 @@ class GraphStorage:
if
not
chapters_dir
.
exists
():
return
None
# 兼容不同分隔符(report-xxx 与 report_xxx)以及简化匹配
if
not
report_id
:
return
None
normalized_target
=
re
.
sub
(
r'[-_]'
,
''
,
str
(
report_id
))
.
lower
()
alt_targets
=
{
report_id
,
str
(
report_id
)
.
replace
(
'_'
,
'-'
),
str
(
report_id
)
.
replace
(
'-'
,
'_'
),
normalized_target
,
}
# 查找匹配报告ID的目录
for
run_dir
in
chapters_dir
.
iterdir
():
if
not
run_dir
.
is_dir
():
continue
# 检查目录名是否包含报告ID
if
report_id
in
run_dir
.
name
:
name
=
run_dir
.
name
normalized_name
=
re
.
sub
(
r'[-_]'
,
''
,
name
)
.
lower
()
# 检查目录名是否包含报告ID或归一化后相等
if
(
any
(
t
for
t
in
alt_targets
if
t
and
t
in
name
)
or
normalized_name
==
normalized_target
):
graph_path
=
run_dir
/
self
.
FILENAME
if
graph_path
.
exists
():
return
graph_path
...
...
Please
register
or
login
to post a comment