fix: template
This commit is contained in:
parent
97ac04a74a
commit
012dafcbde
|
|
@ -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'
|
||||
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板 (新版本)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue