Skip to content

Commit d8237ae

Browse files
merge v4.2.5
2 parents 3974f1b + 6cfc717 commit d8237ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+7728
-2712
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# 更新日志
22

3+
## v4.2.5
4+
5+
- 功能优化:在代码右下角增加复制代码功能按钮,增加收起和展开代码功能
6+
- Bug 修复:修复 Shift + Enter 不换行的 Bug
7+
- Bug 修复:修复管理后台菜单添加页面的文本错误
8+
- Bug 修复:解决聊天页面异常退出不断重连的 bug
9+
- 功能优化:把 Luma 和可灵视频生成页面整合成一个视频创作中心页面,统一管理视频任务
10+
- 功能新增:增加即梦 AI 专题页面,支持即梦官方原生 API 的图片和视频生成 🎉🎉🎉
11+
312
## v4.2.4
413

514
- 功能优化:更改前端构建技术选型,使用 Vite 构建,提升构建速度和兼容性

CLAUDE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build Commands
6+
7+
### Go Backend (api/)
8+
- **Development**: `cd api && go run main.go` (uses config.toml)
9+
- **Build**: `cd api && make` (builds both amd64 and arm64 binaries)
10+
- **Individual builds**: `make amd64` or `make arm64`
11+
- **Clean**: `make clean`
12+
- **Config**: Copy `config.sample.toml` to `config.toml` and configure
13+
14+
### Web Frontend (web/)
15+
- **Development**: `cd web && npm run dev` (runs on Vite dev server with --host)
16+
- **Build**: `cd web && npm run build`
17+
- **Lint**: `cd web && npm run lint` (ESLint with auto-fix)
18+
19+
### Testing
20+
- Backend tests: `cd api/test && bash run_crawler_test.sh`
21+
- No specific frontend test configuration found
22+
23+
## Project Architecture
24+
25+
### Backend (Go)
26+
- **Framework**: Gin web framework with dependency injection via uber-go/fx
27+
- **Database**: GORM with MySQL, Redis for caching, LevelDB for local storage
28+
- **Authentication**: JWT tokens with Redis session storage
29+
- **Middleware**: CORS, authorization, parameter handling, static resource serving
30+
- **Structure**:
31+
- `handler/`: HTTP request handlers (REST API endpoints)
32+
- `service/`: Business logic services (AI integrations, payments, etc.)
33+
- `store/`: Database models and data access layer
34+
- `core/`: Application server and middleware configuration
35+
- `utils/`: Utility functions and helpers
36+
37+
### Frontend (Vue.js)
38+
- **Framework**: Vue 3 with Composition API
39+
- **UI Components**: Element Plus + Vant (mobile components)
40+
- **State Management**: Pinia
41+
- **Routing**: Vue Router with nested routes
42+
- **Build Tool**: Vite
43+
- **CSS**: Stylus preprocessor with Tailwind CSS utilities
44+
- **Features**: Responsive design (desktop/mobile views), theme switching (dark/light)
45+
46+
### Key Features
47+
- **AI Chat**: Multiple chat models and conversation management
48+
- **Image Generation**: MidJourney, Stable Diffusion, DALL-E integration
49+
- **Audio/Video**: Suno music creation, Luma/KeLing video generation
50+
- **User Management**: Authentication, payments, power logs, invitations
51+
- **Admin Panel**: Comprehensive management interface
52+
53+
### Database Models
54+
Key entities: User, ChatItem, ChatMessage, ChatRole, ChatModel, Order, Product, AdminUser, and various job types for AI services.
55+
56+
### API Structure
57+
- User APIs: `/api/user/*` (auth, profile, settings)
58+
- Chat APIs: `/api/chat/*` (conversations, messages)
59+
- AI Service APIs: `/api/mj/*`, `/api/sd/*`, `/api/dall/*`, `/api/suno/*`, `/api/video/*`
60+
- Admin APIs: `/api/admin/*` (management functions)
61+
62+
### Configuration
63+
- Backend: TOML configuration file (`config.toml`)
64+
- Database: MySQL with automatic migrations
65+
- Services: Redis, various AI API integrations
66+
- File Storage: Local, Aliyun OSS, MinIO, Qiniu options

