File size: 28,270 Bytes
bf1eaec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LTX-2 | Multi-GPU Cinematic Studio</title>
        <link rel="stylesheet" href="index.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.8/plyr.css" />
</head>
<body>

<aside class="sidebar">
    <div class="sidebar-header">
        <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;">
            <div style="display: flex; align-items: center; gap: 10px;">
                <div id="sys-indicator" class="indicator-ready" style="width: 12px; height: 12px; border-radius: 50%;"></div>
                <span style="font-weight: 800; font-size: 18px;">LTX-2 STUDIO</span>
            </div>
            <div style="display: flex; gap: 8px; align-items: center;">
                <button type="button" id="lang-toggle-btn" class="lang-toggle">EN</button>
                <button id="clearGpuBtn" onclick="clearGpu()" class="btn-outline" data-i18n="clearVram">释放显存</button>
            </div>
        </div>
        
        <div class="top-status" style="margin-bottom: 5px;">
            <div style="display: flex; align-items: center; gap: 8px;">
                <span id="sys-status" style="font-weight:bold; color: var(--text-dim); font-size: 12px;" data-i18n="sysScanning">正在扫描 GPU...</span>
            </div>
            
            <button type="button" onclick="const el = document.getElementById('sys-settings'); el.style.display = el.style.display === 'none' ? 'block' : 'none';" class="btn-icon" data-i18n-title="settingsTitle" title="系统高级设置">
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
            </button>

        </div>
        
        <div style="font-size: 11px; color: var(--text-dim); margin-bottom: 20px; display: flex; align-items: center; width: 100%;">
            <div class="vram-bar" style="width: 120px; min-width: 120px; margin-top: 0; margin-right: 12px;"><div class="vram-used" id="vram-fill"></div></div> 
            <span id="vram-text" style="font-variant-numeric: tabular-nums; flex-shrink: 0; text-align: right;">0/32 GB</span>
            <span id="gpu-name" style="display: none;"></span> <!-- Hidden globally to avoid duplicate -->
        </div>
        
        <div id="sys-settings" style="display: none; padding: 14px; background: rgba(0,0,0,0.4) !important; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); margin-bottom: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); backdrop-filter: blur(10px);">
            <div style="font-size: 13px; font-weight: bold; margin-bottom: 12px; color: #fff;" data-i18n="advancedSettings">高级设置</div>
            
            <label style="font-size: 11px; margin-bottom: 6px;" data-i18n="deviceSelect">工作设备选择</label>
            <select id="gpu-selector" onchange="switchGpu(this.value)" style="margin-bottom: 12px; font-size: 11px; padding: 6px;">
                <option value="" data-i18n="gpuDetecting">正在检测 GPU...</option>
            </select>
            
            
            <label style="font-size: 11px; margin-bottom: 6px; margin-top: 12px;" data-i18n="modelLoraSettings">模型与LoRA设置</label>
            <div id="lora-placement-hint" style="font-size: 11px; color: var(--text-dim); margin-top: 8px; line-height: 1.4;" data-i18n="loraPlacementHint">
                </div>
        </div>
    </div>

    <div class="sidebar-section">
        <div class="tabs">
            <div id="tab-video" class="tab" onclick="switchMode('video')">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right: 6px;"><rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"></rect><line x1="7" y1="2" x2="7" y2="22"></line><line x1="17" y1="2" x2="17" y2="22"></line><line x1="2" y1="12" x2="22" y2="12"></line><line x1="2" y1="7" x2="7" y2="7"></line><line x1="2" y1="17" x2="7" y2="17"></line><line x1="17" y1="17" x2="22" y2="17"></line><line x1="17" y1="7" x2="22" y2="7"></line></svg>
                <span data-i18n="tabVideo">视频生成</span>
            </div>
            <div id="tab-batch" class="tab" onclick="switchMode('batch')">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right: 6px;"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>
                <span data-i18n="tabBatch">智能多帧</span>
            </div>
            <div id="tab-upscale" class="tab" onclick="switchMode('upscale')">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right: 6px;"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>
                <span data-i18n="tabUpscale">视频增强</span>
            </div>
            <div id="tab-image" class="tab" onclick="switchMode('image')">
                <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-right: 6px;"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
                <span data-i18n="tabImage">图像生成</span>
            </div>
        </div>
        
        <label data-i18n="promptLabel">视觉描述词 (Prompt)</label>
        <textarea id="prompt" data-i18n-placeholder="promptPlaceholder" placeholder="在此输入视觉描述词 (Prompt)..." style="height: 90px; margin-bottom: 0;"></textarea>
    </div>

    <!-- 视频模式选项 -->
    <div class="sidebar-section" id="video-opts" style="display:none">
        <div class="setting-group">
            <div class="group-title" data-i18n="basicEngine">基础画面 / Basic EngineSpecs</div>
            <div class="flex-row">
                <div class="flex-1">
                    <label data-i18n="qualityLevel">清晰度级别</label>
                    <select id="vid-quality" onchange="updateResPreview()">
                        <option value="1080">1080P Full HD</option>
                        <option value="720" selected>720P Standard</option>
                        <option value="540">540P Preview</option>
                    </select>
                </div>
                <div class="flex-1">
                    <label data-i18n="aspectRatio">画幅比例</label>
                    <select id="vid-ratio" onchange="updateResPreview()">
                        <option value="16:9" data-i18n="ratio169">16:9 电影宽幅</option>
                        <option value="9:16" data-i18n="ratio916">9:16 移动竖屏</option>
                    </select>
                </div>
            </div>
            <div id="res-preview" class="res-preview-tag" style="margin-top: -5px; margin-bottom: 12px;">最终发送: 1280x704</div>

            <div class="flex-row">
                <div class="flex-1">
                    <label data-i18n="fpsLabel">帧率 (FPS)</label>
                    <select id="vid-fps">
                        <option value="24" selected>24 FPS</option>
                        <option value="25">25 FPS</option>
                        <option value="30">30 FPS</option>
                        <option value="48">48 FPS</option>
                        <option value="60">60 FPS</option>
                    </select>
                </div>
                <div class="flex-1">
                    <label data-i18n="durationLabel">时长 (秒)</label>
                    <input type="number" id="vid-duration" value="5" min="1" max="30" step="1">
                </div>
            </div>

            <label style="margin-top: 12px;" data-i18n="cameraMotion">镜头运动方式</label>
            <select id="vid-motion">
                <option value="static" selected data-i18n="motionStatic">Static (静止机位)</option>
                <option value="dolly_in" data-i18n="motionDollyIn">Dolly In (推近)</option>
                <option value="dolly_out" data-i18n="motionDollyOut">Dolly Out (拉远)</option>
                <option value="dolly_left" data-i18n="motionDollyLeft">Dolly Left (向左)</option>
                <option value="dolly_right" data-i18n="motionDollyRight">Dolly Right (向右)</option>
                <option value="jib_up" data-i18n="motionJibUp">Jib Up (升臂)</option>
                <option value="jib_down" data-i18n="motionJibDown">Jib Down (降臂)</option>
                <option value="focus_shift" data-i18n="motionFocus">Focus Shift (焦点)</option>
            </select>
            <div class="checkbox-container" style="margin-top: 8px;">
                <input type="checkbox" id="vid-audio" checked>
                <label for="vid-audio" data-i18n="audioGen">生成 AI 环境音 (Audio Gen)</label>
            </div>

            <label style="margin-top: 12px;" data-i18n="selectModel">选择模型</label>
            <select id="vid-model" style="margin-bottom: 8px;">
                <option value="" data-i18n="defaultModel">使用默认模型</option>
            </select>
            <label data-i18n="selectLora">选择 LoRA</label>
            <select id="vid-lora" onchange="updateLoraStrength()" style="margin-bottom: 8px;">
                <option value="" data-i18n="noLora">不使用 LoRA</option>
            </select>
            <div id="lora-strength-container" style="display: none;">
                <label data-i18n="loraStrength">LoRA 强度</label>
                <input type="range" id="lora-strength" min="0.1" max="2.0" step="0.1" value="1.0" style="width: 100%;" oninput="document.getElementById('lora-strength-val').textContent = this.value">
                <span id="lora-strength-val" style="font-size: 12px; color: var(--accent);">1.0</span>
            </div>
        </div>

        <!-- 生成媒介组 -->
        <div class="setting-group" id="video-source-group">
            <div class="group-title" data-i18n="genSource">生成媒介 / Generation Source</div>
            
            <div class="flex-row" style="margin-bottom: 10px;">
                <div class="flex-1">
                    <label data-i18n="startFrame">起始帧 (首帧)</label>
                    <div class="upload-zone" id="start-frame-drop-zone" onclick="document.getElementById('start-frame-input').click()">
                        <div class="clear-img-overlay" id="clear-start-frame-overlay" onclick="event.stopPropagation(); clearFrame('start')">×</div>
                        <div id="start-frame-placeholder">
                            <div class="upload-icon">🖼️</div>
                            <div class="upload-text" data-i18n="uploadStart">上传首帧</div>
                        </div>
                        <img id="start-frame-preview" class="preview-thumb">
                        <input type="file" id="start-frame-input" accept="image/*" style="display:none" onchange="handleFrameUpload(this.files[0], 'start')">
                    </div>
                    <input type="hidden" id="start-frame-path">
                </div>
                <div class="flex-1">
                    <label data-i18n="endFrame">结束帧 (尾帧)</label>
                    <div class="upload-zone" id="end-frame-drop-zone" onclick="document.getElementById('end-frame-input').click()">
                        <div class="clear-img-overlay" id="clear-end-frame-overlay" onclick="event.stopPropagation(); clearFrame('end')">×</div>
                        <div id="end-frame-placeholder">
                            <div class="upload-icon">🏁</div>
                            <div class="upload-text" data-i18n="uploadEnd">上传尾帧 (可选)</div>
                        </div>
                        <img id="end-frame-preview" class="preview-thumb">
                        <input type="file" id="end-frame-input" accept="image/*" style="display:none" onchange="handleFrameUpload(this.files[0], 'end')">
                    </div>
                    <input type="hidden" id="end-frame-path">
                </div>
            </div>

            <div class="flex-row">
                <div class="flex-1">
                    <label data-i18n="refAudio">参考音频 (A2V)</label>
                    <div class="upload-zone" id="audio-drop-zone" onclick="document.getElementById('vid-audio-input').click()">
                        <div class="clear-img-overlay" id="clear-audio-overlay" onclick="event.stopPropagation(); clearUploadedAudio()">×</div>
                        <div id="audio-upload-placeholder">
                            <div class="upload-icon">🎵</div>
                            <div class="upload-text" data-i18n="uploadAudio">点击上传音频</div>
                        </div>
                        <div id="audio-upload-status" style="display:none;">
                            <div class="upload-icon" style="color:var(--accent); opacity:1;">✔️</div>
                            <div id="audio-filename-status" class="upload-text"></div>
                        </div>
                        <input type="file" id="vid-audio-input" accept="audio/*" style="display:none" onchange="handleAudioUpload(this.files[0])">
                    </div>
                    <input type="hidden" id="uploaded-audio-path">
                </div>
            </div>
            <div style="font-size: 10px; color: var(--text-dim); text-align: center; margin-top: 5px;" data-i18n="sourceHint">
                💡 若仅上传首帧 = 图生视频/音视频;若同时上传首尾帧 = 首尾插帧。
            </div>
        </div>
    </div>

    <!-- 图像模式选项 -->
    <div id="image-opts" class="sidebar-section" style="display:none">
        <label data-i18n="imgPreset">预设分辨率 (Presets)</label>
        <select id="img-res-preset" onchange="applyImgPreset(this.value)">
            <option value="1024x1024" data-i18n="imgOptSquare">1:1 Square (1024x1024)</option>
            <option value="1280x720" data-i18n="imgOptLand">16:9 Landscape (1280x720)</option>
            <option value="720x1280" data-i18n="imgOptPort">9:16 Portrait (720x1280)</option>
            <option value="custom" data-i18n="imgOptCustom">Custom 自定义...</option>
        </select>

        <div id="img-custom-res" class="flex-row" style="margin-top: 10px;">
            <div class="flex-1"><label data-i18n="width">宽度</label><input type="number" id="img-w" value="1024" onchange="updateImgResPreview()"></div>
            <div class="flex-1"><label data-i18n="height">高度</label><input type="number" id="img-h" value="1024" onchange="updateImgResPreview()"></div>
        </div>
        <div id="img-res-preview" class="res-preview-tag">最终发送: 1024x1024</div>
        
        <div class="label-group" style="margin-top: 15px;">
            <label data-i18n="samplingSteps">采样步数 (Steps)</label>
            <span class="val-badge" id="stepsVal">28</span>
        </div>
        <div class="slider-container">
            <input type="range" id="img-steps" min="1" max="50" value="28" oninput="document.getElementById('stepsVal').innerText=this.value">
        </div>
    </div>

    <!-- 超分模式选项 -->
    <div id="upscale-opts" class="sidebar-section" style="display:none">
        <div class="setting-group">
            <label data-i18n="upscaleSource">待超分视频 (Source)</label>
            <div class="upload-zone" id="upscale-drop-zone" onclick="document.getElementById('upscale-video-input').click()" style="margin-bottom: 0;">
                <div class="clear-img-overlay" id="clear-upscale-overlay" onclick="event.stopPropagation(); clearUpscaleVideo()">×</div>
                <div id="upscale-placeholder">
                    <div class="upload-icon">📹</div>
                    <div class="upload-text" data-i18n="upscaleUpload">拖入低分辨率视频片段</div>
                </div>
                <div id="upscale-status" style="display:none;">
                    <div class="upload-icon" style="color:var(--accent); opacity:1;">✔️</div>
                    <div id="upscale-filename" class="upload-text"></div>
                </div>
                <input type="file" id="upscale-video-input" accept="video/*" style="display:none" onchange="handleUpscaleVideoUpload(this.files[0])">
            </div>
            <input type="hidden" id="upscale-video-path">
        </div>

        <div class="setting-group">
            <label data-i18n="targetRes">目标分辨率</label>
            <select id="upscale-res" style="margin-bottom: 0;">
                <option value="1080p" data-i18n="upscale1080">1080P Full HD (2x)</option>
                <option value="720p" data-i18n="upscale720">720P HD</option>
            </select>
        </div>
        </div>

    <!-- 智能多帧模式 -->
    <div class="sidebar-section" id="batch-opts" style="display:none">
        <div class="setting-group">
            <div class="group-title" data-i18n="smartMultiFrameGroup">智能多帧</div>
            <div class="smart-param-mode-label" data-i18n="workflowModeLabel">工作流模式(点击切换)</div>
            <div class="smart-param-modes" role="radiogroup" aria-label="工作流模式">
                <label class="smart-param-mode-opt">
                    <input type="radio" name="batch-workflow" value="single" checked onchange="onBatchWorkflowChange()">
                    <span class="smart-param-mode-title" data-i18n="wfSingle">单次多关键帧</span>
                </label>
                <label class="smart-param-mode-opt">
                    <input type="radio" name="batch-workflow" value="segments" onchange="onBatchWorkflowChange()">
                    <span class="smart-param-mode-title" data-i18n="wfSegments">分段拼接</span>
                </label>
            </div>
            
            <label data-i18n="uploadImages">上传图片</label>
            <div class="upload-zone" id="batch-images-drop-zone" onclick="document.getElementById('batch-images-input').click()" style="min-height: 72px; margin-bottom: 0;">
                <div id="batch-images-placeholder">
                    <div class="upload-icon">📁</div>
                    <div class="upload-text" data-i18n="uploadMulti1">点击或拖入多张图片</div>
                    <div class="upload-hint" data-i18n="uploadMulti2">支持一次选多张,可多次添加</div>
                </div>
                <input type="file" id="batch-images-input" accept="image/*" multiple style="display:none" onchange="handleBatchImagesUpload(this.files, true)">
            </div>
            <input type="hidden" id="batch-images-path">

            <div class="batch-thumb-strip-wrap" id="batch-thumb-strip-wrap" style="display: none;">
                <div class="batch-thumb-strip-head">
                    <span class="batch-thumb-strip-title" data-i18n="batchStripTitle">已选图片 · 顺序 = 播放先后</span>
                    <span class="batch-thumb-strip-hint" data-i18n="batchStripHint">在缩略图上按住拖动排序;松手落入虚线框位置</span>
                </div>
                <div class="batch-images-container" id="batch-images-container"></div>
            </div>

            <div style="font-size: 10px; color: var(--text-dim); margin-bottom: 12px; margin-top: 10px; line-height: 1.45;" data-i18n-html="batchFfmpegHint">
                💡 <strong>分段模式</strong>:2 张 = 1 段;3 张 = 2 段再拼接。<strong>单次模式</strong>:几张图就几个 latent 锚点,一条视频出片。<br>
                多段需 <code style="font-size:9px;">ffmpeg</code>:装好后加 PATH,或设环境变量 <code style="font-size:9px;">LTX_FFMPEG_PATH</code>,或在 <code style="font-size:9px;">%LOCALAPPDATA%\LTXDesktop\ffmpeg_path.txt</code> 第一行写 ffmpeg.exe 完整路径。
            </div>

            <label style="margin-top: 4px;" data-i18n="globalPromptLabel">本页全局补充词(可选)</label>
            <textarea id="batch-common-prompt" data-i18n-placeholder="globalPromptPh" placeholder="与顶部主 Prompt 叠加;单次模式与分段模式均可用" style="width: 100%; height: 56px; margin-bottom: 10px; padding: 8px; font-size: 11px; box-sizing: border-box; resize: vertical; border-radius: 8px; border: 1px solid var(--border); background: var(--item); color: var(--text);"></textarea>

            <label style="margin-top: 8px;" data-i18n="bgmLabel">成片配乐(可选,统一音轨)</label>
            <div class="upload-zone" id="batch-audio-drop-zone" onclick="document.getElementById('batch-audio-input').click()" style="min-height: 44px; margin-bottom: 8px; position: relative;">
                <div class="clear-img-overlay" id="clear-batch-audio-overlay" onclick="event.stopPropagation(); clearBatchBackgroundAudio()" style="display: none;">×</div>
                <div id="batch-audio-placeholder">
                    <div class="upload-text" style="font-size: 11px;" data-i18n="bgmUploadHint">上传一条完整 BGM(生成完成后会替换整段成片的音轨)</div>
                </div>
                <div id="batch-audio-status" style="display: none; font-size: 11px; color: var(--accent);"></div>
                <input type="file" id="batch-audio-input" accept="audio/*" style="display:none" onchange="handleBatchBackgroundAudioUpload(this.files[0])">
            </div>
            <input type="hidden" id="batch-background-audio-path">

            <div id="batch-segments-container" style="margin-top: 15px;"></div>
        </div>

        <div class="setting-group">
            <div class="group-title" data-i18n="basicEngine">基础画面 / Basic EngineSpecs</div>
            <div class="flex-row">
                <div class="flex-1">
                    <label data-i18n="qualityLevel">清晰度级别</label>
                    <select id="batch-quality" onchange="updateBatchResPreview()">
                        <option value="1080">1080P Full HD</option>
                        <option value="720" selected>720P Standard</option>
                        <option value="540">540P Preview</option>
                    </select>
                </div>
                <div class="flex-1">
                    <label data-i18n="aspectRatio">画幅比例</label>
                    <select id="batch-ratio" onchange="updateBatchResPreview()">
                        <option value="16:9" data-i18n="ratio169">16:9 电影宽幅</option>
                        <option value="9:16" data-i18n="ratio916">9:16 移动竖屏</option>
                    </select>
                </div>
            </div>
            <div id="batch-res-preview" class="res-preview-tag" style="margin-top: -5px; margin-bottom: 12px;">最终发送: 1280x704</div>

            <label data-i18n="selectModel">选择模型</label>
            <select id="batch-model" style="margin-bottom: 8px;">
                <option value="" data-i18n="defaultModel">使用默认模型</option>
            </select>
            <label data-i18n="selectLora">选择 LoRA</label>
            <select id="batch-lora" onchange="updateBatchLoraStrength()" style="margin-bottom: 8px;">
                <option value="" data-i18n="noLora">不使用 LoRA</option>
            </select>
            <div id="batch-lora-strength-container" style="display: none;">
                <label data-i18n="loraStrength">LoRA 强度</label>
                <input type="range" id="batch-lora-strength" min="0.1" max="2.0" step="0.1" value="1.2" style="width: 100%;" oninput="document.getElementById('batch-lora-strength-val').textContent = this.value">
                <span id="batch-lora-strength-val" style="font-size: 12px; color: var(--accent);">1.2</span>
            </div>
        </div>
    </div>

    <div style="padding: 0 30px 30px 30px;">
        <button class="btn-primary" id="mainBtn" onclick="run()" data-i18n="mainRender">开始渲染</button>
    </div>
