hit-cxf
2026-04-06 feae5fe9273be79383c21aea43f8fcf9d8a4d61d
添加了设置剧集数量的功能
7 files modified
88 ■■■■■ changed files
aigc-director/aigc-claw/backend/api_server.py 5 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/core/agents/script_agent.py 3 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/prompts/script/generate_script_en.txt 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/prompts/script/generate_script_zh.txt 2 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/HomePage.tsx 74 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/components/WorkflowPanel.tsx 1 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/frontend/lib/workflowApi.ts 1 ●●●●● patch | view | raw | blame | history
aigc-director/aigc-claw/backend/api_server.py
@@ -94,10 +94,11 @@
    video_model: Optional[str] = None
    enable_concurrency: Optional[bool] = True
    web_search: Optional[bool] = False
    episodes: Optional[int] = 4
class InterventionRequest(BaseModel):
    stage: str
    modifications: Dict[str, Any] = {}
    modifications: Dict[str, Any]
# ============================== API ==============================
@@ -128,6 +129,7 @@
        "video_model": req.video_model or settings.VIDEO_MODEL,
        "enable_concurrency": req.enable_concurrency if req.enable_concurrency is not None else True,
        "web_search": req.web_search if req.web_search is not None else False,
        "episodes": req.episodes if req.episodes is not None else 4,
    }
    state.meta = meta
    workflow_engine.save_session_to_disk(session_id, meta)
@@ -140,6 +142,7 @@
            "style": req.style,
            "llm_model": req.llm_model,
            "vlm_model": req.vlm_model,
            "episodes": req.episodes,
        }
    }
aigc-director/aigc-claw/backend/core/agents/script_agent.py
@@ -75,6 +75,7 @@
            style = input_data.get("style", "anime")
            llm_model = input_data.get("llm_model", "qwen3.5-plus")
            web_search = input_data.get("web_search", False)
            episodes = input_data.get("episodes", 4)
            is_zh = any('\u4e00' <= c <= '\u9fff' for c in idea)
            from config import settings as app_settings
@@ -89,7 +90,7 @@
            # 1. Generate full script
            _log_progress(10, "正在生成完整剧本文本...")
            prompt_name = "generate_script"
            prompt = _get_script_prompt(prompt_name, "zh" if is_zh else "en").format(idea=idea, style=style)
            prompt = _get_script_prompt(prompt_name, "zh" if is_zh else "en").format(idea=idea, style=style, episodes=episodes)
            
            loop = asyncio.get_running_loop()
            full_script_text = await loop.run_in_executor(None, self._cancellable_query, llm, prompt, [], llm_model, True, sid, web_search)
aigc-director/aigc-claw/backend/prompts/script/generate_script_en.txt
@@ -43,4 +43,4 @@
{style}
---
Take a deep breath and start your creation. Based on the inspiration above, directly output the complete script text (containing the full content of 4-6 episodes). Do not include any filler words or prefaces.
Take a deep breath and start your creation. Based on the inspiration above, directly output the complete script text (containing the full content of {episodes} episodes, with estimated duration of 1 to 2 minutes per episode). Do not include any filler words or prefaces.
aigc-director/aigc-claw/backend/prompts/script/generate_script_zh.txt
@@ -61,4 +61,4 @@
---
接下来,开始你的创作。根据上述灵感,直接输出完整的剧本正文(包含4-6集的完整内容)。不需要任何废话和前言后语。
接下来,开始你的创作。根据上述灵感,直接输出完整的剧本正文(包含 {episodes} 集的完整内容,每集时长预估1到2分钟)。不需要任何废话和前言后语。
aigc-director/aigc-claw/frontend/components/HomePage.tsx
@@ -1,7 +1,7 @@
'use client';
'use client';
import React, { useState } from 'react';
import { Sparkles, Play, Settings2, Clock, ArrowRight, Zap, CheckCircle, Trash2, X, Lock, Globe } from 'lucide-react';
import { Sparkles, Play, Settings2, Clock, ArrowRight, Zap, CheckCircle, Trash2, X, Lock, Globe, ListOrdered } from 'lucide-react';
import clsx from 'clsx';
import { PROMPT_EXAMPLES } from '@/config/examples';
import { LLM_MODELS, T2I_MODELS, I2I_MODELS, VIDEO_MODELS, VLM_MODELS, STYLES, VIDEO_RATIOS, LLM_PROVIDERS, T2I_PROVIDERS, I2I_PROVIDERS, VIDEO_PROVIDERS, VLM_PROVIDERS, ProviderGroup } from '@/config/models';
@@ -19,6 +19,7 @@
  expand_idea?: boolean;
  enable_concurrency?: boolean;
  web_search?: boolean;
  episodes?: number;
}
interface HistoryItem {
@@ -60,6 +61,8 @@
  const [selectedRatio, setSelectedRatio] = useState('16:9');
  const [enableConcurrency, setEnableConcurrency] = useState(true);
  const [webSearch, setWebSearch] = useState(false);
  const [episodes, setEpisodes] = useState(4);
  const [showEpisodesPanel, setShowEpisodesPanel] = useState(false);
  // 管理模式状态
  const [manageMode, setManageMode] = useState(false);
@@ -94,6 +97,7 @@
      video_model: selectedVideo,
      enable_concurrency: enableConcurrency,
      web_search: webSearch,
      episodes,
    }, auto);
  };
