- ai-service: Ollama 기반 AI 서비스 (분류, 시맨틱 검색, RAG Q&A, 패턴 분석) - AI 어시스턴트 페이지: 채팅형 Q&A, 시맨틱 검색, 패턴 분석, 분류 테스트 - 권한 시스템에 ai_assistant 페이지 등록 (기본 비활성) - 기존 페이지에 AI 기능 통합 (대시보드, 수신함, 관리함) - docker-compose, gateway, nginx 설정 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
import sqlite3
|
|
from config import settings
|
|
|
|
|
|
class MetadataStore:
|
|
def __init__(self):
|
|
self.db_path = settings.METADATA_DB_PATH
|
|
|
|
def initialize(self):
|
|
conn = sqlite3.connect(self.db_path)
|
|
conn.execute(
|
|
"CREATE TABLE IF NOT EXISTS sync_state ("
|
|
" key TEXT PRIMARY KEY,"
|
|
" value TEXT"
|
|
")"
|
|
)
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
def get_last_synced_id(self) -> int:
|
|
conn = sqlite3.connect(self.db_path)
|
|
cur = conn.execute(
|
|
"SELECT value FROM sync_state WHERE key = 'last_synced_id'"
|
|
)
|
|
row = cur.fetchone()
|
|
conn.close()
|
|
return int(row[0]) if row else 0
|
|
|
|
def set_last_synced_id(self, issue_id: int):
|
|
conn = sqlite3.connect(self.db_path)
|
|
conn.execute(
|
|
"INSERT OR REPLACE INTO sync_state (key, value) VALUES ('last_synced_id', ?)",
|
|
(str(issue_id),),
|
|
)
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
|
|
metadata_store = MetadataStore()
|