Skip to content

ai assistant

docisit edited this page Jul 27, 2026 · 2 revisions

πŸ€– AI Assistant

ITG Media App's built-in AI features β€” Avatar Agent for guest pre-show preparation and Site Chat Assistant for visitor support.


Overview

ITG Media App includes two AI-powered features:

Feature Purpose Technology
Avatar Agent Pre-show guest greeting and preparation LiveKit AI Agent pipeline, Ollama
Site Chat Assistant Site-wide FAQ chatbot with conversation memory Ollama + local LLMs

Both features use Ollama for local LLM inference β€” your data stays on your server, no API keys or third-party AI services needed.


🎭 Avatar Agent

The Avatar Agent greets guests in a private pre-show room, helps them prepare, and gets them ready before they go live.

How It Works

Guest joins guest room
        β”‚
        β–Ό
  Avatar Agent greets guest
  - Asks for name, intro
  - Explains show format
  - Tests audio/video
  - Answers questions
  - Preps talking points
        β”‚
        β–Ό
  Guest is ready β†’ Director brings them on air

Features

Feature Description
Voice Interaction Natural voice conversation β€” no typing required
Pre-Show Briefing Explains the show format, topic, and guest's role
AV Check Verifies guest's camera and microphone are working
Talking Points Reviews key topics the host plans to cover
Calming Presence Helps nervous guests feel comfortable before going live
Q&A Answers guest questions about the show or process

Technical Architecture

The Avatar Agent runs as a LiveKit AI Agent using a voice pipeline:

Guest Audio β–Ά LiveKit β–Ά Whisper (STT) β–Ά LLM (Ollama) β–Ά TTS β–Ά LiveKit β–Ά Guest Speaker
Component Technology
Speech-to-Text Whisper (via LiveKit)
Language Model Ollama (Llama 3, Mistral, or any local model)
Text-to-Speech LiveKit TTS plugin
Orchestration LiveKit Agents Python framework

Deploying the Avatar Agent

The agent container is defined in agents/Dockerfile.agent:

# Build the agent image
cd agents/
docker build -f Dockerfile.agent -t mediasite-avatar-agent .

# Run alongside LiveKit
docker run -d \
  --name avatar-agent \
  --network host \
  -e LIVEKIT_URL=ws://localhost:7880 \
  -e LIVEKIT_API_KEY=$LIVEKIT_API_KEY \
  -e LIVEKIT_API_SECRET=$LIVEKIT_API_SECRET \
  -e OLLAMA_HOST=http://localhost:11434 \
  mediasite-avatar-agent

πŸ’¬ Site Chat Assistant

A site-wide FAQ chatbot that helps visitors navigate ITG Media App and answers common questions. Available as a floating chat widget on every page.

Features

Feature Description
FAQ Responses Answers common questions about the platform
Conversation Memory Remembers context from previous messages in the session
Navigation Help Directs visitors to the right pages and features
Business Hours Mode Different behavior during business/after hours
Rate Limiting Configurable rate limits to prevent abuse
Fallback to Human Escalates to contact form when AI can't help

How It Works

Visitor types message
        β”‚
        β–Ό
  Chat backend receives message
        β”‚
        β–Ό
  Rate limit check
        β”‚
        β–Ό
  FAQ lookup (cached responses for common questions)
        β”‚
        β”œβ”€β”€ Match found? β†’ Return cached response
        β”‚
        └── No match? β†’ Query Ollama LLM
                              β”‚
                              β–Ό
                        Return AI-generated response

Configuration

The Site Chat Assistant is managed via Django Admin under SiteChatConfig:

Setting Description
Business Hours Define when the assistant operates in "business" vs "after hours" mode
Rate Limits Max messages per minute/hour per user
Fallback Message Message shown when AI can't answer
Welcome Message Initial greeting shown to visitors
Model Selection Which Ollama model to use

Managing FAQs

FAQs are stored as SiteChatFAQ models in Django Admin:

{
  "question": "How do I join as a guest?",
  "answer": "Click the guest link provided by your host...",
  "category": "broadcasting",
  "priority": 1
}
Field Description
Question The FAQ question (triggers a direct match)
Answer Pre-written answer (returned instantly, no LLM call)
Category Group FAQs by topic
Priority Higher priority FAQs are checked first

πŸ¦™ Ollama Setup

Both AI features require Ollama running locally.

Installation

# Install Ollama (Linux)
curl -fsSL https://ollama.com/install.sh | sh

# Pull a model (recommended: Llama 3.1 8B or Mistral 7B)
ollama pull llama3.1:8b

# Or a smaller, faster model
ollama pull mistral:7b

# Verify it's running
ollama list
curl http://localhost:11434/api/tags

Recommended Models

Model Size Speed Best For
llama3.1:8b ~4.7 GB Good Best overall quality, good for both features
mistral:7b ~4.1 GB Fast Good balance, slightly faster responses
phi3:mini ~2.3 GB Very Fast Lightweight, good for FAQ-only use
llama3.2:3b ~2.0 GB Very Fast Budget option, good for simple Q&A

GPU Acceleration (Optional)

Ollama automatically uses NVIDIA GPUs if available. For CPU-only servers, expect slower responses but still functional.

# Check if GPU is detected
ollama run llama3.1:8b --verbose

Connecting to ITG Media App

Update your .env:

# Ollama (optional β€” for AI features)
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=llama3.1:8b

πŸ’‘ No external API keys needed. Ollama runs entirely on your server. Your conversations stay private.


🧠 AI Chat Sessions

All chat sessions are stored in the database with conversation history:

Chat Models

Model Purpose
AIPersonality Defines the assistant's personality, tone, and behavior
AIChatSession Stores a single chat session with conversation history
AIChatMessage Individual messages within a session

Session Management (Django Admin)

  • View all chat sessions
  • See message history per session
  • Delete sessions for privacy
  • Monitor usage patterns
  • Adjust AI personality settings

πŸ”§ AI Consumer (Django Channels)

The AI features use Django Channels for real-time WebSocket communication:

Browser Chat Widget
        β”‚
        β–Ό WebSocket
  Daphne (ASGI Server)
        β”‚
        β–Ό
  Django Channels Consumer
        β”‚
        β”œβ”€β”€ FAQ match? β†’ Return directly
        β”‚
        └── No match? β†’ Ollama API β†’ Return response

The consumer is defined in members/ai_consumer.py and automatically connected via Django Channels routing.


πŸ›‘οΈ Privacy & Data

Aspect Policy
Data Location All AI processing happens on your server
Third-Party APIs None required β€” Ollama runs locally
Chat Storage Conversations stored in your PostgreSQL database
Data Retention Configurable β€” delete old sessions via admin
PII Handling No personal data sent to external services

⏭️ Next Steps

  • Admin Panel β€” Manage AI settings and monitor chat sessions
  • Deployment β€” Production Nginx + SSL setup

← Back to Wiki Home

Clone this wiki locally