[README] [中文说明]
A chatbot application is built using Nobita-chatbot as frontend and FastAPI as python backend. KISS, an acronym for "Keep it simple, stupid!" which is known as KISS principle.
This is a chatbot application that allows users to interact with a virtual assistant supported by large language models (LLM). KissChatbot is designed to answer questions and provide information just like ChatGPT.
The application is built using react-app for the frontend and Python for the backend components. This design is particularly user-friendly for Python developers, as it enables them to quickly deploy their trained models without dealing with the front-end.
In KissChatbot, we mock a demo service utilizing chatgpt3.5 model and it requires configuration of an OpenAI key. Of course, the backend service can be simply modified to employ any other models.
-
Privacy first, all data is stored locally in the browser.
-
The interface supports two response modes: streaming and non-streaming.
-
Supports syntax highlighting and formatting for various programming languages.
-
Customizable chatbot responses and behavior
-
Responsive user interface that works on desktop and mobile devices
To run this application locally, you need to install Python environment on your computer. After installing the necessary dependencies, follow these steps:
Backend:
-
Clone the repository onto your local computer.
-
Navigate to backend/app/main.py.
-
Configure your ChatGPT key.
-
install the OpenAI dependencies.
-
Run this Python file to start the backend server.
-
Open a web browser and navigate to http://localhost:8004/docs to view the API documentation.
Frontend:
-
Navigate to the frontend directory and run npm install to install the frontend dependencies.
-
Run npm start to start the frontend development server.
-
Open a web browser and navigate to http://localhost:3000 to view the application.
Manual Configuration:
-
frontend/public/config.js is the configuration file for calling the API, which can be modified according to actual needs.
-
The default configuration is: window.config = {"askRole":"user", "answerRole":"assistant", "apiIP":"http://localhost:8004"}
-
askRole and answerRole are parameters for the API content, used by the frontend to retrieve content from the API, and must match the attributes of the API return content property.
-
apiIP is the service address.
Deploy the project through Docker. Docker-Compose has already configured the frontend and server-related settings, which can be modified.
-
Configure the
OPENAI_KEY
Open theDocker-Compose.yml
file to modify and save. -
Switch to the root directory.
-
Manually modify the API configuration file frontend/public/config.js, the default configuration is: window.config={"askRole":"user","answerRole":"assistant","apiIP":"http://localhost:8004"}
-
modify the apiIP to "/api".
-
Run "docker-compose up".
-
Open your web browser and navigate to http://localhost:8006 to view the application.
-
Open http://localhost:8005/docs to view the API documentation.
To use the chatbot, simply enter a message in the chat window and press enter. The chatbot will respond with a message based on the user's input. The following functions are also supported:
-
Provides multi-turn conversation with an option to turn it off.
-
Chat records are permanently stored in the browser.
-
Download chat records as images.
Contributions are welcome! If you would like to contribute to this project, please fork the repository and submit a pull request.
This project is licensed under the Apache License 2.0.