The web chat interface provides a rich, interactive experience for conversations with Asta, featuring real-time streaming responses, provider switching, and conversation organization.
Core Features
Provider Selection
Switch between AI providers on the fly:
- Claude - Anthropic’s Claude models with native vision support
- OpenAI - GPT models with vision capabilities
- Google - Gemini models with multimodal support
- Groq - Fast inference for supported models
- Ollama - Local models running on your machine
- OpenRouter - Access to multiple model providers
The selected provider is used for all subsequent messages in the conversation.
Agent Picker
Select different agent personalities or configurations:
- Serious - Concise, professional responses
- Friendly - Warm, conversational tone
- Normal - Balanced default behavior
Set via the mood parameter in chat requests.
Thinking Controls
Control how much reasoning Asta performs before responding:
Select thinking level
Choose from off, minimal, low, medium, high, or xhigh (model-dependent)
Configure reasoning visibility
Set reasoning mode:
off - Hide reasoning blocks
on - Show reasoning before final answer
stream - Send incremental reasoning updates
Higher thinking levels improve accuracy but increase response time. Use xhigh for complex tasks with supported models.
Streaming Support (SSE)
The /chat/stream endpoint provides real-time Server-Sent Events:
const response = await fetch('/chat/stream', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
text: 'What is the weather like?',
provider: 'claude',
conversation_id: 'user123:web:uuid'
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n');
for (const line of lines) {
if (line.startsWith('event: ')) {
const eventType = line.slice(7);
// Handle: meta, assistant, reasoning, status, done, error
}
if (line.startsWith('data: ')) {
const data = JSON.parse(line.slice(6));
// Process event data
}
}
}
Event Types
- meta - Initial metadata with conversation ID and provider
- assistant - Incremental assistant response text
- reasoning - Thinking/reasoning updates (when enabled)
- status - System status messages
- tool_start / tool_end - Tool execution notifications
- done - Final response with complete reply
- error - Error information
Streaming responses require a persistent connection. Ensure your client handles reconnection for long-running conversations.
Conversation Management
List Conversations
GET /chat/conversations?channel=web&limit=50
Returns recent conversations for the sidebar with titles, timestamps, and folder assignments.
Get Messages
GET /chat/messages?conversation_id=user123:web:uuid&limit=50
Fetch message history for a specific conversation.
Delete Conversation
DELETE /chat/conversations/{conversation_id}
Permanently removes a conversation and all its messages.
Truncate Messages
POST /chat/conversations/{conversation_id}/truncate
{
"keep_count": 10
}
Keep only the most recent N messages, useful for managing context length.
Folders
Organize conversations into custom folders:
Create folder
POST /chat/folders?channel=web
{
"name": "Work Projects",
"color": "#6366F1"
}
Assign conversation
PUT /chat/conversations/{conversation_id}/folder
{
"folder_id": "folder-uuid"
}
Update or delete
Use PATCH /chat/folders/{folder_id} to rename/recolor, or DELETE to remove.
Vision Support
Send images alongside text messages:
const response = await fetch('/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
text: 'What is in this image?',
provider: 'claude',
image_base64: base64ImageData,
image_mime: 'image/jpeg'
})
});
Vision support varies by provider. Claude, Google, and OpenAI have native vision capabilities. Other providers use a preprocessing fallback.
Implementation Reference
See backend/app/routers/chat.py for the complete implementation:
- Lines 166-204: Non-streaming chat endpoint
- Lines 206-299: Streaming SSE endpoint
- Lines 19-45: Conversation management
- Lines 86-131: Folder operations
Web Search Mode
Force web search tools by setting web: true:
{
text: 'Latest news on AI',
web: true // Enables force_web in extra_context
}
This prioritizes web_search and web_fetch tools for the request.