8fdea88676
plan: ~/.claude/plans/luminous-sprouting-hamster.md §1
- migrations/143_category.sql: doc_category enum (6 활성 + 3 유보) +
documents.category + documents.ai_suggestion JSONB + 2 idx.
- app/models/document.py: category (Enum, create_type=False), ai_suggestion (JSONB).
- app/prompts/classify.txt: document_type enum 에 7 실무 doctype 추가
(발주서/세금계산서/명세표/도면/증명서/계획서/시방서) + facet_doctype
필드 directive.
- config.yaml: document_types 에 7 항목 추가 (worker 검증 통과).
- app/workers/classify_worker.py: FACET_DOCTYPES / LIBRARY_SUGGESTION_DOCTYPES
상수, facet_doctype 파싱(기존값 미덮어씀), 발주서/세금계산서/명세표
감지 시 ai_suggestion={proposed_category=library, proposed_path=@library/
거래/{YYYY}/{doctype}, source_updated_at=doc.updated_at.isoformat(), ...}.
category / user_tags 자동 전이 금지 (suggestion-only).
- app/api/documents.py:
· DocumentResponse 에 category / ai_suggestion 노출
· GET /documents ?category=<cat> / ?has_suggestion / ?proposed_category
(category 지정 시 기본 news/memo 제외 해제 — §2 승인 UI 계약)
· GET /documents/library 를 Document.category=='library' 기반으로 재구현
(path subquery 는 user_tags 유지 — 분류 내부 서가 경로)
· POST /documents/{id}/accept-suggestion — FOR UPDATE + idempotent no-op +
dual 409 stale (payload source_updated_at / documents.updated_at) +
user_tags idempotent append
· DELETE /documents/{id}/suggestion — idempotent, stale 검사 없음
- scripts/backfill_category.py: dry-run / apply. 매핑(news/memo/@library/else)
+ 3-way 상대 검증 (all_rows==categorized, uncategorized==0,
cat_library==has_library_tag — 자동 전이 금지 정책 검증).
남은 DoD (원격 배포 후): docker compose up → migration 143 적용 → backfill
apply → smoke (drive_sync 발주서 업로드 suggestion 생성 / category 유지,
accept-suggestion idempotency + 409 stale 두 벡터, /documents?category=library
== /documents/library 건수 일치).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
129 lines
3.6 KiB
YAML
129 lines
3.6 KiB
YAML
# hyungi_Document_Server 설정
|
|
|
|
ai:
|
|
gateway:
|
|
endpoint: "http://ai-gateway:8080"
|
|
|
|
models:
|
|
primary:
|
|
endpoint: "http://100.76.254.116:8801/v1/chat/completions"
|
|
model: "mlx-community/gemma-4-26b-a4b-it-8bit"
|
|
max_tokens: 4096
|
|
timeout: 60
|
|
|
|
fallback:
|
|
endpoint: "http://ollama:11434/v1/chat/completions"
|
|
model: "qwen3.5:9b-q8_0"
|
|
max_tokens: 4096
|
|
timeout: 120
|
|
|
|
premium:
|
|
endpoint: "https://api.anthropic.com/v1/messages"
|
|
model: "claude-sonnet-4-20250514"
|
|
max_tokens: 8192
|
|
daily_budget_usd: 5.00
|
|
require_explicit_trigger: true
|
|
|
|
embedding:
|
|
endpoint: "http://ollama:11434/api/embeddings"
|
|
model: "bge-m3"
|
|
|
|
vision:
|
|
endpoint: "http://ollama:11434/api/generate"
|
|
model: "Qwen2.5-VL-7B"
|
|
|
|
rerank:
|
|
endpoint: "http://ollama:11434/api/rerank"
|
|
model: "bge-reranker-v2-m3"
|
|
# Phase 3.5a: exaone answerability classifier (GPU Ollama, concurrent OK)
|
|
classifier:
|
|
endpoint: "http://ollama:11434/v1/chat/completions"
|
|
model: "exaone3.5:7.8b-instruct-q8_0"
|
|
max_tokens: 512
|
|
timeout: 10
|
|
|
|
nas:
|
|
mount_path: "/documents"
|
|
pkm_root: "/documents/PKM"
|
|
|
|
# ─── 업로드 한도 정책 (authoritative) ───
|
|
# 프록시(home-caddy 등) request_body 한도는 max_bytes * content_length_slack_ratio 이상 유지.
|
|
upload:
|
|
max_bytes: 100000000 # 100 MB (SI). 업로드 실제 제한의 단일 진실 공급원.
|
|
content_length_slack_ratio: 1.05 # multipart form 오버헤드(헤더/바운더리) 여유.
|
|
stream_chunk_bytes: 1048576 # 1 MiB 단위 스트리밍 read/write.
|
|
|
|
# ─── 문서 분류 체계 ───
|
|
taxonomy:
|
|
Philosophy:
|
|
Ethics: []
|
|
Metaphysics: []
|
|
Epistemology: []
|
|
Logic: []
|
|
Aesthetics: []
|
|
Eastern_Philosophy: []
|
|
Western_Philosophy: []
|
|
Language:
|
|
Korean: []
|
|
English: []
|
|
Japanese: []
|
|
Translation: []
|
|
Linguistics: []
|
|
Engineering:
|
|
Mechanical: [Piping, HVAC, Equipment]
|
|
Electrical: [Power, Instrumentation]
|
|
Chemical: [Process, Material]
|
|
Civil: []
|
|
Network: [Server, Security, Infrastructure]
|
|
Industrial_Safety:
|
|
Legislation: [Act, Decree, Foreign_Law, Korea_Law_Archive, Enforcement_Rule, Public_Notice, SAPA]
|
|
Theory: [Industrial_Safety_General, Safety_Health_Fundamentals]
|
|
Academic_Papers: [Safety_General, Risk_Assessment_Research]
|
|
Cases: [Domestic, International]
|
|
Practice: [Checklist, Contractor_Management, Safety_Education, Emergency_Plan, Patrol_Inspection, Permit_to_Work, PPE, Safety_Plan]
|
|
Risk_Assessment: [KRAS, JSA, Checklist_Method]
|
|
Safety_Manager: [Appointment, Duty_Record, Improvement, Inspection, Meeting]
|
|
Health_Manager: [Appointment, Duty_Record, Ergonomics, Health_Checkup, Mental_Health, MSDS, Work_Environment]
|
|
Programming:
|
|
Programming_Language: [Python, JavaScript, Go, Rust]
|
|
Framework: [FastAPI, SvelteKit, React]
|
|
DevOps: [Docker, CI_CD, Linux_Administration]
|
|
AI_ML: [Large_Language_Model, Computer_Vision, Data_Science]
|
|
Database: []
|
|
Software_Architecture: []
|
|
General:
|
|
Reading_Notes: []
|
|
Self_Development: []
|
|
Business: []
|
|
Science: []
|
|
History: []
|
|
|
|
document_types:
|
|
- Reference
|
|
- Standard
|
|
- Manual
|
|
- Drawing
|
|
- Template
|
|
- Note
|
|
- Academic_Paper
|
|
- Law_Document
|
|
- Report
|
|
- Memo
|
|
- Checklist
|
|
- Meeting_Minutes
|
|
- Specification
|
|
- 발주서
|
|
- 세금계산서
|
|
- 명세표
|
|
- 도면
|
|
- 증명서
|
|
- 계획서
|
|
- 시방서
|
|
|
|
schedule:
|
|
law_monitor: "07:00"
|
|
mailplus_archive: ["07:00", "18:00"]
|
|
daily_digest: "20:00"
|
|
file_watcher_interval_minutes: 5
|
|
queue_consumer_interval_minutes: 10
|