A web application featuring historical characters from 1750-1899, spanning both Georgian and Victorian eras. Chat with characters from 18th-century London to 19th-century Victorian society, using Ollama for language generation and Amazon Polly for text-to-speech with synchronized mouth animation.
- Historical Characters: Speak in authentic Georgian and Victorian English (1750-1899)
- Multiple Eras: Characters from both Georgian (1750-1830) and Victorian (1830-1899) periods
- Text-to-Speech: Amazon Polly neural voice synthesis
- Mouth Animation: Viseme-based lip sync with SVG avatar
- Local AI: Ollama for language generation (no external API calls)
- Responsive UI: Beautiful historical-themed interface
- The Correspondent: A witty and charming Londoner from 1780s
- Sir Reginald: A witty and charming gentleman from 1780s London
- Lady Catherine: An educated woman from 1780s London
- Mr. Thompson: A successful merchant from 1780s London
- The Casual Correspondent: A more relaxed Londoner from 1780s
- Charles Dickens: The celebrated Victorian novelist and social critic
- Mr. Boz: A Victorian novelist and social observer (Dickensian character)
- The Victorian Gentleman: A refined gentleman from 1850s-1890s London
Before running this application, ensure you have:
-
Node.js 22+ installed
node -v # Should show v22 or higher -
Ollama installed and running
# Install Ollama (if not already installed) # Visit: https://ollama.ai/download # Start Ollama service ollama serve # Pull the required model (in a new terminal) ollama pull llama3.2:3b-instruct
-
AWS CLI configured with Polly access
# Install AWS CLI (if not already installed) # Visit: https://aws.amazon.com/cli/ # Configure AWS credentials aws configure # Enter your AWS Access Key ID, Secret Access Key, and region (e.g., us-east-1)
-
AWS Polly Permissions: Ensure your AWS user has the following permissions:
polly:SynthesizeSpeechpolly:StartSpeechSynthesisTask
-
Clone or download this project
cd "/Users/dylan/Documents/Cursor Projects/1800s CHAT"
-
Install dependencies
npm install
-
Start Ollama (if not already running)
ollama serve
-
Start the Georgian Chat server
npm start # or node server.js -
Open your browser Navigate to: http://localhost:8787
- Start a conversation: Type a message in the input field and press Enter or click Send
- Listen to responses: The avatar will speak with synchronized mouth movement
- Try these example prompts:
- "Good day! What news from London?"
- "Tell me about the latest fashions"
- "What do you think of the King's policies?"
- "How is the weather treating you?"
To use a different Amazon Polly voice, edit server.js and modify the VoiceId parameter:
const params = {
OutputFormat: "mp3",
VoiceId: "Amy", // Change this to another voice
// ... other parameters
};Popular British voices:
Amy(British English, Female)Emma(British English, Female)Brian(British English, Male)Arthur(British English, Male)
Modify the SYSTEM_PROMPT in server.js to change the character's personality:
const SYSTEM_PROMPT = `You are "The Correspondent," a Londoner living in 1760–1800.
// ... customize the character description
`;To use a different Ollama model, update the model name in the /chat endpoint:
body: JSON.stringify({
model: "llama3.2:3b-instruct", // Change this
// ... other parameters
})-
"Ollama API error"
- Ensure Ollama is running:
ollama serve - Check if the model is installed:
ollama list - Pull the model:
ollama pull llama3.2:3b-instruct
- Ensure Ollama is running:
-
"TTS API error" or "Failed to generate speech"
- Verify AWS credentials:
aws sts get-caller-identity - Check AWS region in
server.js(default: us-east-1) - Ensure Polly permissions are granted
- Verify AWS credentials:
-
Audio not playing
- Check browser console for errors
- Ensure browser supports Web Audio API
- Try refreshing the page
-
Mouth not animating
- Check browser console for viseme errors
- Ensure audio is playing (check volume)
- Try shorter messages first
Enable debug logging by adding this to server.js:
// Add after imports
process.env.DEBUG = 'true';georgian_chat/
├── server.js # Express.js backend
├── package.json # Dependencies and scripts
├── public/
│ └── index.html # Frontend with chat UI and avatar
└── README.md # This file
POST /chat- Send message to Ollama, get character responsePOST /tts- Convert text to speech with viseme dataGET /health- Health check endpoint
The application maps Amazon Polly visemes to mouth shapes:
sil,PP,FF,TH,DD,kk,CH,SS,nn,RR→ Closed mouthaa→ Open mouthE,I→ "E" mouth shapeO,U→ "O" mouth shape
- Uses Web Audio API for precise timing
- Base64-encoded MP3 audio from Amazon Polly
- Viseme timestamps synchronized with audio playback
- Streaming responses: Real-time text generation
- Emotion system: Facial expressions based on sentiment
- Voice selection: Multiple character voices
- Offline mode: Replace Polly with local TTS
- Docker deployment: Containerized setup
ISC License - feel free to modify and distribute.
For issues or questions:
- Check the troubleshooting section above
- Verify all prerequisites are installed
- Check browser console for error messages
- Ensure all services (Ollama, AWS) are running properly