English | 简体中文
A feature-rich AI chat assistant built with Streamlit, supporting multiple AI models, role-playing mode, and conversation management.
- 🤖 Multiple AI Models: Support for various AI models with customizable API endpoints
- 👤 User Management: User registration and login system with conversation history
- 🎭 Role-Playing Mode: Engage in immersive role-playing conversations with predefined or custom characters
- 💬 Normal Chat Mode: Standard AI conversation mode
- 📊 Conversation Management: Save and manage chat history in SQLite database
- 👍👎 Message Feedback: Like/dislike feedback system for AI responses
- ⚙️ Customizable Settings: Adjustable temperature, max tokens, timeout, and retry settings
- Python 3.8 or higher
- pip package manager
- Clone the repository:
git clone https://github.com/nex-agi/NexChat.git
cd NexChat- Install required dependencies:
pip install -r requirements.txt-
Configure your models in
config.yml(see Configuration section) -
Run the application:
streamlit run app.pyThe application uses config.yml for configuration. All model settings, API keys, and application preferences are configured in this file.
# Application Configuration
app:
title: "AI Chat Assistant"
page_icon: "🤖"
layout: "wide"
initial_sidebar_state: "expanded"
# UI Configuration
ui:
show_model_info: true # Whether to show model information
show_token_count: true # Whether to show token count
# Available Models List
models:
- name: "model-name"
display_name: "Model Name"
description: "Model Description"
api_key: "your-api-key-here"
base_url: "https://api.example.com/v1" # Replace with actual base URLTo add a new model, add an entry to the models list in config.yml:
models:
- name: "your-model-name"
display_name: "Your Model Display Name"
description: "Model description"
api_key: "your-api-key"
base_url: "https://your-api-endpoint.com/v1"- Login/Register: Enter your username in the sidebar and click "Login/Register"
- Select Model: Choose an AI model from the model selector
- Choose Chat Mode:
- Normal Chat: Standard AI conversation
- Role-Playing: Engage with predefined or custom characters
- Start Chatting: Type your message in the input box and press Enter
- Select "Role-Playing" from the chat mode options
- Choose a character from the dropdown or create a custom character
- Custom characters can be added with:
- Character name
- Character description (background, personality, speaking style, etc.)
- Start conversing with your selected character
- Message Feedback: Click 👍 or 👎 on AI responses to provide feedback
- Clear Chat: Use the "Clear Chat History" button to start a new conversation
- Settings Adjustment: Modify temperature, max tokens, timeout, and retry settings in the sidebar
- Logout: Click "Logout" to save your current conversation and exit
NexChat/
├── app.py # Main application file
├── config.yml # Configuration file
├── prompt.md # Role-playing prompt template
├── char.jsonl # Predefined character data (JSONL format)
├── chat_data.db # SQLite database for conversation storage
├── requirements.txt # Python dependencies
└── README.md # This file
The application uses SQLite to store:
- users: User information (id, username, created_at)
- conversations: Chat messages (id, user_id, session_id, role, content, timestamp, model)
- message_feedback: User feedback on messages (id, user_id, session_id, message_index, feedback_type, timestamp)
- The application automatically creates the SQLite database on first run
- Character data should be in JSONL format in
char.jsonl - Role-playing prompts are loaded from
prompt.md - API keys should be kept secure and not committed to version control
- Some models may require proxy configuration (see code for specific model handling)