JIMENG_CONFIG_README.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# 即梦 AI 配置功能说明
2+
3+
## 功能概述
4+
5+
即梦 AI 配置功能允许管理员通过 Web 界面配置即梦 AI 的 API 密钥和算力消耗设置,支持动态配置更新,无需重启服务。
6+
7+
## 功能特性
8+
9+
### 1. 秘钥配置
10+
11+
- AccessKey 和 SecretKey 配置
12+
- 支持密码显示/隐藏
13+
- 连接测试功能
14+
15+
### 2. 算力配置
16+
17+
- 文生图算力消耗
18+
- 图生图算力消耗
19+
- 图片编辑算力消耗
20+
- 图片特效算力消耗
21+
- 文生视频算力消耗
22+
- 图生视频算力消耗
23+
24+
### 3. 动态配置
25+
26+
- 配置实时生效
27+
- 无需重启服务
28+
- 支持配置验证
29+
30+
## API 接口
31+
32+
### 获取配置
33+
34+
```
35+
GET /api/admin/jimeng/config
36+
```
37+
38+
### 更新配置
39+
40+
```
41+
POST /api/admin/jimeng/config
42+
Content-Type: application/json
43+
44+
{
45+
"config": {
46+
"access_key": "your_access_key",
47+
"secret_key": "your_secret_key",
48+
"power": {
49+
"text_to_image": 10,
50+
"image_to_image": 15,
51+
"image_edit": 20,
52+
"image_effects": 25,
53+
"text_to_video": 30,
54+
"image_to_video": 35
55+
}
56+
}
57+
}
58+
```
59+
60+
### 测试连接
61+
62+
```
63+
POST /api/admin/jimeng/config/test
64+
Content-Type: application/json
65+
66+
{
67+
"config": {
68+
"access_key": "your_access_key",
69+
"secret_key": "your_secret_key"
70+
}
71+
}
72+
```
73+
74+
## 前端页面
75+
76+
### 访问路径
77+
78+
管理后台 -> 即梦 AI -> 配置设置
79+
80+
### 页面功能
81+
82+
1. **秘钥配置标签页**
83+
84+
- AccessKey 输入框(密码模式)
85+
- SecretKey 输入框(密码模式)
86+
- 测试连接按钮
87+
88+
2. **算力配置标签页**
89+
90+
- 各种任务类型的算力消耗配置
91+
- 数字输入框,支持 1-100 范围
92+
- 提示信息说明
93+
94+
3. **操作按钮**
95+
- 保存配置
96+
- 重置配置
97+
98+
## 配置存储
99+
100+
配置存储在数据库的`config`表中:
101+
102+
- 配置键:`jimeng`
103+
- 配置值:JSON 格式的即梦 AI 配置
104+
105+
## 默认配置
106+
107+
如果配置不存在,系统会使用以下默认值:
108+
109+
```json
110+
{
111+
"access_key": "",
112+
"secret_key": "",
113+
"power": {
114+
"text_to_image": 10,
115+
"image_to_image": 15,
116+
"image_edit": 20,
117+
"image_effects": 25,
118+
"text_to_video": 30,
119+
"image_to_video": 35
120+
}
121+
}
122+
```
123+
124+
## 使用流程
125+
126+
1. **初始配置**
127+
128+
- 访问管理后台即梦 AI 配置页面
129+
- 填写 AccessKey 和 SecretKey
130+
- 点击"测试连接"验证配置
131+
- 调整各功能算力消耗
132+
- 保存配置
133+
134+
2. **配置更新**
135+
136+
- 修改需要更新的配置项
137+
- 保存配置
138+
- 配置立即生效
139+
140+
3. **故障排查**
141+
- 使用"测试连接"功能验证 API 密钥
142+
- 检查配置是否正确保存
143+
- 查看服务日志
144+
145+
## 注意事项
146+
147+
1. **权限要求**
148+
149+
- 只有管理员可以访问配置页面
150+
- 需要有效的管理员登录会话
151+
152+
2. **配置验证**
153+
154+
- AccessKey 和 SecretKey 不能为空
155+
- 算力消耗必须大于 0
156+
- 建议先测试连接再保存配置
157+
158+
3. **服务影响**
159+
- 配置更新不会影响正在进行的任务
160+
- 新任务会使用更新后的配置
161+
- 客户端配置会在下次请求时更新
162+
163+
## 错误处理
164+
165+
1. **配置加载失败**
166+
167+
- 使用默认配置
168+
- 记录错误日志
169+
170+
2. **连接测试失败**
171+
172+
- 显示具体错误信息
173+
- 建议检查 API 密钥
174+
175+
3. **配置保存失败**
176+
- 显示错误信息
177+
- 保留原有配置
178+
179+
## 开发说明
180+
181+
### 后端文件
182+
183+
- `api/handler/admin/jimeng_handler.go` - 配置管理 API
184+
- `api/service/jimeng/service.go` - 配置服务逻辑
185+
- `api/core/types/jimeng.go` - 配置类型定义
186+
187+
### 前端文件
188+
189+
- `web/src/views/admin/jimeng/JimengSetting.vue` - 配置页面
190+
191+
### 数据库
192+
193+
- `config`表存储配置信息
194+
- 配置键:`jimeng`
195+
- 配置值:JSON 格式

0 commit comments

Comments
 (0)