ly0303521

修改视频的参数显示

@@ -58,6 +58,7 @@ class GalleryImage(GalleryItem): @@ -58,6 +58,7 @@ class GalleryImage(GalleryItem):
58 58
59 class GalleryVideo(GalleryItem): 59 class GalleryVideo(GalleryItem):
60 generation_time: Optional[float] = Field(default=None, alias="generationTime") 60 generation_time: Optional[float] = Field(default=None, alias="generationTime")
  61 + seed: Optional[int] = Field(default=None, ge=0)
61 62
62 class ImageGenerationResponse(BaseModel): 63 class ImageGenerationResponse(BaseModel):
63 image: Optional[str] = None 64 image: Optional[str] = None
@@ -114,7 +114,7 @@ const App: React.FC = () => { @@ -114,7 +114,7 @@ const App: React.FC = () => {
114 setVideoStatus({ status: 'submitting', message: '提交中...', task_id: 'temp' }); 114 setVideoStatus({ status: 'submitting', message: '提交中...', task_id: 'temp' });
115 115
116 try { 116 try {
117 - const taskId = await submitVideoJob(params.prompt, imageFile, currentUser.employeeId); 117 + const taskId = await submitVideoJob(params.prompt, imageFile, currentUser.employeeId, params.seed);
118 const finalStatus = await pollVideoStatus(taskId, setVideoStatus); 118 const finalStatus = await pollVideoStatus(taskId, setVideoStatus);
119 119
120 if (!finalStatus.video_filename) { 120 if (!finalStatus.video_filename) {
@@ -91,18 +91,16 @@ const DetailModal: React.FC<DetailModalProps> = ({ image, onClose, onEdit, onGen @@ -91,18 +91,16 @@ const DetailModal: React.FC<DetailModalProps> = ({ image, onClose, onEdit, onGen
91 91
92 <div className="grid grid-cols-2 gap-4"> 92 <div className="grid grid-cols-2 gap-4">
93 <div> 93 <div>
94 - <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">分辨率</label>  
95 - <p className="text-gray-800 dark:text-gray-200 font-mono">  
96 - {image.width || (isVideo ? 1280 : 'N/A')} x {image.height || (isVideo ? 720 : 'N/A')}  
97 - </p>  
98 - </div>  
99 - <div>  
100 <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">随机种子</label> 94 <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">随机种子</label>
101 <p className="text-gray-800 dark:text-gray-200 font-mono">{image.seed !== undefined ? image.seed : 'N/A'}</p> 95 <p className="text-gray-800 dark:text-gray-200 font-mono">{image.seed !== undefined ? image.seed : 'N/A'}</p>
102 </div> 96 </div>
103 {!isVideo && ( 97 {!isVideo && (
104 <> 98 <>
105 <div> 99 <div>
  100 + <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">分辨率</label>
  101 + <p className="text-gray-800 dark:text-gray-200 font-mono">{image.width} x {image.height}</p>
  102 + </div>
  103 + <div>
106 <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">生成步数</label> 104 <label className="block text-xs font-semibold text-gray-400 uppercase mb-1">生成步数</label>
107 <p className="text-gray-800 dark:text-gray-200 font-mono">{image.num_inference_steps || 'N/A'}</p> 105 <p className="text-gray-800 dark:text-gray-200 font-mono">{image.num_inference_steps || 'N/A'}</p>
108 </div> 106 </div>
@@ -5,11 +5,12 @@ import { VideoStatus } from '../types'; @@ -5,11 +5,12 @@ import { VideoStatus } from '../types';
5 * Submits a video generation job to the backend. 5 * Submits a video generation job to the backend.
6 * @returns The task ID for the submitted job. 6 * @returns The task ID for the submitted job.
7 */ 7 */
8 -export const submitVideoJob = async (prompt: string, image: File, authorId: string): Promise<string> => { 8 +export const submitVideoJob = async (prompt: string, image: File, authorId: string, seed: number): Promise<string> => {
9 const formData = new FormData(); 9 const formData = new FormData();
10 formData.append('prompt', prompt); 10 formData.append('prompt', prompt);
11 formData.append('image', image, image.name); 11 formData.append('image', image, image.name);
12 formData.append('author_id', authorId); 12 formData.append('author_id', authorId);
  13 + formData.append('seed', seed.toString());
13 14
14 const submitRes = await fetch(`${TURBO_DIFFUSION_API_URL}/submit-job/`, { 15 const submitRes = await fetch(`${TURBO_DIFFUSION_API_URL}/submit-job/`, {
15 method: 'POST', 16 method: 'POST',