A final project for CST1000 at Westlake University. (2024 Spring)
This is a chat application built with Flask and MongoDB. It allows users to register, log in, send messages, and interact with a chatbot.
- User registration and login
- Message sending between users
- Interaction with a chatbot
- Storage and retrieval of chat history
conda create -n Persuasion python=3.10
conda activate Persuasion
bash environment.sh (linux)
pip install -r requirements.txt (windows/linux)
First, you need to start the MongoDB server. Then, you can start the Flask server with the following command:
python website.py
The application will run on port 5000 by default.
To use the application, open your browser and visit http://localhost:5000. You will see the main interface of the application. You can register a new user and log in with this user. After logging in, you can send messages and see the responses from the chatbot.
- Install Docker and Docker Compose.
- Clone this repository.
- Change website.py from
# Other code
app.config["MONGO_URI"] = "mongodb://localhost:27017/Test"
# Other code
if __name__ == '__main__':
app.run(debug=True)
to
# Other code
app.config["MONGO_URI"] = "mongodb://db:27017/Test"
# Other code
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
- Run
docker-compose up
in the project directory.
The Flask application will be available at http://localhost:5000
, and MongoDB will be available at localhost:27017
.
kubectl apply -f frontend-tcp-service.yaml,redis-master-service.yaml,redis-slave-service.yaml,frontend-deployment.yaml,redis-master-deployment.yaml,redis-slave-deployment.yaml
To access your application, follow these steps based on your environment:
If you are using minikube
during development, execute the following command to access your service:
minikube service frontend
If you are using a cloud service or another environment, check the IP used by the service with the following command:
kubectl describe svc frontend
The output will display detailed information about the service, including the IP address and ports.
We provide a tool based on Gradio in Tools.py which helps you to do some sentiment analysis and gives you some suggested responses by the language model.
Before you run the Tools.py, you need to set your API:
export DASHSCOPE_API_KEY=YOUR_API
Contributions of all kinds are welcome! You can help us improve this project by submitting bug reports, suggesting improvements, or directly creating pull requests.
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.