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>
This commit is contained in:
Thorsten
2026-09-01 15:18:15 +02:00
parent ec53ed3aba
commit 624644619c
26 changed files with 1503 additions and 119 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import { FormEvent, useEffect, useRef, useState } from "react";
import { createGame, Game, GameSetupProposal, runGameSetupChat } from "../api/games";
import MarkdownContent from "./MarkdownContent";
import SendMessageForm from "./SendMessageForm";
interface DisplayTurn {
@@ -94,8 +95,8 @@ export default function GameSetupChat({ onCreated }: { onCreated: (game: Game) =
}
>
{turn.role === "assistant" ? "Dungeon Master" : "Du"}:
</span>{" "}
<span className="whitespace-pre-wrap">{turn.content}</span>
</span>
<MarkdownContent content={turn.content} />
</div>
))}
{loading && <p className="text-sm text-slate-500">Der Dungeon Master überlegt…</p>}
@@ -0,0 +1,9 @@
import ReactMarkdown from "react-markdown";
export default function MarkdownContent({ content }: { content: string }) {
return (
<div className="prose prose-sm prose-invert max-w-none prose-p:my-1 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-headings:my-1">
<ReactMarkdown>{content}</ReactMarkdown>
</div>
);
}
+3 -2
View File
@@ -1,6 +1,7 @@
import { useEffect, useRef } from "react";
import { Message } from "../api/games";
import MarkdownContent from "./MarkdownContent";
function senderLabel(message: Message): string {
if (message.sender_type === "dm") return "Dungeon Master";
@@ -36,8 +37,8 @@ export default function TranscriptPane({
}
>
{senderLabel(m)}:
</span>{" "}
<span className="whitespace-pre-wrap">{m.content}</span>
</span>
<MarkdownContent content={m.content} />
</div>
))}
{typing && (