</aside>

<main class="workspace">
    <section class="viewer" id="viewer-section">
        <div class="monitor" id="viewer">
            <div id="loading-txt" data-i18n="waitingTask">等待分配渲染任务...</div>
            <img id="res-img" src="">
            <div id="video-wrapper" style="width:100%; height:100%; display:none; max-height:100%; align-items:center; justify-content:center;">
                <video id="res-video" autoplay loop playsinline></video>
            </div>
            <div class="progress-container"><div id="progress-fill"></div></div>
        </div>
    </section>

    <!-- Drag Handle -->
    <div id="resize-handle" style="
        height: 5px; background: transparent; cursor: row-resize;
        flex-shrink: 0; position: relative; z-index: 50;
        display: flex; align-items: center; justify-content: center;
    " data-i18n-title="resizeHandleTitle" title="拖动调整面板高度">
        <div style="width: 40px; height: 3px; background: var(--border); border-radius: 999px; pointer-events: none;"></div>
    </div>

    <section class="library" id="library-section">
        <div style="display: flex; justify-content: space-between; margin-bottom: 15px; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 10px;">
            <div style="display: flex; gap: 20px;">
                <span id="tab-history" style="font-size: 11px; font-weight: 800; color: var(--accent); cursor: pointer; border-bottom: 2px solid var(--accent); padding-bottom: 11px; margin-bottom: -11px;" onclick="switchLibTab('history')" data-i18n="libHistory">历史资产 / ASSETS</span>
                <span id="tab-log" style="font-size: 11px; font-weight: 800; color: var(--text-dim); cursor: pointer; border-bottom: 2px solid transparent; padding-bottom: 11px; margin-bottom: -11px;" onclick="switchLibTab('log')" data-i18n="libLog">系统日志 / LOGS</span>
            </div>
            <button type="button" onclick="fetchHistory(currentHistoryPage)" style="background: var(--item); border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim); font-size: 11px; padding: 4px 10px; cursor: pointer;" data-i18n="refresh">刷新</button>
        </div>
        
        <div id="log-container" style="display: none; flex: 1; flex-direction: column;">
            <div id="log" data-i18n="logReady">> LTX-2 Studio Ready. Expecting commands...</div>
        </div>
        
        <div id="history-wrapper">
            <div id="history-container"></div>
        </div>
        <div id="pagination-bar" style="display:none;"></div>
    </section>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/plyr/3.7.8/plyr.min.js"></script>
<script src="i18n.js"></script>
<script src="index.js"></script>

</body>
</html>