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

feat(settings): Agent 配置卡片移除模型选择,只保留提示词编辑

Connord28a5b9fa1d2
diff --git a/Dockerfile b/Dockerfile
index 3c73e8f..50da93d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,17 +4,23 @@
FROM node:20-bookworm-slim AS frontend-build
WORKDIR /build/frontend
COPY frontend/package.json frontend/package-lock.json ./
-RUN npm ci --no-audit --no-fund
+# lockfile 的 resolved 可能指向带鉴权的私有 registry(开发者本机 .npmrc),镜像内会 401。
+# 构建期删除 resolved 字段(integrity 校验不受影响),让 npm 统一走公共 registry
+RUN node -e "const fs=require('fs');const l=JSON.parse(fs.readFileSync('package-lock.json'));for(const p of Object.values(l.packages||{}))delete p.resolved;fs.writeFileSync('package-lock.json',JSON.stringify(l,null,2))" \
+ && npm ci --no-audit --no-fund --registry=https://registry.npmjs.org
COPY frontend/ ./
RUN npm run generate
-# ===== 后端构建:安装依赖(含原生模块编译)+ tsc 产物 =====
+# ===== 后端构建:安装依赖(含原生模块编译) =====
FROM node:20-bookworm AS backend-build
WORKDIR /build/backend
COPY backend/package.json backend/package-lock.json ./
-RUN npm ci --no-audit --no-fund
+RUN node -e "const fs=require('fs');const l=JSON.parse(fs.readFileSync('package-lock.json'));for(const p of Object.values(l.packages||{}))delete p.resolved;fs.writeFileSync('package-lock.json',JSON.stringify(l,null,2))" \
+ && npm ci --no-audit --no-fund --registry=https://registry.npmjs.org
COPY backend/ ./
-RUN npm run build && npm prune --omit=dev
+# 运行时与既有服务器部署一致走 tsx(源码存在 bundler 风格无扩展名 import,tsc 产物 node 直跑不可行);
+# tsx 是 devDependency,prune 后单独补装
+RUN npm prune --omit=dev && npm i tsx@^4.21.0 --no-save --no-audit --no-fund --registry=https://registry.npmjs.org
# ===== 运行时 =====
FROM node:20-bookworm-slim
@@ -28,9 +34,10 @@ ENV NODE_ENV=production \
FRONTEND_DIST=/app/frontend-dist
WORKDIR /app
-COPY --from=backend-build /build/backend/dist ./backend/dist
+COPY --from=backend-build /build/backend/src ./backend/src
COPY --from=backend-build /build/backend/node_modules ./backend/node_modules
COPY --from=backend-build /build/backend/package.json ./backend/package.json
+COPY --from=backend-build /build/backend/tsconfig.json ./backend/tsconfig.json
# workspace 模板(skills/prompts),entrypoint copy-once 到数据卷后可在线编辑
COPY backend/workspace ./workspace-template
COPY --from=frontend-build /build/frontend/.output/public ./frontend-dist
diff --git a/README.md b/README.md
index 48983f3..e0a8ffa 100644
--- a/README.md
+++ b/README.md
@@ -306,6 +306,25 @@ server {
> 媒体加载优化:生成图片时后端会自动产出 400px 缩略图(`*_thumb.webp`)供列表页加载,视频会抽取海报帧(`*_poster.jpg`)作为封面,前端仅在点开大图/播放时才加载原文件。历史存量文件可在 `backend/` 下执行 `npm run backfill-artwork` 一次性补齐。
+### 🐳 Docker 部署(含应用内更新)
+
+根目录提供一体化 `Dockerfile`(前端 generate + 后端 tsc + 运行时三阶段)与 `docker-compose.yml`(应用 + Watchtower):
+
+```bash
+# 1. 配置环境(Watchtower 令牌,app 与 watchtower 两侧必须一致)
+cp .env.example .env # 修改 WATCHTOWER_TOKEN
+
+# 2. 构建并启动(发布时注入版本号,供「关于更新」比对)
+HUOBAO_VERSION=1.0.0 docker compose up -d --build
+
+# 3. 访问 http://localhost:5679
+```
+
+- **数据持久化**:命名卷 `huobao-data` 挂载 `/app/data`(SQLite + 生成的图片/视频 + workspace/skills,更新镜像不丢数据)
+- **应用内更新**:compose 自带 [Watchtower](https://containrrr.dev/watchtower/) sidecar(`--label-enable` 只更新标记容器,`--cleanup` 清旧镜像,每天自检一次)。设置页「关于更新」可检查新版本并「立即更新」——后端经 Watchtower HTTP API 触发,拉新镜像重建容器,几分钟后刷新页面即可
+- **手动模式**:`docker-compose.yml` 中删除 app 的 `HUOBAO_WATCHTOWER_*` 两个环境变量(或整个 watchtower 服务)后,「关于更新」退化为新版本提示 + 手动命令 `docker compose pull && docker compose up -d`
+- **发布镜像**:`docker build --build-arg HUOBAO_VERSION=x.y.z -t ghcr.io/chatfire-ai/huobao-drama:x.y.z -t ghcr.io/chatfire-ai/huobao-drama:latest . && docker push …`,版本清单与桌面版共用 GitHub Releases 的 `latest.json`(可用 `HUOBAO_UPDATE_FEED` 覆盖)
+
---
## 🎨 技术栈
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 78ebd04..20a3ab3 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -9,4 +9,4 @@ if [ ! -e /app/data/workspace/.template-version ]; then
fi
cd /app/backend
-exec node dist/index.js
+exec node_modules/.bin/tsx src/index.ts
diff --git a/frontend/app/locales/en.json b/frontend/app/locales/en.json
index 2a64bed..dbb8f61 100644
--- a/frontend/app/locales/en.json
+++ b/frontend/app/locales/en.json
@@ -342,10 +342,7 @@
},
"agents": {
"title": "Agent Config",
- "desc": "The advanced area only keeps Agent runtime configs. Adjust models, prompts and parameters here; changes take effect immediately.",
- "model": "Model",
- "modelHint": "blank = use AI service default",
- "modelPlaceholder": "— Use AI service default —",
+ "desc": "The advanced area only keeps Agent runtime configs. Adjust prompts and parameters here; changes take effect immediately. Models are selected per task in the workbench top bar.",
"promptHint": "saved as {file}",
"promptPlaceholder": "Agent system prompt...",
"reset": "Reset to default",
@@ -839,4 +836,4 @@
"uhd": "UHD"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/app/locales/ja.json b/frontend/app/locales/ja.json
index bc6c213..01f472d 100644
--- a/frontend/app/locales/ja.json
+++ b/frontend/app/locales/ja.json
@@ -342,10 +342,7 @@
},
"agents": {
"title": "Agent 設定",
- "desc": "高度な設定エリアには Agent の実行設定のみを保持します。モデル、プロンプト、パラメータをここで調整でき、保存するとすぐに反映されます。",
- "model": "モデル",
- "modelHint": "空欄で AI サービスのデフォルトを使用",
- "modelPlaceholder": "— AI サービスのデフォルトを使用 —",
+ "desc": "高度な設定エリアには Agent の実行設定のみを保持します。プロンプトとパラメータをここで調整でき、保存するとすぐに反映されます。モデルはワークベンチ上部バーで都度選択します。",
"promptHint": "{file} として保存",
"promptPlaceholder": "Agent システムプロンプト...",
"reset": "デフォルトに戻す",
@@ -839,4 +836,4 @@
"uhd": "超高画質"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/app/locales/ko.json b/frontend/app/locales/ko.json
index b2fbedf..d474561 100644
--- a/frontend/app/locales/ko.json
+++ b/frontend/app/locales/ko.json
@@ -342,10 +342,7 @@
},
"agents": {
"title": "Agent 설정",
- "desc": "고급 영역에는 Agent 실행 설정만 유지됩니다. 모델, 프롬프트, 매개변수를 여기서 조정할 수 있으며 저장 즉시 적용됩니다.",
- "model": "모델",
- "modelHint": "비워 두면 AI 서비스 기본값 사용",
- "modelPlaceholder": "— AI 서비스 기본값 사용 —",
+ "desc": "고급 영역에는 Agent 실행 설정만 유지됩니다. 프롬프트와 매개변수를 여기서 조정할 수 있으며 저장 즉시 적용됩니다. 모델은 워크벤치 상단 바에서 작업별로 선택합니다.",
"promptHint": "{file}(으)로 저장",
"promptPlaceholder": "Agent 시스템 프롬프트...",
"reset": "기본값으로 복원",
@@ -839,4 +836,4 @@
"uhd": "초고화질"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/app/locales/zh.json b/frontend/app/locales/zh.json
index 436be7b..05aabd6 100644
--- a/frontend/app/locales/zh.json
+++ b/frontend/app/locales/zh.json
@@ -342,10 +342,7 @@
},
"agents": {
"title": "Agent 配置",
- "desc": "高级区只保留 Agent 运行配置。这里可以调整模型、提示词和参数,保存后立即生效。",
- "model": "模型",
- "modelHint": "留空使用 AI 服务默认",
- "modelPlaceholder": "— 使用 AI 服务默认 —",
+ "desc": "高级区只保留 Agent 运行配置。这里可以调整提示词和参数,保存后立即生效;模型在工作台顶栏按需选择。",
"promptHint": "保存为 {file}",
"promptPlaceholder": "Agent 系统提示词...",
"reset": "恢复默认",
@@ -839,4 +836,4 @@
"uhd": "超清"
}
}
-}
+}
\ No newline at end of file
diff --git a/frontend/app/pages/settings.vue b/frontend/app/pages/settings.vue
index 82b3c0a..b1177a2 100644
--- a/frontend/app/pages/settings.vue
+++ b/frontend/app/pages/settings.vue
@@ -365,10 +365,6 @@
<ChevronDown :size="14" :style="{ transform: editingAgent === a.type ? 'rotate(180deg)' : '', transition: '0.2s' }" />
</div>
<div v-if="editingAgent === a.type" class="agent-card-body">
- <label class="field">
- <span class="field-label">{{ t('settings.agents.model') }} <span class="dim">({{ t('settings.agents.modelHint') }})</span></span>
- <BaseSelect v-model="agentForm.model" :options="textModelSelectOptions" :placeholder="t('settings.agents.modelPlaceholder')" searchable />
- </label>
<label class="field">
<span class="field-label">System Prompt <span class="dim">({{ t('settings.agents.promptHint', { file: `workspace/prompts/${a.type}.md` }) }})</span></span>
<textarea v-model="agentForm.system_prompt" class="textarea" rows="12" :placeholder="t('settings.agents.promptPlaceholder')" />
@@ -870,7 +866,7 @@ const agentCfgs = ref([])
const editingAgent = ref(null)
const agentSaving = ref(false)
const agentSaved = ref(null)
-const agentForm = reactive({ model: '', system_prompt: '' })
+const agentForm = reactive({ system_prompt: '' })
const agentDefs = computed(() => [
{ type: 'script_rewriter', label: t('settings.agents.scriptRewriter'), icon: '📝' },
@@ -883,22 +879,6 @@ function getAgentCfg(type) {
return agentCfgs.value.find(a => a.agent_type === type)
}
-const textModelGroups = computed(() => {
- return cfgs.value
- .filter(c => c.service_type === 'text' && c.is_active && c.api_key)
- .map(c => ({
- label: `${c.provider} — ${c.name}`,
- models: Array.isArray(c.model) ? c.model : (c.model ? [c.model] : []),
- }))
- .filter(g => g.models.length > 0)
-})
-
-const textModelSelectOptions = computed(() =>
- textModelGroups.value.map(g => ({
- label: g.label,
- options: g.models.map(m => ({ label: m, value: m })),
- }))
-)
async function loadAgents() {
try { agentCfgs.value = await promptAPI.list() }
@@ -909,7 +889,6 @@ async function toggleAgentEdit(type) {
if (editingAgent.value === type) { editingAgent.value = null; return }
try {
const cfg = await promptAPI.get(type)
- agentForm.model = cfg.model || ''
agentForm.system_prompt = cfg.system_prompt || ''
agentSaved.value = null
editingAgent.value = type
@@ -921,7 +900,6 @@ async function resetAgentPrompt(type) {
await promptAPI.reset(type)
await loadAgents()
const cfg = await promptAPI.get(type)
- agentForm.model = cfg.model || ''
agentForm.system_prompt = cfg.system_prompt || ''
toast.success(t('settings.agents.promptReset'))
} catch (e) { toast.error(e.message) }
@@ -933,7 +911,6 @@ async function saveAgentCfg(type) {
try {
await promptAPI.update(type, {
name: agentDefs.value.find(a => a.type === type)?.label || type,
- model: agentForm.model,
system_prompt: agentForm.system_prompt,
})
await loadAgents()