This commit is contained in:
IndieKKY
2023-05-17 16:37:56 +08:00
commit 858f83a45c
59 changed files with 8855 additions and 0 deletions

106
src/typings.d.ts vendored Normal file
View File

@@ -0,0 +1,106 @@
interface EnvData {
autoExpand?: boolean
flagDot?: boolean
apiKey?: string
serverUrl?: string
translateEnable?: boolean
language?: string
hideOnDisableAutoTranslate?: boolean
transDisplay?: 'target' | 'originPrimary' | 'targetPrimary'
fetchAmount?: number
summarizeEnable?: boolean
summarizeLanguage?: string
words?: number
summarizeFloat?: boolean
theme?: 'system' | 'light' | 'dark'
fontSize?: 'normal' | 'large'
}
interface TaskDef {
type: 'chatComplete'
serverUrl?: string
data: any
extra?: any
}
interface Task {
id: string
startTime: number
endTime?: number
def: TaskDef
status: 'pending' | 'running' | 'done'
error?: string
resp?: any
}
interface TransResult {
// idx: number
code?: '200' | '500'
data?: string
}
type ShowElement = string | JSX.Element | undefined
interface Transcript {
body: TranscriptItem[]
}
interface TranscriptItem {
from: number
to: number
content: string
idx: number
}
interface Segment {
items: TranscriptItem[]
startIdx: number // 从1开始
endIdx: number
text: string
fold?: boolean
summaries: {
[type: string]: Summary
}
}
interface OverviewItem {
time: string
emoji: string
key: string
}
interface Summary {
type: SummaryType
status: SummaryStatus
error?: string
content?: any
}
/**
* 概览
*/
interface OverviewSummary extends Summary {
content?: OverviewItem[]
}
/**
* 要点
*/
interface KeypointSummary extends Summary {
content?: string[]
}
/**
* 总结
*/
interface BriefSummary extends Summary {
content?: {
summary: string
}
}
type SummaryStatus = 'init' | 'pending' | 'done'
type SummaryType = 'overview' | 'keypoint' | 'brief'