Tommy ai assistant
import logging
from gunicorn.app.base import BaseApplication
from app_init import create_initialized_flask_app
# Flask app creation should be done by create_initialized_flask_app to avoid circular dependency problems.
app = create_initialized_flask_app()
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
self.application = app
self.options = options or {}
super().__init__()
def load_config(self):
# Apply configuration to Gunicorn
for key, value in self.options.items():
if key in self.cfg.settings and value is not None:
self.cfg.set(key.lower(), value)
def load(self):
Frequently Asked Questions
Domain-specific knowledge integration through the moderation prompt For example, a healthcare company could set strict guidelines for HIPAA compliance, while a marketing agency could configure it for more creative responses. Q3: What is the pricing model and ROI potential for implementing the Tommy AI Assistant?
The Tommy AI Assistant template provides value through: - One-time purchase with no recurring template costs - Pay-as-you-go model for AI API usage - Reduced training costs for new employees - Improved efficiency in customer support - Scalable team management without additional licensing fees
Organizations typically see ROI through reduced support costs and improved employee productivity within 3-6 months of implementation.
Q4: How can I modify the chat interface to add custom styling in the Tommy AI Assistant?
A: You can customize the chat interface by modifying the CSS in styles.css
. Here's an example to create a custom chat bubble style:
```css .message-wrapper { margin-bottom: 16px; display: flex; flex-direction: column; }
.user-message .message-content { align-self: flex-end; background-color: #007bff; color: white; border-radius: 20px 20px 0 20px; padding: 12px; max-width: 80%; }
.ai-message .message-content { align-self: flex-start; background-color: #f0f0f0; border-radius: 20px 20px 20px 0; padding: 12px; max-width: 80%; } ```
Q5: How can I add a new API endpoint to handle custom actions in the Tommy AI Assistant?
A: You can add new API endpoints in the routes.py
file. Here's an example of adding a custom action endpoint:
```python @app.route("/api/custom_action", methods=["POST"]) def custom_action(): try: # Get the action parameters from the request action_type = request.json.get("action_type") user_id = session['user']['email']
# Perform the custom action
if action_type == "analyze":
# Add your custom analysis logic here
result = perform_analysis(user_id)
return jsonify({
"status": "success",
"data": result
})
else:
return jsonify({
"status": "error",
"message": "Invalid action type"
}), 400
except Exception as e:
app.logger.error(f"Error in custom action: {str(e)}")
return jsonify({
"status": "error",
"message": "An error occurred while processing your request"
}), 500
```
Created: | Last Updated:
I'll help you use this template code as a starting point for your own AI assistant application. Let me break down how to adapt and use this template.
Introduction
This template provides a complete AI assistant dashboard with user management, chat interface, and customizable AI model settings. It includes authentication, admin controls, and a clean user interface.
Getting Started
- Click "Start with this Template" to begin working with the code
- Replace
your_logo.png
in the static/img directory with your own logo - Update the title "AI Agent" in the templates to your preferred name
Test
- Click the Test button to launch the application
- The app will start and provide you with a server link
Using the Dashboard
Home Page
- Customize AI settings:
- Set custom instructions for the AI
- Choose from available AI models
- Adjust response temperature
- Save changes to update AI behavior
Team Management
- Manage admin access through:
- Individual email addresses
- Domain-wide access
- Block/unblock admin users
- First user becomes super admin
AI Chat Interface
- Test AI responses in real-time
- View chat history
- Clear conversation history
- See which AI model was used for each response
Customization Points
Update AI Models
In home.html
, modify the model selection options:
html
<select class="form-control custom-select" id="model_selection" name="model_selection">
<option value="your-model-1">Model 1</option>
<option value="your-model-2">Model 2</option>
</select>
Customize Styling
Modify static/css/styles.css
to match your brand:
css
:root {
--primary-color: #your-color;
--secondary-color: #your-color;
}
Update Navigation
Edit _nav_items.html
to customize menu items:
```html
```
The template provides a solid foundation for building an AI assistant interface with user management capabilities. You can extend it by adding more features or customizing the existing functionality to match your specific needs.
Template Benefits
- Customizable AI Chat Interface
- Provides a professional, user-friendly interface for interacting with various AI models (GPT-4, Claude, Gemini)
-
Allows businesses to customize AI responses through temperature settings and custom instructions
-
Enterprise-Grade Access Management
- Robust domain-based access control for managing team permissions
- Built-in blocking and unblocking capabilities for user management
-
Secure authentication system with email domain verification
-
Multi-Model AI Integration
- Supports multiple AI models (GPT-4, Claude 3, Gemini 1.5) in a single interface
- Easy switching between models for different use cases and cost optimization
-
Centralized settings management for all AI models
-
Team Collaboration Features
- Dedicated team management interface for adding/removing team members
- Role-based access control for administrators
-
Domain-wide access management for enterprise deployment
-
Professional Error Handling & UI
- Clean, modern interface with responsive design
- Comprehensive error handling with custom error pages
- Professional modal notifications and user feedback system
- Session management and secure logout functionality
Technologies




