fix: template

This commit is contained in:
root 2025-07-12 21:09:24 +08:00
parent 97ac04a74a
commit 012dafcbde
1 changed files with 57 additions and 1 deletions

View File

@ -101,6 +101,41 @@ export interface TagInfo {
count: number
}
// 轨道片段信息
export interface TrackSegment {
id: string
type: 'video' | 'audio' | 'image' | 'text' | 'effect'
name: string
start_time: number
end_time: number
duration: number
resource_path?: string
properties?: any
effects?: any[]
}
// 轨道信息
export interface Track {
id: string
name: string
type: 'video' | 'audio' | 'subtitle'
index: number
segments: TrackSegment[]
properties?: any
}
// 模板详细信息
export interface TemplateDetail {
id: string
name: string
description: string
canvas_config: any
tracks: Track[]
duration: number
fps: number
sample_rate?: number
}
export class TemplateServiceV2 {
private static currentUserId: string = 'default'
@ -175,7 +210,7 @@ export class TemplateServiceV2 {
}
const response = await invoke<TemplateResponse>('get_template_cli', { request })
if (!response.success) {
throw new Error(response.error || response.message || 'Failed to get template')
}
@ -187,6 +222,27 @@ export class TemplateServiceV2 {
}
}
/**
* ()
* 使get_template_detail命令CLI版本还未实现详细信息功能
*/
static async getTemplateDetail(templateId: string): Promise<TemplateDetail | null> {
try {
// 暂时使用原版本的命令直到CLI版本实现详细信息功能
const response = await invoke<string>('get_template_detail', { template_id: templateId })
const detail = JSON.parse(response)
if (!detail) {
return null
}
return detail as TemplateDetail
} catch (error) {
console.error('Get template detail failed:', error)
return null
}
}
/**
* ()
*/