Features: - Context-aware response generator for storyteller - Select multiple characters to include in context - Generate scene descriptions or individual responses - Individual responses auto-parsed and sent to each character - Improved prompt with explicit [CharacterName] format - Smart context building with character profiles and history - Demo session auto-creation on startup - Pre-configured 'The Cursed Tavern' adventure - Two characters: Bargin (Dwarf Warrior) and Willow (Elf Ranger) - Quick-access buttons on home page - Eliminates need to recreate test data - Session ID copy button for easy sharing Bug Fixes: - Fixed character chat history showing only most recent message - CharacterView now handles both 'storyteller_response' and 'new_message' - Fixed all Pydantic deprecation warnings - Replaced .dict() with .model_dump() (9 instances) - Fixed WebSocket manager reference in contextual responses UI Improvements: - Beautiful demo section with gradient styling - Format help text for individual responses - Improved messaging and confirmations Documentation: - CONTEXTUAL_RESPONSE_FEATURE.md - Complete feature documentation - DEMO_SESSION.md - Demo session guide - FIXES_SUMMARY.md - Bug fix summary - PROMPT_IMPROVEMENTS.md - Prompt engineering details
8.3 KiB
🎲 Demo Session - "The Cursed Tavern"
Pre-configured test session for quick development and testing
Quick Access
When you start the server, a demo session is automatically created with:
- Session ID:
demo-session-001 - Session Name: "The Cursed Tavern"
- 2 Pre-configured Characters
- Starting Scene & Adventure Hook
How to Use
From the Home Page (Easiest)
Three big colorful buttons appear at the top:
- 🎲 Join as Storyteller - Opens storyteller dashboard
- ⚔️ Play as Bargin (Dwarf Warrior) - Opens character view as Bargin
- 🏹 Play as Willow (Elf Ranger) - Opens character view as Willow
Just click and you're in!
Manual Access
If you want to manually enter the session:
As Storyteller:
- Session ID:
demo-session-001
As Bargin:
- Session ID:
demo-session-001 - Character ID:
char-bargin-001
As Willow:
- Session ID:
demo-session-001 - Character ID:
char-willow-002
Characters
Bargin Ironforge ⚔️
Race: Dwarf
Class: Warrior
Personality: Brave but reckless. Loves a good fight and a strong ale. Quick to anger but fiercely loyal to companions.
Description: A stout dwarf warrior with a braided red beard and battle-scarred armor. Carries a massive war axe named 'Grudgekeeper'.
Character ID: char-bargin-001
LLM Model: GPT-3.5 Turbo
Willow Moonwhisper 🏹
Race: Elf
Class: Ranger
Personality: Cautious and observant. Prefers to scout ahead and avoid unnecessary conflict. Has an affinity for nature and animals.
Description: An elven ranger with silver hair and piercing green eyes. Moves silently through shadows, bow always at the ready.
Character ID: char-willow-002
LLM Model: GPT-3.5 Turbo
The Adventure
Scenario: The Cursed Tavern
The village of Millhaven has a problem. The old Rusty Flagon tavern, once a cheerful gathering place, has become a source of terror. Locals report:
- Ghostly figures moving through the windows
- Unearthly screams echoing from within
- Eerie green light flickering after dark
- Strange whispers that drive people mad
The village elder has hired adventurers to investigate and put an end to the disturbances.
Starting Scene
You stand outside the weathered doors of the Rusty Flagon tavern.
Strange whispers echo from within, and the windows flicker with an
eerie green light. The townspeople warned you about this place,
but the reward for investigating is too good to pass up.
Initial Message (Both Characters)
When the characters first join, they see:
Welcome to the Cursed Tavern adventure! You've been hired by the
village elder to investigate strange happenings at the old tavern.
Locals report seeing ghostly figures and hearing unearthly screams.
Your mission: discover what's causing the disturbances and put an
end to it. What would you like to do?
Testing Scenarios
Test the Message System
-
Private Messages:
- Bargin: "I quietly check the door for traps"
- Willow: "I scan the area for signs of danger"
- Storyteller should see both privately
-
Public Messages:
- Bargin: "I kick open the door!" (public)
- Willow should see this action
- Storyteller sees it too
-
Mixed Messages:
- Bargin (public): "I step inside boldly"
- Bargin (private): "I'm actually terrified but don't want Willow to know"
- Willow sees: "I step inside boldly"
- Storyteller sees: Both parts
Test Context-Aware Responses
- Select both Bargin and Willow in storyteller dashboard
- Click "Select All Pending"
- Choose "Individual Responses"
- Generate context-aware response
- Verify each character receives their personalized response
Test AI Suggestions
- As storyteller, view Bargin's conversation
- Click "✨ AI Suggest"
- Review generated suggestion
- Edit and send
Development Benefits
This demo session eliminates the need to:
- Create a new session every time you restart the server
- Manually create character profiles
- Enter character descriptions and personalities
- Type in session IDs repeatedly
- Set up test scenarios
Just restart the server and click one button to test!
Server Startup Output
When you start the server with bash start.sh, you'll see:
============================================================
🎲 DEMO SESSION CREATED!
============================================================
Session ID: demo-session-001
Session Name: The Cursed Tavern
Characters:
1. Bargin Ironforge (ID: char-bargin-001)
A stout dwarf warrior with a braided red beard and battle-scarred armor...
2. Willow Moonwhisper (ID: char-willow-002)
An elven ranger with silver hair and piercing green eyes...
Scenario: The Cursed Tavern
Scene: You stand outside the weathered doors of the Rusty Flagon tavern...
============================================================
To join as Storyteller: Use session ID 'demo-session-001'
To join as Bargin: Use session ID 'demo-session-001' + character ID 'char-bargin-001'
To join as Willow: Use session ID 'demo-session-001' + character ID 'char-willow-002'
============================================================
Customization
Want to modify the demo session? Edit create_demo_session() in main.py:
Change Characters
# Modify character attributes
bargin = Character(
name="Your Character Name",
description="Your description",
personality="Your personality",
llm_model="gpt-4", # Change model
# ...
)
Change Scenario
demo_session = GameSession(
name="Your Adventure Name",
current_scene="Your starting scene...",
scene_history=["Your backstory..."]
)
Add More Characters
# Create a third character
third_char = Character(...)
demo_session.characters[third_char.id] = third_char
Change Session ID
demo_session_id = "my-custom-id"
Disabling Demo Session
If you want to disable auto-creation of the demo session, comment out this line in main.py:
if __name__ == "__main__":
import uvicorn
# create_demo_session() # Comment this out
uvicorn.run(app, host="0.0.0.0", port=8000)
Technical Details
Implementation
The demo session is created in the create_demo_session() function in main.py, which:
- Creates a
GameSessionobject - Creates two
Characterobjects - Adds an initial storyteller message to both character histories
- Stores the session in the in-memory
sessionsdictionary - Prints session info to the console
Frontend Integration
The home page (SessionSetup.js) includes three quick-access functions:
joinDemoStoryteller()- CallsonCreateSession("demo-session-001")joinDemoBargin()- CallsonJoinSession("demo-session-001", "char-bargin-001")joinDemoWillow()- CallsonJoinSession("demo-session-001", "char-willow-002")
These bypass the normal session creation/joining flow.
Why This Matters
During development and testing, you'll restart the server dozens of times. Without a demo session, each restart requires:
- Click "Create Session"
- Enter session name
- Wait for creation
- Copy session ID
- Open new window
- Paste session ID
- Enter character name
- Enter character description
- Enter personality
- Select model
- Click join
- Repeat for second character
With the demo session:
- Click one button
That's a huge time saver!
Future Enhancements
When database persistence is implemented, you could:
- Save demo session to database on first run
- Load multiple pre-configured adventures
- Create a "Quick Start Gallery" of scenarios
- Import/export demo sessions as JSON
FAQ
Q: Does the demo session persist across server restarts?
A: No, it's recreated fresh each time. This ensures a clean state for testing.
Q: Can I have multiple demo sessions?
A: Yes! Just create additional sessions with different IDs in the startup function.
Q: Will the demo session interfere with real sessions?
A: No, it's just another session in memory. You can create regular sessions alongside it.
Q: Can I modify character stats mid-session?
A: Not yet, but you can edit the character objects directly in the code and restart.
Happy Testing! 🎲✨