mirror of
https://github.com/ZTatman/Nadir.git
synced 2026-11-20 12:03:30 +00:00
- Move all Python source files into backend/ directory - Fix db.py: use absolute path (Path(__file__).parent) for chroma_db so the DB is always found regardless of where the server is launched from - Fix store.py: guard test entry under if __name__ == "__main__" to prevent duplicate inserts on every import - Fix query.py: extract query_entries(question) -> str function and move interactive loop under __main__ guard so it can be imported cleanly by FastAPI without blocking on input() - Add .claude/launch.json with FastAPI dev server configuration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
964 B
Python
34 lines
964 B
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
|
|
class MoodTag:
|
|
def __init__(self, name: str, intensity: int) -> None:
|
|
self.name = name
|
|
self.intensity = intensity
|
|
|
|
def __repr__(self) -> str:
|
|
return f"MoodTag(name='{self.name}', intensity={self.intensity})"
|
|
|
|
|
|
class JournalEntry:
|
|
def __init__(
|
|
self,
|
|
id: str,
|
|
timestamp: datetime,
|
|
transcript: str,
|
|
moods: Optional[list[MoodTag]] = None,
|
|
tags: Optional[list[str]] = None,
|
|
summary: Optional[str] = None,
|
|
) -> None:
|
|
self.id = id
|
|
self.timestamp = timestamp
|
|
self.transcript = transcript
|
|
self.moods = moods if moods is not None else []
|
|
self.tags = tags if tags is not None else []
|
|
self.summary = summary
|
|
|
|
def __repr__(self) -> str:
|
|
return f"JournalEntry(id='{self.id}', timestamp={self.timestamp}, moods={self.moods})"
|