### Start Backend Development Source: https://github.com/xuanyustudio/localminidrama/blob/main/CONTRIBUTING.md Instructions to set up and run the backend Node.js server, including installing dependencies, configuring settings, and migrating the database. ```bash cd backend-node npm install cp configs/config.example.yaml configs/config.yaml # 编辑 config.yaml,填入你的 AI API 配置 npm run migrate # 首次运行,初始化数据库 npm start # 默认端口 5679 ``` -------------------------------- ### Clone and Run LocalMiniDrama in Development Mode Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/en.md This snippet outlines the steps to clone the repository, set up the backend and frontend development environments, and start the application. Ensure Node.js is installed and follow the configuration steps for the backend. ```bash git clone https://github.com/your-username/LocalMiniDrama.git cd LocalMiniDrama # 1. Backend (port 5679) cd backend-node npm install cp configs/config.example.yaml configs/config.yaml # Edit config.yaml — set your AI API endpoint and key npm run migrate # first run: initialise DB npm start # 2. Frontend (new terminal, port 3013) cd frontweb npm install npm run dev ``` -------------------------------- ### Start Batch Mix Cut Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Starts a batch video mixing process. Allows uploading up to 120 video files for mixing. ```HTTP POST {baseUrl}/api/v1/mixcut/start Content-Type: multipart/form-data videos: <最多120个视频文件> ``` -------------------------------- ### Start Frontend Development Source: https://github.com/xuanyustudio/localminidrama/blob/main/CONTRIBUTING.md Instructions to set up and run the frontend Vue.js development server. ```bash cd frontweb npm install npm run dev # 默认端口 3013 ``` -------------------------------- ### Package as Executable Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Package the application into an executable installer and portable version for Windows. ```bash cd desktop npm install npm run dist ``` -------------------------------- ### Start Desktop (Electron) Development Source: https://github.com/xuanyustudio/localminidrama/blob/main/CONTRIBUTING.md Instructions to set up and run the Electron-based desktop application. Requires Python and Visual Studio C++ build tools. ```bash cd desktop npm install npm start ``` -------------------------------- ### Start Rewrite Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates a process to improve or rewrite existing content. ```APIDOC ## POST /api/v1/rewrite/start ### Description Initiates a process to improve or rewrite existing content. ### Method POST ### Endpoint /api/v1/rewrite/start ``` -------------------------------- ### Start Originalization Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates a process to make content more original. ```APIDOC ## POST /api/v1/original/start ### Description Initiates a process to make content more original. ### Method POST ### Endpoint /api/v1/original/start ``` -------------------------------- ### Fork and Clone Repository Source: https://github.com/xuanyustudio/localminidrama/blob/main/CONTRIBUTING.md Steps to fork the LocalMiniDrama repository and clone it locally to start development. ```bash # 1. Fork 本仓库,然后克隆你的 Fork git clone https://github.com/你的用户名/LocalMiniDrama.git cd LocalMiniDrama ``` -------------------------------- ### Conventional Commits Example Source: https://github.com/xuanyustudio/localminidrama/blob/main/CONTRIBUTING.md Examples of commit messages following the Conventional Commits specification for different types of changes. ```bash feat: 新增批量生成分镜功能 fix: 修复导出 ZIP 时视频文件丢失的问题 docs: 更新 AI 配置指南中的火山引擎配置说明 ``` -------------------------------- ### Get All AI Configurations Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves a list of all configured AI models. ```APIDOC ## GET /api/v1/ai-configs ### Description Retrieves a list of all configured AI models. ### Method GET ### Endpoint /api/v1/ai-configs ``` -------------------------------- ### Start One-Click Originalization Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Starts the one-click originalization process for content. This endpoint is used to make existing content more original. ```HTTP POST {baseUrl}/api/v1/original/start ``` -------------------------------- ### Get All AI Configurations Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves a list of all configured AI settings. Use this endpoint to view existing AI configurations. ```HTTP GET {baseUrl}/api/v1/ai-configs ``` -------------------------------- ### Get Storyboard Status Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Checks the status of each storyboard video for a given episode. ```bash GET /api/v1/episodes/{episode_id}/storyboards ``` -------------------------------- ### Get Character List Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves the list of characters associated with a drama project. ```bash GET /api/v1/dramas/{drama_id}/characters ``` -------------------------------- ### Get Episode Storyboards Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves the storyboards for a specific episode. ```APIDOC ## GET /api/v1/episodes/{episode_id}/storyboards ### Description Retrieves the generated storyboards for a specific episode. ### Method GET ### Endpoint /api/v1/episodes/{episode_id}/storyboards ### Parameters #### Path Parameters - **episode_id** (string) - Required - The ID of the episode. ``` -------------------------------- ### Start One-Click Translation Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates a one-click translation process for videos, including adding subtitles and background music. Requires uploading video, BGM, and subtitle files, and specifying the target language. ```HTTP POST {baseUrl}/api/v1/globalize/start Content-Type: multipart/form-data file: <视频文件> bgm: subtitle_file: <字幕文件> target_lang: "en" ``` -------------------------------- ### Preset AI Configurations Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Applies a one-click preset for specific AI vendors. Use this for quick setup of common configurations like DashScope (Tongyi Qianwen) or Volcengine (Doubao/Volcano Engine). ```HTTP POST {baseUrl}/api/v1/ai-configs/preset/dashscope # 通义千问 ``` ```HTTP POST {baseUrl}/api/v1/ai-configs/preset/volcengine # 豆包/火山引擎 ``` -------------------------------- ### Get Character List Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves the list of characters associated with a drama project. ```APIDOC ## GET /api/v1/dramas/{drama_id}/characters ### Description Retrieves the list of characters for a given drama project. ### Method GET ### Endpoint /api/v1/dramas/{drama_id}/characters ### Parameters #### Path Parameters - **drama_id** (string) - Required - The ID of the drama project. ``` -------------------------------- ### Merge Final Video Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Merges all generated video segments into a final video. Poll the task until completion. Use GET /api/v1/episodes/{episode_id}/download to get the final video. ```APIDOC ## POST /api/v1/video-merges ### Description Merges all generated video segments into a single final video for the episode. ### Method POST ### Endpoint /api/v1/video-merges ### Response #### Success Response (200) - **task_id** (string) - The ID of the video merge task. Poll this task's status until 'completed'. ### Download Use `GET /api/v1/episodes/{episode_id}/download` to retrieve the final merged video once the merge task is completed. ``` -------------------------------- ### Synthesize Final Video Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates the synthesis of the final video. Requires polling until the process is completed. The final video can be downloaded via a GET request. ```bash POST /api/v1/video-merges → 轮询直到 completed → GET /api/v1/episodes/{episode_id}/download 获取下载 ``` -------------------------------- ### Prompt Overrides Management Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Manages prompt overrides for specific keys. Allows getting, setting, or deleting custom prompt values. ```HTTP GET {baseUrl}/api/v1/settings/prompts ``` ```HTTP PUT {baseUrl}/api/v1/settings/prompts/{key} { "value": "..." } ``` ```HTTP DELETE {baseUrl}/api/v1/settings/prompts/{key} ``` -------------------------------- ### Get Merge Status Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Checks the synthesis status of the final video for a given episode. ```bash GET /api/v1/episodes/{episode_id}/merge-status ``` -------------------------------- ### Start Manuscript Improvement Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates the manuscript improvement process. This endpoint is used for refining written content. ```HTTP POST {baseUrl}/api/v1/rewrite/start ``` -------------------------------- ### Get LocalMiniDrama Backend URL Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Retrieves the base URL for the LocalMiniDrama backend. Defaults to http://localhost:5679 if not configured. ```javascript const baseUrl = config.base_url || "http://localhost:5679"; ``` -------------------------------- ### Get Episode Merge Status Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Checks the merge status of the final video for an episode. ```APIDOC ## GET /api/v1/episodes/{episode_id}/merge-status ### Description Checks the status of the final video merge process for a specific episode. ### Method GET ### Endpoint /api/v1/episodes/{episode_id}/merge-status ### Parameters #### Path Parameters - **episode_id** (string) - Required - The ID of the episode. ``` -------------------------------- ### Build Frontend Source: https://github.com/xuanyustudio/localminidrama/blob/main/AGENTS.md Build the frontend application for production. Navigate to the frontend directory before running the build command. ```bash cd frontweb && npm run build ``` -------------------------------- ### Create Project Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates a new drama project. Remember to record the returned drama_id for subsequent operations. ```bash POST /api/v1/dramas → 记下返回的 drama_id ``` -------------------------------- ### Build Frontend Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Build the frontend for the application. This is a prerequisite for running the Electron app. ```bash cd ../frontweb && npm install && npm run build ``` -------------------------------- ### Import framePromptService and loadConfig Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/plans/2026-03-09-storyboard-angle-and-quad-grid.md Add these lines at the top of `imageService.js` to import necessary modules. Ensure `loadConfig` is moved to the top if it was previously required locally within a function. ```javascript const framePromptService = require('./framePromptService'); const loadConfig = require('../config').loadConfig; ``` -------------------------------- ### Configure Aliyun DashScope for Text, Image, and Video Generation Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/configuration.md Use this configuration to connect to Aliyun DashScope for text, image, or video generation. Ensure you have obtained the correct API Key and selected the appropriate model for your task. ```text 服务商:DashScope Base URL:https://dashscope.aliyuncs.com/compatible-mode/v1 API Key:sk-xxxxxxxxxxxxxxxx 模型:qwen-plus(文本)/ wanx2.1-t2i-turbo(图片)/ wan2.1-t2v-turbo(视频) ``` -------------------------------- ### macOS One-Click Packaging Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Execute the script to package the application for macOS, including full and clean DMG versions, with accelerated domestic mirror usage. ```bash bash dist-mac.sh ``` -------------------------------- ### Storage Configuration Source: https://github.com/xuanyustudio/localminidrama/blob/main/backend-node/README.md Sets the root directory for local storage of images and videos. ```yaml storage: local_path: ./data/storage # 图片/视频本地存储根目录 ``` -------------------------------- ### Build Quad-Grid Prompt in imageService.js Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/plans/2026-03-09-storyboard-angle-and-quadgrid.md This function constructs a detailed prompt for generating a 2x2 storyboard grid image. It requires database access, logging, configuration, storyboard ID, and the AI model. It generates prompts for the first, key, and last frames, then combines them into a single prompt for the quad-grid. ```javascript async function buildQuadGridPrompt(db, log, cfg, storyboardId, model) { const framePromptService = require('./framePromptService'); const sb = framePromptService.loadStoryboard(db, storyboardId); if (!sb) return null; const scene = framePromptService.loadScene(db, sb.scene_id); const characterNames = framePromptService.loadStoryboardCharacterNames(db, storyboardId); const [first, key1, key2, last] = await Promise.all([ framePromptService.generateSingleFrameExported(db, log, cfg, sb, scene, characterNames, model, 'first'), framePromptService.generateSingleFrameExported(db, log, cfg, sb, scene, characterNames, model, 'key'), framePromptService.generateSingleFrameExported(db, log, cfg, sb, scene, characterNames, model, 'key'), framePromptService.generateSingleFrameExported(db, log, cfg, sb, scene, characterNames, model, 'last'), ]); const style = cfg?.style?.default_style || ''; const styleNote = style ? `, consistent style: ${style}` : ''; return `Generate a 2x2 four-panel storyboard grid image (comic strip layout, clear panel borders). Each panel shows a different moment in sequence${styleNote}: Panel 1 (top-left, first frame): ${first.prompt} Panel 2 (top-right, key moment): ${key1.prompt} Panel 3 (bottom-left, key moment): ${key2.prompt} Panel 4 (bottom-right, last frame): ${last.prompt} All panels have consistent character appearance and scene. Clear visible borders between panels. Sequential action progression.`; } ``` -------------------------------- ### Create Project Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Initiates a new drama project. Remember to record the returned drama_id for subsequent operations. ```APIDOC ## POST /api/v1/dramas ### Description Creates a new drama project. ### Method POST ### Endpoint /api/v1/dramas ### Response #### Success Response (200) - **drama_id** (string) - The unique identifier for the newly created drama project. ``` -------------------------------- ### Run Backend Log File Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Locate and open the backend log file to diagnose issues. This is the recommended method for viewing logs. ```powershell %APPDATA%\LocalMiniDrama\backend\logs\app.log ``` -------------------------------- ### Package with Chinese Mirrors Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Package the application using Chinese mirrors for Electron and electron-builder binaries to avoid timeouts. ```bash npm run dist:cn ``` -------------------------------- ### Create AI Configuration Source: https://github.com/xuanyustudio/localminidrama/blob/main/openclaw-skill/SKILL.md Creates a new AI configuration with specified parameters. ```APIDOC ## POST /api/v1/ai-configs ### Description Creates a new AI configuration with specified parameters. ### Method POST ### Endpoint /api/v1/ai-configs ### Request Body - **name** (string) - Required - The name of the AI configuration. - **vendor** (string) - Required - The vendor of the AI model (e.g., 'dashscope'). - **api_key** (string) - Required - The API key for authentication. - **model** (string) - Required - The specific AI model to use (e.g., 'qwen-plus'). - **api_base** (string) - Optional - The base URL for the API endpoint. ### Request Example ```json { "name": "通义千问", "vendor": "dashscope", "api_key": "sk-...", "model": "qwen-plus", "api_base": "https://dashscope.aliyuncs.com/compatible-mode/v1" } ``` ``` -------------------------------- ### Build Quad Grid Prompt Function Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/plans/2026-03-09-storyboard-angle-and-quad-grid.md This asynchronous helper function constructs a prompt for generating a 2x2 storyboard grid image. It loads storyboard and scene data, incorporates drama style and metadata, and generates individual prompts for four frames (first, key, key, last) using `framePromptService.generateSingleFrameForQuadGrid`. ```javascript /** * 四宫格模式:为分镜生成 4 帧提示词,拼成 2×2 grid 格式的单张图生成提示词 */ async function buildQuadGridPrompt(db, log, storyboardId, model) { let cfg = loadConfig(); // 复用 framePromptService 内的辅助函数 const sb = framePromptService.loadStoryboard(db, storyboardId); if (!sb) throw new Error('分镜不存在'); // 读取 drama style try { const epRow = db.prepare( 'SELECT drama_id FROM episodes WHERE id = (SELECT episode_id FROM storyboards WHERE id = ? AND deleted_at IS NULL) AND deleted_at IS NULL' ).get(Number(storyboardId)); if (epRow && epRow.drama_id) { const dramaRow = db.prepare('SELECT style, metadata FROM dramas WHERE id = ? AND deleted_at IS NULL').get(epRow.drama_id); if (dramaRow) { const styleOverrides = {}; if (dramaRow.style && String(dramaRow.style).trim()) { styleOverrides.default_style = String(dramaRow.style).trim(); } if (dramaRow.metadata) { try { const meta = typeof dramaRow.metadata === 'string' ? JSON.parse(dramaRow.metadata) : dramaRow.metadata; if (meta && meta.aspect_ratio) { styleOverrides.default_image_ratio = meta.aspect_ratio; } } catch (_) {} } if (Object.keys(styleOverrides).length > 0) { cfg = { ...cfg, style: { ...(cfg?.style || {}), ...styleOverrides } }; } } } } catch (_) {} const scene = framePromptService.loadScene(db, sb.scene_id); const characterNames = framePromptService.loadStoryboardCharacterNames(db, storyboardId); log.info('[四宫格] 开始生成4帧提示词', { storyboard_id: storyboardId }); const [first, key1, key2, last] = await Promise.all([ framePromptService.generateSingleFrameForQuadGrid(db, log, cfg, sb, scene, characterNames, model, 'first'), framePromptService.generateSingleFrameForQuadGrid(db, log, cfg, sb, scene, characterNames, model, 'key'), framePromptService.generateSingleFrameForQuadGrid(db, log, cfg, sb, scene, characterNames, model, 'key'), framePromptService.generateSingleFrameForQuadGrid(db, log, cfg, sb, scene, characterNames, model, 'last'), ]); log.info('[四宫格] 4帧提示词生成完成', { storyboard_id: storyboardId }); const style = cfg?.style?.default_style || ''; const styleHint = style ? `, art style: ${style}` : ''; const quadPrompt = `Generate a 2x2 storyboard grid image (four panels showing action sequence progression${styleHint}). ` + `Each panel is clearly separated by a thin border. ` + `Panel 1 (top-left, initial state): ${first.prompt}. ` + `Panel 2 (top-right, action begins): ${key1.prompt}. ` + `Panel 3 (bottom-left, action climax): ${key2.prompt}. ` + `Panel 4 (bottom-right, final state): ${last.prompt}. ` + `Consistent character appearance and scene across all panels. Cinematic quality.`; return quadPrompt; } ``` -------------------------------- ### Run from Command Line for Real-time Logs Source: https://github.com/xuanyustudio/localminidrama/blob/main/desktop/README.md Execute the application from the command line to view real-time logs directly in the terminal. ```powershell & "D:\path\to\release\LocalMiniDrama 1.2.8.exe" ``` -------------------------------- ### Add QuadGridMode Reactive Variable in Vue Source: https://github.com/xuanyustudio/localminidrama/blob/main/docs/plans/2026-03-09-storyboard-angle-and-quad-grid.md This Vue.js JavaScript snippet shows how to declare a new reactive boolean variable `quadGridMode` within a `