feat: 大模型聊天工具

- 一步API接入,支持 Claude Fable 5 / Sonnet 4.6 / Opus 4.8
- Node.js 代理服务,API Key 通过 config.json 本地配置
- 流式响应 + Markdown 渲染 + 代码高亮
- 多对话管理,服务端持久化 + localStorage 双保险
- 深色/浅色主题,响应式布局

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
jackyu66git
2026-07-10 14:49:48 +08:00
co-authored by Claude
commit 3633952c6b
4 changed files with 1507 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
# 一步AI 聊天助手
基于 [一步API](https://yibuapi.com) 的 AI 聊天工具,兼容 OpenAI 接口格式,支持多种主流大模型。
## 支持模型
| 模型 | 说明 |
|------|------|
| GPT-5.2 | OpenAI 最新旗舰模型 |
| GPT-4o / GPT-4o Mini | OpenAI 多模态模型 |
| Claude Sonnet 4.6 / Opus 4.8 / Haiku 4.5 | Anthropic Claude 系列 |
| DeepSeek V3 / R1 | DeepSeek 推理模型 |
| Gemini 2.5 Pro | Google 旗舰模型 |
| Qwen Max | 通义千问旗舰模型 |
| Grok 3 | xAI 模型 |
## 快速开始
### 1. 配置 API Key
编辑 `config.json`,填入你的一步API密钥:
```json
{
"api_key": "sk-你的真实API密钥",
"base_url": "https://api.yibuapi.com/v1"
}
```
### 2. 启动服务
```bash
node server.js
```
然后访问 `http://localhost:8080`
## 架构说明
```
浏览器 ──→ server.js (Node代理) ──→ 一步API
config.json
(存储API Key)
```
- **config.json** — 本地保存 API Key,不暴露到前端
- **server.js** — Node.js 代理服务器,读取配置并转发请求,支持 SSE 流式传输
- **index.html** — 聊天界面,通过同一域名调用代理 API
## 功能特性
- ✅ 流式响应,实时查看生成内容
- ✅ API Key 本地配置文件存储,不暴露前端
- ✅ Markdown 渲染 + 代码高亮
- ✅ 多对话管理,自动保存
- ✅ 深色/浅色主题切换
- ✅ 可调节 Temperature 和 Max Tokens
- ✅ 一键复制消息 / 重新生成
- ✅ 响应式设计,支持移动端