Files
DungeonsDragons/backend/app/alembic/versions/b8e4f1a9c203_add_character_abilities_fields.py
Thorsten 624644619c Add character detail, markdown rendering, wider layout, and LLM provider switch
- 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>
2026-09-01 15:18:15 +02:00

49 lines
1.2 KiB
Python

"""add character combat_stats, abilities, equipment fields
Revision ID: b8e4f1a9c203
Revises: 7c3f9a2e1d44
Create Date: 2026-09-01 10:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = 'b8e4f1a9c203'
down_revision: Union[str, None] = '7c3f9a2e1d44'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
'characters',
sa.Column(
'combat_stats', postgresql.JSONB(astext_type=sa.Text()), nullable=False,
server_default='{}',
),
)
op.add_column(
'characters',
sa.Column(
'abilities', postgresql.JSONB(astext_type=sa.Text()), nullable=False,
server_default='[]',
),
)
op.add_column(
'characters',
sa.Column(
'equipment', postgresql.JSONB(astext_type=sa.Text()), nullable=False,
server_default='[]',
),
)
def downgrade() -> None:
op.drop_column('characters', 'equipment')
op.drop_column('characters', 'abilities')
op.drop_column('characters', 'combat_stats')