Commit a79604f2 by ccran

feat: 维修时间f1>80

parent 2347d107
...@@ -12,7 +12,9 @@ from core.config import LLM, MAX_WORKERS ...@@ -12,7 +12,9 @@ from core.config import LLM, MAX_WORKERS
class LLMTool(ToolBase): class LLMTool(ToolBase):
"""LLM-backed processor: builds prompts, calls LLM, parses JSON.""" """LLM-backed processor: builds prompts, calls LLM, parses JSON."""
def __init__(self, system_prompt: str, llm_key: str = "fastgpt_segment_review") -> None: def __init__(
self, system_prompt: str, llm_key: str = "fastgpt_segment_review"
) -> None:
super().__init__() super().__init__()
self.system_prompt = system_prompt self.system_prompt = system_prompt
self.llm = OpenAITool(LLM[llm_key], max_workers=MAX_WORKERS) self.llm = OpenAITool(LLM[llm_key], max_workers=MAX_WORKERS)
...@@ -33,7 +35,9 @@ class LLMTool(ToolBase): ...@@ -33,7 +35,9 @@ class LLMTool(ToolBase):
try: try:
return asyncio.run(coro) return asyncio.run(coro)
except RuntimeError as e: except RuntimeError as e:
print(f'RuntimeError in run_with_loop: {e}, trying to get event loop and run until complete.') print(
f"RuntimeError in run_with_loop: {e}, trying to get event loop and run until complete."
)
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
return loop.run_until_complete(coro) return loop.run_until_complete(coro)
......
...@@ -13,30 +13,35 @@ from loguru import logger ...@@ -13,30 +13,35 @@ from loguru import logger
from utils.common_util import random_str from utils.common_util import random_str
from utils.http_util import upload_file, fastgpt_openai_chat, download_file from utils.http_util import upload_file, fastgpt_openai_chat, download_file
SUFFIX = "_麓发迁移" use_lufa = False
batch_input_dir_path = "jp-input"
batch_output_dir_path = f"/home/ccran/lufa-contract/data/benchmark/results/jp-output-lufa-{time.strftime('%Y%m%d-%H%M%S', time.localtime())}" if not use_lufa:
SUFFIX = "_麓发迁移"
batch_input_dir_path = "jp-input"
batch_output_dir_path = f"/home/ccran/lufa-contract/data/benchmark/results/jp-output-lufa-{time.strftime('%Y%m%d-%H%M%S', time.localtime())}"
# 金盘fastgpt接口
url = "http://192.168.252.71:18088/api/v1/chat/completions"
# 金盘迁移麓发合同审查测试token
token = "fastgpt-vykT6qs07g7hR4tL2MNJE6DdNCIxaQjEu3Cxw9nuTBFg8MAG3CkByvnXKxSNEyMK7"
# 人机交互测试(测试环境)
# token = 'fastgpt-p189K5zoTX5wjp0dBybFCwsbWm3juIwlJxt2wTGyiaOWOANI5Y10pKEZzyt'
# 人机交互测试(生产环境)
# token = 'fastgpt-ry4jIjgNwmNgufMr5jR0ncvJVmSS4GZl4bx2ItsNPoncdQzW9Na3IP1Xrankr'
# 提取后审查测试
# token = 'fastgpt-n74gGX5ZqLT6o1ysMBSGUTjIciswYOWDRfQ75krMkE5gDVDkpzsbz8u'
else:
SUFFIX = "_麓发"
batch_input_dir_path = "lufa-input"
batch_output_dir_path = "lufa-output-standard"
# 麓发fastgpt接口
url = "http://192.168.252.71:18089/api/v1/chat/completions"
# 麓发合同审查生产token
# token = "fastgpt-ek3Z6PxI6sXgYc0jxzZ5bVGqrxwM6aVyfSmA6JVErJYBMr2KmYxrHwEUOIMSYz"
# 麓发合同审查生产token-标准化
token = "fastgpt-mg5tQUgreJeF7peoOr5zqP0NR4EIrfS2bEVXge6FUL94Suu1TvEMR1sGNRSiV"
# SUFFIX = "_麓发"
# batch_input_dir_path = "lufa-input"
# batch_output_dir_path = "lufa-output-standard"
batch_size = 5 batch_size = 5
# 麓发fastgpt接口
# url = "http://192.168.252.71:18089/api/v1/chat/completions"
# 金盘fastgpt接口
url = "http://192.168.252.71:18088/api/v1/chat/completions"
# 麓发合同审查生产token
# token = "fastgpt-ek3Z6PxI6sXgYc0jxzZ5bVGqrxwM6aVyfSmA6JVErJYBMr2KmYxrHwEUOIMSYz"
# 麓发合同审查生产token-标准化
# token = "fastgpt-mg5tQUgreJeF7peoOr5zqP0NR4EIrfS2bEVXge6FUL94Suu1TvEMR1sGNRSiV"
# 金盘迁移麓发合同审查测试token
token = "fastgpt-vykT6qs07g7hR4tL2MNJE6DdNCIxaQjEu3Cxw9nuTBFg8MAG3CkByvnXKxSNEyMK7"
# 人机交互测试(测试环境)
# token = 'fastgpt-p189K5zoTX5wjp0dBybFCwsbWm3juIwlJxt2wTGyiaOWOANI5Y10pKEZzyt'
# 人机交互测试(生产环境)
# token = 'fastgpt-ry4jIjgNwmNgufMr5jR0ncvJVmSS4GZl4bx2ItsNPoncdQzW9Na3IP1Xrankr'
# 提取后审查测试
# token = 'fastgpt-n74gGX5ZqLT6o1ysMBSGUTjIciswYOWDRfQ75krMkE5gDVDkpzsbz8u'
def extract_url(text): def extract_url(text):
...@@ -94,10 +99,16 @@ def process_single_file( ...@@ -94,10 +99,16 @@ def process_single_file(
excel_url, doc_url = extract_url(result) excel_url, doc_url = extract_url(result)
if excel_url and doc_url: if excel_url and doc_url:
download_file( download_file(
excel_url.replace("218.77.58.8", "192.168.252.71"), des_excel_file excel_url.replace("218.77.58.8", "192.168.252.71").replace(
"znkf.lgfzgroup.com", "192.168.252.71"
),
des_excel_file,
) )
download_file( download_file(
doc_url.replace("218.77.58.8", "192.168.252.71"), des_doc_file doc_url.replace("218.77.58.8", "192.168.252.71").replace(
"znkf.lgfzgroup.com", "192.168.252.71"
),
des_doc_file,
) )
logger.info( logger.info(
f"第{counter}个文件下载:{excel_url}到{des_excel_file} {des_doc_file}" f"第{counter}个文件下载:{excel_url}到{des_excel_file} {des_doc_file}"
......
...@@ -24,8 +24,19 @@ def _load_rows(path: Path) -> list[tuple[str, str]]: ...@@ -24,8 +24,19 @@ def _load_rows(path: Path) -> list[tuple[str, str]]:
for col in first_two.columns: for col in first_two.columns:
first_two[col] = first_two[col].map(_normalize_cell) first_two[col] = first_two[col].map(_normalize_cell)
first_two = first_two.replace("", pd.NA).dropna(how="all") first_two = first_two.replace("", pd.NA).dropna(how="all")
rows: list[tuple[str, str]] = []
seen: set[tuple[str, str]] = set()
for item, text in first_two.itertuples(index=False, name=None):
row = (
"" if pd.isna(item) else str(item).strip(),
"" if pd.isna(text) else str(text).strip(),
)
if row in seen:
continue
seen.add(row)
rows.append(row)
return list(map(tuple, first_two.itertuples(index=False, name=None))) return rows
def _compare_impl(val_dir: Path, answer_dir: Path) -> None: def _compare_impl(val_dir: Path, answer_dir: Path) -> None:
......
...@@ -121,7 +121,7 @@ def _parse_args() -> argparse.Namespace: ...@@ -121,7 +121,7 @@ def _parse_args() -> argparse.Namespace:
parser.add_argument( parser.add_argument(
"--datasets-dir", "--datasets-dir",
type=Path, type=Path,
default=base / "results" / "jp-output-lufa-20260408-182708", default=base / "results" / "jp-output-lufa-20260416-000112",
help="Directory containing Word files with annotations.", help="Directory containing Word files with annotations.",
) )
parser.add_argument( parser.add_argument(
......
No preview for this file type
...@@ -394,9 +394,7 @@ def merge_segment_findings(payload: MergerRequest) -> MergerResponse: ...@@ -394,9 +394,7 @@ def merge_segment_findings(payload: MergerRequest) -> MergerResponse:
unqualified_findings = [ unqualified_findings = [
f for f in segment_findings if (f.result or "").strip() == "不合格" f for f in segment_findings if (f.result or "").strip() == "不合格"
] ]
merged_result = merger_tool.run( merged_result = merger_tool.run([f.__dict__ for f in unqualified_findings])
[f.__dict__ for f in unqualified_findings], merge_mode="rule"
)
merged_findings = merged_result.get("findings", []) or [] merged_findings = merged_result.get("findings", []) or []
for f in merged_findings: for f in merged_findings:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment