TawnChat

Test this app for free
53
import logging
from gunicorn.app.base import BaseApplication
from app_init import app

# IMPORT ALL ROUTES
from routes import *

# 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)
Get full code

Created: | Last Updated:

Web-based messaging app with user authentication, real-time messaging, unchangeable usernames, friend addition via usernames, settings for email and password management, and integrated AI assistant.

Here's a step-by-step guide for using the TawnChat template:

Introduction

TawnChat is a real-time messaging application with user authentication and an integrated AI assistant. This template provides a foundation for building a web-based chat platform with features like user profiles, friend management, and private messaging.

Getting Started

To begin using the TawnChat template:

  1. Click the "Start with this Template" button in the Lazy Builder interface.

Test the Application

After starting with the template:

  1. Click the "Test" button in the Lazy Builder interface.
  2. This will initiate the deployment process and launch the Lazy CLI.

Using the Application

Once the application is deployed, you can access and use TawnChat through the provided server link. Here's how to navigate the main features:

  1. User Registration and Authentication:
  2. When you first access the application, you'll be prompted to log in or register.
  3. The authentication is handled automatically through the flask_app_authenticator ability.

  4. Set Username:

  5. After logging in for the first time, you'll be prompted to set a username.
  6. Choose a username between 3-20 characters, containing only letters, numbers, and underscores.
  7. This username cannot be changed later.

  8. Profile Management:

  9. Navigate to the Profile section to update your bio and choose between light and dark themes.

  10. Adding Friends:

  11. Go to the Friends section to add new friends by their username.
  12. You can also manage friend requests in this section.

  13. Messaging:

  14. Access the Messages section to view your recent chats.
  15. Click on a friend's name to open a chat window and start messaging.

  16. AI Assistant:

  17. An AI bot named "TawnBot" will automatically send a welcome message to new users.
  18. You can interact with TawnBot like any other user in the chat interface.

Customization and Integration

To further customize or integrate TawnChat:

  1. Styling:
  2. Modify the CSS files (profile.css, landing.css, sidebar.css, chat.css) to change the application's appearance.

  3. Database:

  4. The application uses SQLite by default. If you need to switch to a different database, update the SQLALCHEMY_DATABASE_URI in app_init.py.

  5. Authentication:

  6. The current setup uses a custom authentication system. If you need to integrate with a specific auth provider, modify the flask_app_authenticator call in app_init.py.

  7. AI Integration:

  8. To enhance the AI assistant's capabilities, you can modify the bot's responses in the set_username_route function in routes.py.

Remember, all changes and deployments are handled through the Lazy platform, so you don't need to worry about server setup or environment configuration.



Here are the top 5 business benefits or applications of this template:

Template Benefits

  1. Secure User Authentication: The template provides a robust user authentication system, ensuring that only authorized users can access the messaging platform. This enhances security and protects user data, making it suitable for businesses that require confidential communication.

  2. Real-Time Messaging Capabilities: With its real-time messaging feature, this template enables instant communication between users. This can greatly improve collaboration and productivity within teams or between businesses and their clients.

  3. AI Assistant Integration: The inclusion of an AI assistant (TawnBot) adds significant value by providing instant support, answering queries, and potentially automating certain tasks. This can reduce the workload on human support staff and improve user experience.

  4. User Profile Management: The template allows users to set and manage their profiles, including bios and theme preferences. This personalization can increase user engagement and satisfaction with the platform.

  5. Scalable Friend Network: The ability to add friends via usernames and manage friend requests creates a scalable network effect. This feature can be particularly beneficial for social networking applications or business communication platforms that rely on connecting users.

Technologies

Optimize Your Django Web Development with CMS and Web App Optimize Your Django Web Development with CMS and Web App
Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask
Streamline JavaScript Workflows with Lazy AI: Automate Development, Debugging, API Integration and More  Streamline JavaScript Workflows with Lazy AI: Automate Development, Debugging, API Integration and More
Python App Templates for Scraping, Machine Learning, Data Science and More Python App Templates for Scraping, Machine Learning, Data Science and More
Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More

Similar templates

Open Source LLM based Web Chat Interface

This app will be a web interface that allows the user to send prompts to open source LLMs. It requires to enter the openrouter API key for it to work. This api key is free to get on openrouter.ai and there are a bunch of free opensource models on openrouter.ai so you can make a free chatbot. The user will be able to choose from a list of models and have a conversation with the chosen model. The conversation history will be displayed in chronological order, with the oldest message on top and the newest message below. The app will indicate who said each message in the conversation. The app will show a loader and block the send button while waiting for the model's response. The chat bar will be displayed as a sticky bar at the bottom of the page, with 10 pixels of padding below it. The input field will be 3 times wider than the default size, but it will not exceed the width of the page. The send button will be on the right side of the input field and will always fit on the page. The user will be able to press enter to send the message in addition to pressing the send button. The send button will have padding on the right side to match the left side. The message will be cleared from the input bar after pressing send. The last message will now be displayed above the sticky input block, and the conversation div will have a height of 80% to leave space for the model selection and input fields. There will be some space between the messages, and the user messages will be colored in green while the model messages will be colored in grey. The input will be blocked when waiting for the model's response, and a spinner will be displayed on the send button during this time.

Icon 1 Icon 1
560

We found some blogs you might like...