Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ccran
/
lufa-contract
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
96c9a464
authored
Jun 18, 2026
by
ccran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update optimize;
parent
7bf4fe70
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
17 deletions
+13
-17
data/batch/batch.py
+4
-4
data/optimize_review_prompt_flow.py
+6
-10
data/rules.xlsx
+0
-0
utils/http_util.py
+3
-3
No files found.
data/batch/batch.py
View file @
96c9a464
...
...
@@ -99,7 +99,7 @@ def process_single_file(
)
model
=
"Qwen2-72B-Instruct"
# 合同审核Excel工作流处理
logger
.
info
(
" 第{}个文件,处理文件: {}"
.
format
(
counter
,
original_file
))
#
logger.info(" 第{}个文件,处理文件: {}".format(counter, original_file))
result
=
fastgpt_openai_chat
(
url
,
...
...
@@ -124,9 +124,9 @@ def process_single_file(
),
des_doc_file
,
)
logger
.
info
(
f
"第{counter}个文件下载:{excel_url}到{des_excel_file} {des_doc_file}"
)
#
logger.info(
#
f"第{counter}个文件下载:{excel_url}到{des_excel_file} {des_doc_file}"
#
)
except
Exception
as
e
:
logger
.
error
(
f
"{original_file} 处理异常 第{counter}个文件: {e}"
)
logger
.
error
(
traceback
.
print_exc
())
...
...
data/optimize_review_prompt_flow.py
View file @
96c9a464
...
...
@@ -514,6 +514,7 @@ def parse_args() -> argparse.Namespace:
parser
.
add_argument
(
"--batch-output"
,
type
=
Path
,
# default='/data/home/htsc/jp-contract/data/benchmark/results/jp-output-20260618-163339-976082',
help
=
"Use an existing batch output dir for the first round instead of running batch.py."
,
)
parser
.
add_argument
(
...
...
@@ -537,7 +538,7 @@ def main() -> int:
if
not
args
.
skip_app_restart
:
restart_app
(
args
.
app_session
,
args
.
app_command
)
batch_output_dir
=
run_batch
()
print
(
f
'round={round_idx} 完成批处理任务={batch_output_dir}'
,
flush
=
True
)
# 2. 测评结果分析,生成优化建议,写回规则文件,记录优化报告
eval_excel
=
run_eval
(
batch_output_dir
)
eval_items
=
read_eval_items
(
...
...
@@ -546,15 +547,16 @@ def main() -> int:
f1_threshold
=
args
.
f1_threshold
,
example_limit
=
args
.
example_limit
,
)
print
(
f
'round={round_idx} 解析评测结果,待优化审查项数量={len(eval_items)}'
,
flush
=
True
)
rule_tasks
=
build_rule_tasks
(
eval_items
)
optimizations
=
asyncio
.
run
(
optimize_rule_tasks
(
rule_tasks
,
max_workers
=
args
.
max_workers
))
print
(
f
'round={round_idx} 完成LLM优化建议生成,优化建议数量={len(optimizations)}'
,
flush
=
True
)
backup_file
:
Path
|
None
=
None
applied
:
list
[
dict
[
str
,
Any
]]
=
[]
if
optimizations
and
not
args
.
dry_run
:
backup_file
=
backup_rules
(
rules_file
,
report_file
.
parent
/
"rule_backups"
,
round_idx
)
applied
=
update_rules_file
(
rules_file
,
optimizations
)
#
append_round_report
(
report_file
=
report_file
,
round_idx
=
round_idx
,
...
...
@@ -566,13 +568,7 @@ def main() -> int:
applied
=
applied
,
f1_threshold
=
args
.
f1_threshold
,
)
print
(
f
"round={round_idx} batch_output={batch_output_dir} eval_excel={eval_excel} "
f
"optimized_items={len(eval_items)} optimized_rules={len(rule_tasks)} "
f
"applied_updates={len(applied)} report={report_file}"
,
flush
=
True
,
)
print
(
'*'
*
80
,
flush
=
True
)
if
not
eval_items
:
break
...
...
data/rules.xlsx
View file @
96c9a464
No preview for this file type
utils/http_util.py
View file @
96c9a464
...
...
@@ -116,7 +116,7 @@ def download_file(url, path, input_url_to_inner=True):
if
not
url
.
startswith
(
"http:"
)
and
not
url
.
startswith
(
"https:"
):
url
=
base_fastgpt_url
+
url
url
=
url
.
replace
(
outer_backend_url
,
base_backend_url
)
logger
.
info
(
f
"url准备下载:{url}"
)
#
logger.info(f"url准备下载:{url}")
# 发送一个HTTP请求到URL
response
=
requests
.
get
(
url
)
# 确保请求成功
...
...
@@ -131,10 +131,10 @@ def download_file(url, path, input_url_to_inner=True):
with
open
(
target_path
,
"wb"
)
as
f
:
# 写入响应的内容
f
.
write
(
response
.
content
)
logger
.
info
(
f
"{url}文件下载成功,保存到{target_path}"
)
#
logger.info(f"{url}文件下载成功,保存到{target_path}")
return
str
(
target_path
)
else
:
logger
.
error
(
f
"{url}文件下载失败. HTTP Status Code: {response.status_code}"
)
#
logger.error(f"{url}文件下载失败. HTTP Status Code: {response.status_code}")
return
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment