by meow_18838
WebChatify
import logging
from flask import Flask, render_template, session
from flask_session import Session
from gunicorn.app.base import BaseApplication
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
app = Flask(__name__)
# Configuring server-side session
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)
from abilities import llm_prompt
from flask import request, jsonify
@app.route("/")
def root_route():
return render_template("template.html")
@app.route("/send_message", methods=['POST'])
def send_message():
Created: | Last Updated:
Introduction to the WebChatify Template
Welcome to the WebChatify template guide! This template provides you with a fully functional web-based chat application that allows users to discuss and analyze website content. The chatbot is powered by an llm system, and the user interface is designed with Tailwind CSS for a sleek and modern look. This template is perfect for builders who want to create a chat service without worrying about the complexities of deployment and environment setup.
Getting Started
To begin using the WebChatify template, simply click on "Start with this Template" in the Lazy Builder interface. This will pre-populate the code in the Lazy Builder, so you won't need to copy or paste any code manually.
Test: Deploying the App
Once you have the template loaded, press the "Test" button to start the deployment process. The Lazy CLI will handle the deployment, and you won't need to install any libraries or set up your environment. The deployment process is managed entirely by Lazy.
Using the WebChatify App
After deployment, you will be provided with a dedicated server link to access the chat application. The interface includes a chat window where users can type messages and receive responses from the chatbot. The chat history is displayed in the window, allowing for a seamless conversation experience.
To interact with the chatbot:
- Type your message into the input field labeled "Type your message...".
- Click the "Send" button or press "Enter" to submit your message.
- The chatbot will process your message and respond accordingly.
If your message contains a URL, the chatbot will fetch content from the website and provide an analysis or summary as part of its response.
Integrating the WebChatify App
If you wish to integrate the WebChatify chat service into another service or frontend, you can use the server link provided by Lazy after deployment. This link can be added to external tools or platforms where you want the chat functionality to be accessible.
For example, if you want to embed the chatbot into a website, you can create an iframe or a web component that points to the server link. This will allow users to interact with the chatbot directly from your website.
Here is a sample code snippet that you can use to embed the chatbot into an HTML page:
<iframe src="YOUR_SERVER_LINK" width="350" height="500"></iframe>
Replace "YOUR_SERVER_LINK" with the actual link provided by Lazy.
Remember, all the steps listed above are mandatory to run and integrate the WebChatify template. Follow these instructions carefully to ensure a smooth setup and integration process.
If you encounter any issues or have questions, refer to the documentation provided in the code or reach out for support through the Lazy platform.