import platform
from dataclasses import dataclass

# 可配置运行参数
use_docker = False


# @dataclass
# class LLMConfig:
#     base_url: str = "https://api.deepseek.com/v1"
#     api_key: str = "sk-3df81e63afe44ca39cbd7108d59bc91a"
#     model: str = "deepseek-v4-pro"


@dataclass
class LLMConfig:
    base_url: str = "http://192.168.252.71:9002/v1"
    api_key: str = "none"
    model: str = "Qwen2-72B-Instruct"


# MAX_SINGLE_CHUNK_SIZE=100000
MERGE_RULE_PROMPT = False
MAX_SINGLE_CHUNK_SIZE = 5000
META_KEY = "META"
DEFAULT_RULESET_ID = "通用"
## 规则集ID列表，需与rules.xlsx中的sheet名称保持一致!!!
ALL_RULESET_IDS = [
    "通用",
    "借款",
    "担保",
    "财务口",
    "金盘",
    "金盘简化",
    "麓发测试",
    "麓发标准",
    "金盘B类",
    "合同信息提取（合同组）",
    "合同信息提取（技术部）",
    "合同信息提取（采购部）",
    "技术协议提取（合同组）",
    "技术协议提取（技术部）",
]
MAX_WORKERS = 10
FILE_SUFFIX = "-审核批注"

## 关键参数**
use_non_fastgpt_llm = False
use_lufa = False
use_jp_machine = True

## 关键参数**
ocr_url = 'http://192.168.252.71:8202/openapi/ocrUploadFile'
if use_lufa:
    outer_backend_url = "http://znkf.lgfzgroup.com:48081"
    base_fastgpt_url = "http://192.168.252.71:18089"
    base_backend_url = "http://192.168.252.71:48081"
    segment_review_api_key = (
        "fastgpt-zMavJKKgqA9jRNHLXxzXCVZx1JXxfuNkH1p2qfLhtPfMp41UvdSQvt8"
    )
    reflect_retry_api_key = (
        "fastgpt-ao3al2vgfnArt9qi2bTpPeRHouCO7qngUZiQsIM1E2x91u22z65J"
    )
else:
    if not use_jp_machine:
        outer_backend_url = "http://218.77.58.8:48080"
        base_fastgpt_url = "http://192.168.252.71:18088"
        base_backend_url = "http://192.168.252.71:48080"
    else:
        outer_backend_url = "http://172.21.107.45:48080"
        base_fastgpt_url = "http://172.21.107.45:3030"
        base_backend_url = "http://172.21.107.45:48080"
        ocr_url = "http://172.21.107.45:8202/openapi/ocrUploadFile"
    segment_review_api_key = (
        "fastgpt-vLu2JHAfqwEq5FUQhvATFDK0yDS6fs804v7KwWBMyU4sRrHzh4UGl89Zpa"
    )
    reflect_retry_api_key = (
        "fastgpt-abxzi4CC7SGuVdxDVFmhAFFQHqi6owK5YsIfXdvOMEAcpIhZWDPObTz2Xn"
    )

# 项目根目录
root_path = r"E:\PycharmProject\contract_review_agent"
system = platform.system()
if system == "Linux":
    # root_path = "/data/home/ccran/contract_review_agent"
    root_path = "/home/ccran/contract_review_agent"
elif system == "Darwin":
    root_path = "/Users/chenran/PycharmProjects/contract_review_agent"
# docker设置
if use_docker:
    root_path = "/app"
LLM = {
    "base_tool_llm": LLMConfig(),
    "fastgpt_segment_review": (
        LLMConfig()
        if use_non_fastgpt_llm
        else LLMConfig(
            base_url=f"{base_fastgpt_url}/api/v1", api_key=segment_review_api_key
        )
    ),
    "fastgpt_reflect_retry": (
        LLMConfig()
        if use_non_fastgpt_llm
        else LLMConfig(
            base_url=f"{base_fastgpt_url}/api/v1", api_key=reflect_retry_api_key
        )
    ),
}
doc_support_formats = [".docx", ".doc", ".wps"]
pdf_support_formats = [".txt", ".md", ".pdf"]
# 最大分片数量
min_single_chunk_size = 2000
max_single_chunk_size = 20000
max_chunk_page = 10
