Files
syn-chat-bot/heic_converter.py
hyungi 612933c2d3 Phase 5-6: API usage tracking + Calendar/Mail/DEVONthink/OmniFocus/News pipeline
- 파이프라인 42→51노드 확장 (calendar/mail/note 핸들러 추가)
- 네이티브 서비스 6개: heic_converter(:8090), chat_bridge(:8091),
  caldav_bridge(:8092), devonthink_bridge(:8093), inbox_processor, news_digest
- 분류기 v2→v3: calendar, reminder, mail, note intent 추가
- Mail Processing Pipeline (7노드, IMAP 폴링)
- LaunchAgent plist 6개 + manage_services.sh
- migrate-v3.sql: news_digest_log + calendar_events 확장
- 개발 문서 현행화 (CLAUDE.md, QUICK_REFERENCE.md, docs/architecture.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 17:09:04 +09:00

26 lines
832 B
Python

from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
import subprocess, tempfile, base64, os
app = FastAPI()
@app.post("/convert/heic-to-jpeg")
async def convert(request: Request):
body = await request.json()
with tempfile.TemporaryDirectory() as tmpdir:
heic_path = os.path.join(tmpdir, "input.heic")
jpeg_path = os.path.join(tmpdir, "output.jpg")
with open(heic_path, "wb") as f:
f.write(base64.b64decode(body["base64"]))
subprocess.run(
["sips", "-s", "format", "jpeg", heic_path, "--out", jpeg_path],
capture_output=True, timeout=30, check=True
)
with open(jpeg_path, "rb") as f:
jpeg_b64 = base64.b64encode(f.read()).decode()
return JSONResponse({"base64": jpeg_b64, "format": "jpeg"})