Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

README 文件修改

Connor2fa83d53a4b9
diff --git a/README.md b/README.md
index 0129466..dc3071f 100644
--- a/README.md
+++ b/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
app:
- name: "Huobao Drama"
- mode: "development" # development / production
+ name: "Huobao Drama API"
+ version: "1.0.0"
+ debug: true # 开发环境设为true,生产环境设为false
+
+server:
port: 5678
+ host: "0.0.0.0"
+ cors_origins:
+ - "http://localhost:3012"
+ read_timeout: 600
+ write_timeout: 600
database:
type: "sqlite"
path: "./data/drama_generator.db"
+ max_idle: 10
+ max_open: 100
storage:
type: "local"
local_path: "./data/storage"
base_url: "http://localhost:5678/static"
-logging:
- level: "info"
- output: "stdout"
+ai:
+ default_text_provider: "openai"
+ 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`: 本地文件存储路径
-- `app.port`: 服务运行端口
+- `storage.base_url`: 静态资源访问URL
+- `ai.default_*_provider`: AI服务提供商配置(在Web界面中配置具体的API Key)
### 📥 安装依赖
diff --git a/configs/config.example.yaml b/configs/config.example.yaml
index ae972ac..ae25c33 100644
--- a/configs/config.example.yaml
+++ b/configs/config.example.yaml
@@ -1,26 +1,26 @@
app:
- name: "Drama Generator"
+ name: "Huobao Drama API"
version: "1.0.0"
- debug: false
+ debug: true
server:
- port: 8080
+ port: 5678
host: "0.0.0.0"
cors_origins:
- - "http://localhost:8080"
+ - "http://localhost:3012"
read_timeout: 600
write_timeout: 600
database:
type: "sqlite"
- path: "/data/drama.db"
+ path: "./data/drama_generator.db"
max_idle: 10
max_open: 100
storage:
type: "local"
- local_path: "/data/storage"
- base_url: "http://localhost:8080/static"
+ local_path: "./data/storage"
+ base_url: "http://localhost:5678/static"
ai:
default_text_provider: "openai"
diff --git a/pkg/utils/random.go b/pkg/utils/random.go
deleted file mode 100644
index c6d4110..0000000
--- a/pkg/utils/random.go
+++ /dev/null
@@ -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)
-}