- 스킬앱 HTML 내장화: accountant/lawyer/investor/weather/music/mind/dental-agent 각 앱이 SKILL_CONTENT를 HTML에 직접 내장 → .smallclaw/skills/ SKILL.md 파일 제거 - 새 게이트웨이 라우트: routes-dental, routes-music, routes-mcp, routes-voice - skillContext 서버 지원: /api/chat에서 skill 컨텍스트를 callerCtx로 주입 - 세션 삭제 API: DELETE /api/admin/sessions/:username/:id - Telegram defaultUsername: 어드민 계정 자동 추론 - Ollama /api/ollama/models에 vision 지원 여부 플래그 추가 - DB 워크플로 개선: workflow_images.py 대규모 리팩터링 - 아두이노 에뮬레이터 추가 개선 (arduino-emulator.html +400줄) - 우즈베크어 학습 콘텐츠 및 MIDI 파일 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
2.1 KiB
Python
56 lines
2.1 KiB
Python
"""Shared configuration for the dental dictionary project.
|
|
|
|
All paths and service endpoints live here so the workflow scripts never
|
|
hard-code absolute paths. Everything is derived from this file's own
|
|
location, so the project directory can be moved without edits.
|
|
"""
|
|
|
|
import os
|
|
|
|
# --- Directories -----------------------------------------------------------
|
|
HERE = os.path.dirname(os.path.abspath(__file__)) # .smallclaw/databases
|
|
SMALLCLAW = os.path.abspath(os.path.join(HERE, "..")) # .smallclaw
|
|
HOMECLAW = os.path.abspath(os.path.join(SMALLCLAW, "..")) # repo root
|
|
|
|
DB_PATH = os.path.join(HERE, "dental_dict.db")
|
|
IMG_BASE = os.path.join(HERE, "dental_images")
|
|
SEEDS_DIR = os.path.join(HERE, "seeds")
|
|
|
|
# Images are served by the gateway under /api/files/dental_images/...
|
|
# The gateway maps /api/files/ → .smallclaw/databases/
|
|
IMG_URL_PREFIX = "/api/files/dental_images"
|
|
|
|
# --- Image validation (Ollama) --------------------------------------------
|
|
OLLAMA_URL = "http://127.0.0.1:11434/api/chat"
|
|
# kimi-k2.6:cloud — vision 실제 작동 확인(2026-05-17). qwen3.5:397b-cloud는
|
|
# 이미지 입력을 받아도 실제 내용을 읽지 못함(테스트 확인).
|
|
VERIFY_MODEL = "kimi-k2.6:cloud"
|
|
|
|
# --- API key files ---------------------------------------------------------
|
|
# Kept under .smallclaw/ and git-ignored. Each file holds a single key.
|
|
ROBOFLOW_API_KEY_FILE = os.path.join(SMALLCLAW, "roboflow_api_key.txt")
|
|
HUGGINGFACE_API_KEY_FILE = os.path.join(SMALLCLAW, "huggingface_api_key.txt")
|
|
KAGGLE_API_TOKEN_FILE = os.path.join(SMALLCLAW, "kaggle_api_token.txt")
|
|
|
|
|
|
def connect_db():
|
|
"""Open dental_dict.db with WAL mode and busy_timeout.
|
|
|
|
WAL allows concurrent reads while writing, preventing chat freeze
|
|
when background image chains hold write locks.
|
|
"""
|
|
import sqlite3
|
|
conn = sqlite3.connect(DB_PATH)
|
|
conn.execute("PRAGMA journal_mode=WAL")
|
|
conn.execute("PRAGMA busy_timeout=5000")
|
|
return conn
|
|
|
|
|
|
def read_key(path):
|
|
"""Return the trimmed contents of an API key file, or None if missing."""
|
|
try:
|
|
with open(path, encoding="utf-8") as f:
|
|
return f.read().strip()
|
|
except FileNotFoundError:
|
|
return None
|