-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathtypings.d.ts
163 lines (136 loc) · 2.88 KB
/
typings.d.ts
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
interface MethodContext {
from: 'extension' | 'inject' | 'app'
event: any
tabId?: number
// sender?: chrome.runtime.MessageSender | null
}
interface EnvData {
sidePanel?: boolean
manualInsert?: boolean //是否手动插入字幕列表
autoExpand?: boolean
flagDot?: boolean
aiType?: 'openai' | 'gemini'
// openai
apiKey?: string
serverUrl?: string
model?: string
customModel?: string
customModelTokens?: number
// gemini
geminiApiKey?: 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'
// search
searchEnabled?: boolean
cnSearchEnabled?: boolean
// ask
askEnabled?: boolean
prompts?: {
[key: string]: string
}
}
interface TempData {
curSummaryType: SummaryType
downloadType?: string
compact?: boolean // 是否紧凑视图
reviewActions?: number // 点击或总结行为达到一定次数后,显示评分(一个视频最多只加1次)
reviewed?: boolean // 是否点击过评分,undefined: 不显示;true: 已点击;false: 未点击(需要显示)
}
interface TaskDef {
type: 'chatComplete' | 'geminiChatComplete'
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 AskInfo {
id: string
fold?: boolean
question: string
status: SummaryStatus
error?: string
content?: string
}
type PartialOfAskInfo = Partial<PartOfAskInfo>
/**
* 概览
*/
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' | 'question' | 'debate'
interface DebateMessage {
side: 'pro' | 'con';
content: string;
}
interface DebateProps {
messages: DebateMessage[];
}