fix: Phase 2 버그 픽스 — JP 번역, API 서버, AppleScript 경로
- pkm_utils.py: strip_thinking() 추가 + llm_generate() no_think 옵션
- <think> 태그 제거 + thinking 패턴("Wait,", "Let me" 등) 필터링
- enable_thinking: false 파라미터 지원
- law_monitor.py: JP 번역 호출에 no_think=True 적용
- pkm_api_server.py: /devonthink/stats 최적화 (children 순회 → count 사용)
+ /devonthink/search 한글 쿼리 이스케이프 수정
- auto_classify.scpt: baseDir property로 경로 변수화
- omnifocus_sync.scpt: 로그 경로 변수화
인프라: MailPlus IMAP HOST → LAN IP(192.168.1.227)로 변경
참고: 한국 법령 API IP(122.153.226.74) open.law.go.kr 등록 필요
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,14 @@
|
||||
-- Inbox DB 새 문서 → OCR 전처리 → MLX 분류 → 태그 + 메타데이터 + 도메인 DB 이동 → Qdrant 임베딩
|
||||
-- Smart Rule 설정: Event = On Import, 조건 = Tags is empty
|
||||
|
||||
property baseDir : "Documents/code/DEVONThink_my server"
|
||||
|
||||
on performSmartRule(theRecords)
|
||||
set homeDir to POSIX path of (path to home folder)
|
||||
set pkmRoot to homeDir & baseDir
|
||||
set venvPython to pkmRoot & "/venv/bin/python3"
|
||||
set logFile to pkmRoot & "/logs/auto_classify.log"
|
||||
|
||||
tell application id "DNtp"
|
||||
repeat with theRecord in theRecords
|
||||
try
|
||||
@@ -13,16 +20,15 @@ on performSmartRule(theRecords)
|
||||
|
||||
if docText is "" then
|
||||
if docType is in {"PDF Document", "JPEG image", "PNG image", "TIFF image"} then
|
||||
set ocrScript to (POSIX path of (path to home folder)) & "Documents/code/DEVONThink_my server/venv/bin/python3"
|
||||
set ocrPy to (POSIX path of (path to home folder)) & "Documents/code/DEVONThink_my server/scripts/ocr_preprocess.py"
|
||||
set ocrPy to pkmRoot & "/scripts/ocr_preprocess.py"
|
||||
try
|
||||
set ocrText to do shell script ocrScript & " " & quoted form of ocrPy & " " & quoted form of docUUID
|
||||
set ocrText to do shell script venvPython & " " & quoted form of ocrPy & " " & quoted form of docUUID
|
||||
if length of ocrText > 0 then
|
||||
set plain text of theRecord to ocrText
|
||||
set docText to ocrText
|
||||
end if
|
||||
on error ocrErr
|
||||
do shell script "echo '[OCR ERROR] " & ocrErr & "' >> ~/Documents/code/DEVONThink_my\\ server/logs/auto_classify.log"
|
||||
do shell script "echo '[OCR ERROR] " & ocrErr & "' >> " & quoted form of logFile
|
||||
end try
|
||||
end if
|
||||
end if
|
||||
@@ -39,7 +45,7 @@ on performSmartRule(theRecords)
|
||||
end if
|
||||
|
||||
-- 2. 분류 프롬프트 로딩
|
||||
set promptPath to (POSIX path of (path to home folder)) & "Documents/code/DEVONThink_my server/scripts/prompts/classify_document.txt"
|
||||
set promptPath to pkmRoot & "/scripts/prompts/classify_document.txt"
|
||||
set promptTemplate to do shell script "cat " & quoted form of promptPath
|
||||
|
||||
-- 문서 텍스트를 프롬프트에 삽입 (특수문자 이스케이프)
|
||||
@@ -105,14 +111,13 @@ except:
|
||||
end if
|
||||
|
||||
-- 8. GPU 서버 벡터 임베딩 비동기 전송
|
||||
set embedScript to (POSIX path of (path to home folder)) & "Documents/code/DEVONThink_my server/venv/bin/python3"
|
||||
set embedPy to (POSIX path of (path to home folder)) & "Documents/code/DEVONThink_my server/scripts/embed_to_qdrant.py"
|
||||
do shell script embedScript & " " & quoted form of embedPy & " " & quoted form of docUUID & " &> /dev/null &"
|
||||
set embedPy to pkmRoot & "/scripts/embed_to_qdrant.py"
|
||||
do shell script venvPython & " " & quoted form of embedPy & " " & quoted form of docUUID & " &> /dev/null &"
|
||||
|
||||
on error errMsg
|
||||
-- 에러 시 로그 기록 + 검토필요 태그
|
||||
set tags of theRecord to {"@상태/검토필요", "AI분류실패"}
|
||||
do shell script "echo '[" & (current date) & "] [auto_classify] [ERROR] " & errMsg & "' >> ~/Documents/code/DEVONThink_my\\ server/logs/auto_classify.log"
|
||||
do shell script "echo '[" & (current date) & "] [auto_classify] [ERROR] " & errMsg & "' >> " & quoted form of logFile
|
||||
end try
|
||||
end repeat
|
||||
end tell
|
||||
|
||||
Reference in New Issue
Block a user