PureChat Documentation
website·Indexed 31 days ago
https://docs.purechat.cn/A unified interface combining traditional instant messaging with AI-driven conversation, serving as both a functional chat application and an AI development framework. Built with Vue 3 for a reactive UI across platforms.
What's inside PureChat
- PureChat is a functional chat application and AI development framework that integrates traditional instant messaging with AI-driven conversations. It supports two primary operation modes: Local Mode (default) and Tencent Cloud IM SDK mode.
Set up local development environment
Ensure the following tools are installed to avoid dependency or startup errors:
- Git: Required for version control.
- NodeJS: Version $\ge$ 18.20.0 (recommended 18.20.0+). Use
nvmfor version management. - pnpm: Version $\ge$ 8.7.0 (latest recommended).
Inspect client-side console errors in PureChat
To debug issues in the PureChat client:
- Focus the PureChat client window and press
Ctrl+Shift+I(Windows/Linux) orCommand+Option+I(Mac). - Open the console before triggering the error (e.g., before clicking 'Test' or starting a conversation).
- Navigate to the
Networktab. - Locate the request marked with a red
×(typicallycompletionsorgenerations). - Click the
Responsetab to view the full error details.
- Focus the PureChat client window and press
Integrate AI models in PureChat
PureChat integrates several large language models including OpenAI, Ollama, DeepSeek, and Zhipu. It supports context understanding, chain-of-thought (thinking process), web search integration, custom system prompts, and streaming output. Users must provide their own API keys.Deploy PureChat to Vercel
Follow these steps to deploy the project to Vercel:
- Fork the PureChat repository to your GitHub account.
- Connect your GitHub account to Vercel.
- Create a new project in Vercel, select the forked repository, and configure the required environment variables.
- For domestic (China) access without a VPN: Add a CNAME record in your domain DNS settings pointing to
cname.vercel-dns.com, then configure this domain in the Vercel project settings.
Configure routing mode and dev tools in .env
You can change the routing mode tohashto avoid 404 errors on static servers if you cannot modify the server configuration. These settings are managed in the.envfile.# Whether to enable vue-devtools (Y/N) VITE_DEV_TOOLS = 'Y' # vue-router mode: hash | history VITE_ROUTER_HISTORY = 'hash' # Whether to generate production source maps (Y/N) VITE_SOURCE_MAP = 'N'Switch between Local and Tencent Cloud IM modes
PureChat allows users to toggle between Local Mode and Tencent Cloud IM SDK mode using an environment variable in the.envconfiguration file.VITE_LOCAL_MODE=true # or false to switch modesConfigure npm mirror and hoisting in .npmrc
PureChat uses a specific.npmrcconfiguration to ensure dependency compatibility and use the Taobao mirror for faster installation in China.registry=https://registry.npmmirror.com/ shamefully-hoist=true ignore-workspace-root-check=trueEnable and configure Tencent IM SDK
To switch from local AI tool mode to a full instant messaging system (supporting multi-device sync, cloud storage, and group chats), enable the Tencent Cloud SDK mode in the
.envfile.Steps to get credentials:
- Register a Tencent Cloud account.
- Create an application in the IM Console.
- Obtain the
appidandappkeyand initialize the SDK.
# Set to 'N' to enable Tencent Cloud SDK mode (Default is 'Y' for local mode) VITE_LOCAL_MODE=NFix 404 errors on page refresh after web build
When usinghistoryrouting mode, web servers like Nginx look for physical files (e.g.,login.html) and return a 404 if they aren't found. To fix this, you must configure the server to redirect all requests toindex.htmlsovue-routercan handle the routing, or switch the frontend tohashmode.# nginx.conf server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }Configure PureChat via environment variables
PureChat uses environment variables for high-level configuration across three main categories:
- Core Application Settings: Local/Cloud mode, router history mode, storage prefixes, and base URLs.
- AI Provider Settings: API keys, base URLs, and model configurations for various providers.
- Build Configuration: CDN usage, development tools, and source mapping.
PureChat Desktop (Electron) Features
The Electron-based desktop version of PureChat includes specific OS-level integrations:
- Taskbar icon flashing notifications for new messages.
- Custom screenshot generation and sharing.
- Support for external protocol URI schemes to open the app.
- Real-time file download progress tracking.
- Custom Notification window styles.
- System tray integration for background operation.