@@ -133,6 +137,72 @@
          <div className="flex items-center justify-between mt-3 pt-3 border-t border-gray-100">
            <div className="flex items-center gap-3">
              <div className="relative">
                <button
                  onClick={() => setShowEpisodesPanel(!showEpisodesPanel)}
                  className={clsx(
                    'flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-colors',
                    showEpisodesPanel
                      ? 'bg-blue-50 text-blue-600'
                      : 'text-gray-400 hover:text-gray-600 hover:bg-gray-50'
                  )}
                >
                  <ListOrdered className="w-3.5 h-3.5" />
                  剧集: {episodes}集
                </button>
                {showEpisodesPanel && (
                  <>
                    <div
                      className="fixed inset-0 z-10"
                      onClick={() => setShowEpisodesPanel(false)}
                    />
                    <div className="absolute bottom-full left-0 mb-2 w-48 bg-white rounded-xl shadow-xl border border-gray-100 p-4 z-20 animate-in fade-in slide-in-from-bottom-2">
                      <div className="flex flex-col gap-3">
                        <div className="flex items-center justify-between">
                          <span className="text-xs font-semibold text-gray-700">设置总集数</span>
                          <span className="text-[10px] text-blue-500 font-bold bg-blue-50 px-1.5 py-0.5 rounded-full">
                            {episodes} 集
                          </span>
                        </div>
                        <div className="flex items-center gap-2">
                          <button
                            onClick={(e) => { e.stopPropagation(); setEpisodes(Math.max(1, episodes - 1)); }}
                            className="w-7 h-7 flex items-center justify-center rounded-lg bg-gray-50 text-gray-600 hover:bg-gray-100 active:scale-95 transition-all text-sm font-bold"
                          >
                            -
                          </button>
                          <input
                            type="range"
                            min={1}
                            max={10}
                            value={episodes}
                            onChange={(e) => setEpisodes(parseInt(e.target.value))}
                            className="flex-1 h-1.5 bg-gray-100 rounded-lg appearance-none cursor-pointer accent-blue-500"
                          />
                          <button
                            onClick={(e) => { e.stopPropagation(); setEpisodes(Math.min(10, episodes + 1)); }}
                            className="w-7 h-7 flex items-center justify-center rounded-lg bg-gray-50 text-gray-600 hover:bg-gray-100 active:scale-95 transition-all text-sm font-bold"
                          >
                            +
                          </button>
                        </div>
                        <div className="space-y-1 border-t border-gray-50 pt-2">
                          <p className="text-[10px] text-gray-400 leading-tight">
                            • 每集预估时长约 1-2 分钟
                          </p>
                          <p className="text-[10px] text-blue-400/80 leading-tight">
                            • 推荐设置 4-6 集
                          </p>
                        </div>
                      </div>
                    </div>
                  </>
                )}
              </div>
              <button
                onClick={() => setShowSettings(!showSettings)}
                className={clsx(
aigc-director/aigc-claw/frontend/components/WorkflowPanel.tsx
@@ -457,6 +457,7 @@
        enable_concurrency: params.enable_concurrency,
        web_search: params.web_search,
        expand_idea: params.expand_idea,
        episodes: params.episodes,
      });
      setSessionId(result.session_id);
aigc-director/aigc-claw/frontend/lib/workflowApi.ts
@@ -64,6 +64,7 @@
  enable_concurrency?: boolean;
  web_search?: boolean;
  expand_idea?: boolean;
  episodes?: number;
}): Promise<{ session_id: string; status: string; params: any }> {
  const resp = await fetch('/api/project/start', {
    method: 'POST',