6d2edc6753
Remove all local PDF/OCR extraction and quality gate logic from review_service.py, replacing it with calls to the shared-ai-platform document extraction service via the SDK. Removed from review_service.py: - 17 local PDF/OCR methods (_extract_text_from_pdf, _classify_pdf_source, _extract_text_from_pdf_with_ocr, _extract_text_from_image_with_ocr, _evaluate_ocr_quality, _looks_like_platform_review_report, etc.) - All PDF/OCR constants (PDF_TEXT_PATTERN, PDF_NOISE_LINE_PATTERN, REPORT_PDF_MARKERS, OCR_GATE_*, PDF_SOURCE_KIND_*, etc.) - Imports: pdfplumber, pypdfium2, pytesseract, PIL.Image Added: - extract_review_upload_text() now calls shared platform's client.extract_document_text() directly - _detect_upload_type() retained locally for upload validation only - Protocol methods extract_document_text, classify_pdf_source in client Removed from requirements.txt: pdfplumber, pytesseract Added to config: shared_ai_platform_document_extraction_enabled Also includes prior changes: - Model settings and chat history stabilization - Mobile UI polish - Governance launch-closure enhancements Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
52 lines
2.2 KiB
Python
52 lines
2.2 KiB
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_name: str = "AI Contract Platform"
|
|
app_env: str = "development"
|
|
api_v1_prefix: str = "/api/v1"
|
|
review_pdf_ocr_enabled: bool = True
|
|
review_pdf_ocr_languages: str = "chi_sim+eng"
|
|
review_pdf_ocr_max_pages: int = 6
|
|
review_pdf_ocr_render_scale: float = 2.0
|
|
review_pdf_ocr_block_min_chars: int = 40
|
|
review_pdf_ocr_warn_min_chars: int = 120
|
|
review_pdf_ocr_block_min_confidence: float = 45.0
|
|
review_pdf_ocr_warn_min_confidence: float = 70.0
|
|
review_pdf_ocr_warn_max_noise_ratio: float = 0.18
|
|
review_pdf_ocr_block_max_noise_ratio: float = 0.35
|
|
shared_ai_platform_base_url: str = ""
|
|
shared_ai_platform_api_prefix: str = "/api/v0.2"
|
|
shared_ai_platform_app_id: str = "ai-contract-platform"
|
|
shared_ai_platform_api_key: str = ""
|
|
shared_ai_platform_timeout_seconds: float = 30.0
|
|
shared_ai_platform_legal_review_enabled: bool = True
|
|
shared_ai_platform_legal_review_fallback_to_local: bool = False
|
|
shared_ai_platform_document_extraction_enabled: bool = True
|
|
prompt_golden_eval_mode: str = "auto"
|
|
prompt_golden_eval_include_raw_model_response: bool = False
|
|
legal_change_impact_semantic_enabled: bool = True
|
|
legal_change_impact_semantic_threshold: float = 0.10
|
|
legal_change_impact_worker_enabled: bool = True
|
|
legal_change_impact_worker_batch_size: int = 10
|
|
legal_change_impact_worker_interval_seconds: int = 300
|
|
legal_change_impact_worker_user_id: str = "system-legal-change-worker"
|
|
secret_key: str = "change-me"
|
|
access_token_expire_minutes: int = 120
|
|
database_url: str = "postgresql+psycopg://postgres:postgres@localhost:5432/ai_contract_platform"
|
|
redis_url: str = "redis://localhost:6379/0"
|
|
minio_endpoint: str = "localhost:9000"
|
|
minio_access_key: str = "minioadmin"
|
|
minio_secret_key: str = "minioadmin"
|
|
minio_bucket: str = "contracts"
|
|
minio_secure: bool = False
|
|
file_storage_backend: str = "minio"
|
|
local_storage_dir: str = str(Path(__file__).resolve().parents[2] / "storage")
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
|
|
|
|
settings = Settings()
|