How woedem24/azure-ai-chatbot works
Cirrus is an Azure-hosted, multi-mode AI chatbot. A user submits a message through the web demo or REST API; the Function App rate-limits chat requests and delegates them to the conversation handler, which resolves a session, loads recent history, selects a prompt persona, calls Azure OpenAI, records usage and saves the conversation before returning a reply. Terraform provisions the Azure services. The README documents the demo, health check, persistence, cost monitoring, and deployment; sampled source confirms handler integrations, but does not show the infrastructure configuration details.
Main entry points: function_app.py Function App · conversation_handler.py Chat handler · main.tf Azure infrastructure · index.html Web chat
Components 17
Chat clients
- Web chat
webchat/index.html
Function API
- Function App
function_app/function_app.py - Rate limiter
function_app/ConversationHandler/rate_limiter.py - Health check
function_app/function_app.py
Conversation handling
- Chat handler
function_app/ConversationHandler/conversation_handler.py - Session identity
function_app/ConversationHandler/session.py - Intent detector
function_app/ConversationHandler/intent_detector.py - Mode prompts
function_app/ConversationHandler/prompts.py - AI client
function_app/ConversationHandler/openai_client.py - Usage and cost
function_app/ConversationHandler/token_counter.py - Conversation storage
function_app/ConversationHandler/cosmos_client.py
Azure services
- Cosmos DB
- Azure OpenAI
- Key Vault
- Application Insights
- Azure infrastructure
terraform/main.tf
Other components
- Chat user
Connections 20
- Chat user → Web chat: uses
README.md - Chat user → Function App: calls REST API
README.md - Web chat → Function App: sends chat
README.md - Function App → Rate limiter: checks limit
function_app/function_app.py - Function App → Chat handler: delegates chat
function_app/function_app.py - Chat handler → Session identity: resolves session
function_app/ConversationHandler/conversation_handler.py - Chat handler → Conversation storage: loads and saves
function_app/ConversationHandler/conversation_handler.py - Conversation storage → Cosmos DB: reads and writes
README.md - Chat handler → Intent detector: detects intent
function_app/ConversationHandler/conversation_handler.py - Chat handler → Mode prompts: gets prompt
function_app/ConversationHandler/conversation_handler.py - Chat handler → AI client: generates reply
function_app/ConversationHandler/conversation_handler.py - AI client → Azure OpenAI: requests completion
README.md - Chat handler → Usage and cost: counts and estimates
function_app/ConversationHandler/conversation_handler.py - Function App → Health check: serves health
function_app/function_app.py - Function App → Application Insights: sends telemetry
README.md - Function App → Key Vault: resolves secrets
README.md - Azure infrastructure → Function App: provisions
README.md - Azure infrastructure → Cosmos DB: provisions
README.md - Azure infrastructure → Key Vault: provisions
README.md - Azure infrastructure → Application Insights: provisions
README.md