Files
chat-app/README.md
T
wangyang 6b26ccb1e4 fix: 登录后自动加载对话历史;新增生产部署指南 DEPLOY.md
- 修复 useChat useEffect 只在挂载时执行导致的登录后无历史问题
- 暴露 reloadConversations 函数,App.tsx 登录成功后主动调用
- 添加 DEPLOY.md 生产部署文档(Nginx + PHP-FPM)

2026-05-15
2026-05-15 18:20:39 +08:00

83 lines
1.6 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Chat App
一个自托管的 LLM 聊天应用,支持多会话管理、流式响应和模型配置。
## 技术栈
**前端**
- React 19 + TypeScript + Vite
- Tailwind CSS 3.4 + shadcn/ui
- SSE 流式接收 AI 回复
**后端**
- PHP 8.3 + Slim 4
- SQLite 单文件数据库
- JWT 认证
## 功能特性
- 🖥️ 终端风格登录页
- 💬 多会话聊天管理
- ⚡ SSE 流式响应
- 🔧 模型配置面板(DeepSeek / Kimi / 自定义)
- 🔐 固定密码登录(通过 `CHAT_PASSWORD` 环境变量)
- 📱 响应式布局
## 快速开始
### 安装依赖
```bash
# 前端依赖
npm install
# 后端依赖(PHP + Composer
cd server && composer install
```
### 开发运行
```bash
# 同时启动前端和后端
npm run dev
# 前端 http://localhost:3000
# 后端 http://localhost:8000
```
### 生产构建
```bash
# 构建前端
npm run build
# 后端无需构建,直接部署 server/ 目录即可
```
## 环境变量
| 变量 | 说明 | 默认值 |
|------|------|--------|
| `CHAT_PASSWORD` | 登录密码 | `admin` |
| `JWT_SECRET` | JWT 签名密钥 | 内置默认值 |
## 部署
将以下目录上传至服务器:
- `dist/` — 前端构建产物
- `server/` — PHP 后端源码
配置 Web 服务器将 `server/public/` 设为根目录,并设置 `dist/` 的别名。
## 项目结构
```
chat-app/
├── src/ # 前端源码
├── server/ # PHP 后端
│ ├── public/ # Web 入口
│ └── src/ # 业务代码
├── dist/ # 前端构建产物(Git 忽略)
└── package.json
```