624644619c
- Character sheets gain structured combat_stats, abilities (name + plain-language explanation), and equipment fields, populated by the upsert_character_sheet tool; the detail page renders them as their own sections instead of one prose block, with a player-card-style attribute grid (full ability names + modifiers). - Fix double-escaped unicode occasionally left in tool-call JSON arguments (a model quirk) and stop the app's own json.dumps calls from re-introducing it (ensure_ascii=False). - Render chat messages as markdown (react-markdown + Tailwind typography) instead of raw text, and widen the games/characters/ chat layout to use more of the screen on desktop. - Sharpen the DM system prompt: state the ability + DC for each offered action option before the player commits, and narrate rolls as DC → result → pass/fail before the story consequence; also stop re-asking Session-0 questions already answered in the game's name/description. - Make the DM's LLM provider configurable (xai default, lmstudio for a local OpenAI-compatible server via host.docker.internal) instead of hardcoded to x.ai. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import ForeignKey, Integer, String, Text, func
|
|
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db import Base
|
|
|
|
|
|
class Character(Base):
|
|
__tablename__ = "characters"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
|
|
)
|
|
owner_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), ForeignKey("users.id"), nullable=False, index=True
|
|
)
|
|
name: Mapped[str] = mapped_column(String(length=200), nullable=False)
|
|
race: Mapped[str | None] = mapped_column(String(length=100), nullable=True)
|
|
char_class: Mapped[str | None] = mapped_column(String(length=100), nullable=True)
|
|
level: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
|
stats: Mapped[dict] = mapped_column(JSONB, nullable=False, default=dict)
|
|
description: Mapped[str] = mapped_column(Text, nullable=False, default="")
|
|
combat_stats: Mapped[dict] = mapped_column(JSONB, nullable=False, default=dict)
|
|
abilities: Mapped[list] = mapped_column(JSONB, nullable=False, default=list)
|
|
equipment: Mapped[list] = mapped_column(JSONB, nullable=False, default=list)
|
|
created_at: Mapped[datetime] = mapped_column(server_default=func.now(), nullable=False)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
server_default=func.now(), onupdate=func.now(), nullable=False
|
|
)
|