README 文件修改
This commit is contained in:
38
README.md
38
README.md
@@ -164,32 +164,54 @@ ffmpeg -version
|
|||||||
|
|
||||||
### ⚙️ 配置文件
|
### ⚙️ 配置文件
|
||||||
|
|
||||||
编辑 `configs/config.yaml`:
|
复制并编辑配置文件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp configs/config.example.yaml configs/config.yaml
|
||||||
|
vim configs/config.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
配置文件格式(`configs/config.yaml`):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
app:
|
app:
|
||||||
name: "Huobao Drama"
|
name: "Huobao Drama API"
|
||||||
mode: "development" # development / production
|
version: "1.0.0"
|
||||||
|
debug: true # 开发环境设为true,生产环境设为false
|
||||||
|
|
||||||
|
server:
|
||||||
port: 5678
|
port: 5678
|
||||||
|
host: "0.0.0.0"
|
||||||
|
cors_origins:
|
||||||
|
- "http://localhost:3012"
|
||||||
|
read_timeout: 600
|
||||||
|
write_timeout: 600
|
||||||
|
|
||||||
database:
|
database:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
path: "./data/drama_generator.db"
|
path: "./data/drama_generator.db"
|
||||||
|
max_idle: 10
|
||||||
|
max_open: 100
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
type: "local"
|
type: "local"
|
||||||
local_path: "./data/storage"
|
local_path: "./data/storage"
|
||||||
base_url: "http://localhost:5678/static"
|
base_url: "http://localhost:5678/static"
|
||||||
|
|
||||||
logging:
|
ai:
|
||||||
level: "info"
|
default_text_provider: "openai"
|
||||||
output: "stdout"
|
default_image_provider: "openai"
|
||||||
|
default_video_provider: "doubao"
|
||||||
```
|
```
|
||||||
|
|
||||||
**重要配置项:**
|
**重要配置项:**
|
||||||
- `ai.doubao.api_key`: 豆包AI的API密钥(**必需**)
|
- `app.debug`: 调试模式开关(开发环境建议设为true)
|
||||||
|
- `server.port`: 服务运行端口
|
||||||
|
- `server.cors_origins`: 允许跨域访问的前端地址
|
||||||
|
- `database.path`: SQLite数据库文件路径
|
||||||
- `storage.local_path`: 本地文件存储路径
|
- `storage.local_path`: 本地文件存储路径
|
||||||
- `app.port`: 服务运行端口
|
- `storage.base_url`: 静态资源访问URL
|
||||||
|
- `ai.default_*_provider`: AI服务提供商配置(在Web界面中配置具体的API Key)
|
||||||
|
|
||||||
### 📥 安装依赖
|
### 📥 安装依赖
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
app:
|
app:
|
||||||
name: "Drama Generator"
|
name: "Huobao Drama API"
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
debug: false
|
debug: true
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 8080
|
port: 5678
|
||||||
host: "0.0.0.0"
|
host: "0.0.0.0"
|
||||||
cors_origins:
|
cors_origins:
|
||||||
- "http://localhost:8080"
|
- "http://localhost:3012"
|
||||||
read_timeout: 600
|
read_timeout: 600
|
||||||
write_timeout: 600
|
write_timeout: 600
|
||||||
|
|
||||||
database:
|
database:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
path: "/data/drama.db"
|
path: "./data/drama_generator.db"
|
||||||
max_idle: 10
|
max_idle: 10
|
||||||
max_open: 100
|
max_open: 100
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
type: "local"
|
type: "local"
|
||||||
local_path: "/data/storage"
|
local_path: "./data/storage"
|
||||||
base_url: "http://localhost:8080/static"
|
base_url: "http://localhost:5678/static"
|
||||||
|
|
||||||
ai:
|
ai:
|
||||||
default_text_provider: "openai"
|
default_text_provider: "openai"
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
}
|
|
||||||
|
|
||||||
func GenerateVerificationCode(length int) string {
|
|
||||||
digits := "0123456789"
|
|
||||||
code := make([]byte, length)
|
|
||||||
for i := range code {
|
|
||||||
code[i] = digits[rand.Intn(len(digits))]
|
|
||||||
}
|
|
||||||
return string(code)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GenerateRandomString(length int) string {
|
|
||||||
chars := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
|
||||||
result := make([]byte, length)
|
|
||||||
for i := range result {
|
|
||||||
result[i] = chars[rand.Intn(len(chars))]
|
|
||||||
}
|
|
||||||
return string(result)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user