You've already forked bilibili-subtitle
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1f1d48b56a | ||
![]() |
02b7a09f42 | ||
![]() |
9320928b34 | ||
![]() |
1fbdeaa8f6 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "哔哩哔哩字幕列表",
|
"name": "哔哩哔哩字幕列表",
|
||||||
"description": "显示B站视频的字幕列表,可点击跳转与下载字幕,并支持翻译和总结字幕!",
|
"description": "显示B站视频的字幕列表,可点击跳转与下载字幕,并支持翻译和总结字幕!",
|
||||||
"version": "1.10.0",
|
"version": "1.10.2",
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"storage"
|
"storage"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "bilibili-subtitle",
|
"name": "bilibili-subtitle",
|
||||||
"version": "1.10.0",
|
"version": "1.10.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "哔哩哔哩字幕列表",
|
"description": "哔哩哔哩字幕列表",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
@@ -75,26 +75,27 @@ const MoreBtn = (props: Props) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let s, fileName
|
let fileName = title
|
||||||
|
let s, suffix
|
||||||
if (!downloadType || downloadType === 'text') {
|
if (!downloadType || downloadType === 'text') {
|
||||||
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
||||||
for (const item of data.body) {
|
for (const item of data.body) {
|
||||||
s += item.content + '\n'
|
s += item.content + '\n'
|
||||||
}
|
}
|
||||||
fileName = 'download.txt'
|
suffix = 'txt'
|
||||||
} else if (downloadType === 'textWithTime') {
|
} else if (downloadType === 'textWithTime') {
|
||||||
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
||||||
for (const item of data.body) {
|
for (const item of data.body) {
|
||||||
s += formatTime(item.from) + ' ' + item.content + '\n'
|
s += formatTime(item.from) + ' ' + item.content + '\n'
|
||||||
}
|
}
|
||||||
fileName = 'download.txt'
|
suffix = 'txt'
|
||||||
} else if (downloadType === 'article') {
|
} else if (downloadType === 'article') {
|
||||||
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
||||||
for (const item of data.body) {
|
for (const item of data.body) {
|
||||||
s += item.content + ', '
|
s += item.content + ', '
|
||||||
}
|
}
|
||||||
s = s.substring(0, s.length - 1) // remove last ','
|
s = s.substring(0, s.length - 1) // remove last ','
|
||||||
fileName = 'download.txt'
|
suffix = 'txt'
|
||||||
} else if (downloadType === 'srt') {
|
} else if (downloadType === 'srt') {
|
||||||
/**
|
/**
|
||||||
* 1
|
* 1
|
||||||
@@ -113,7 +114,7 @@ const MoreBtn = (props: Props) => {
|
|||||||
s += ss
|
s += ss
|
||||||
}
|
}
|
||||||
s = s.substring(0, s.length - 1)// remove last '\n'
|
s = s.substring(0, s.length - 1)// remove last '\n'
|
||||||
fileName = 'download.srt'
|
suffix = 'srt'
|
||||||
} else if (downloadType === 'vtt') {
|
} else if (downloadType === 'vtt') {
|
||||||
/**
|
/**
|
||||||
* WEBVTT title
|
* WEBVTT title
|
||||||
@@ -134,21 +135,22 @@ const MoreBtn = (props: Props) => {
|
|||||||
s += ss
|
s += ss
|
||||||
}
|
}
|
||||||
s = s.substring(0, s.length - 1)// remove last '\n'
|
s = s.substring(0, s.length - 1)// remove last '\n'
|
||||||
fileName = 'download.vtt'
|
suffix = 'vtt'
|
||||||
} else if (downloadType === 'json') {
|
} else if (downloadType === 'json') {
|
||||||
s = JSON.stringify(data)
|
s = JSON.stringify(data)
|
||||||
fileName = 'download.json'
|
suffix = 'json'
|
||||||
} else if (downloadType === 'summarize') {
|
} else if (downloadType === 'summarize') {
|
||||||
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
s = `${title??'无标题'}\n${url??'无链接'}\n\n`
|
||||||
const [success, content] = getSummarize(title, segments, curSummaryType)
|
const [success, content] = getSummarize(title, segments, curSummaryType)
|
||||||
if (!success) return
|
if (!success) return
|
||||||
s += content
|
s += content
|
||||||
fileName = '总结.txt'
|
fileName += ' - 总结'
|
||||||
|
suffix = 'txt'
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (download) {
|
if (download) {
|
||||||
downloadText(s, fileName)
|
downloadText(s, fileName+'.'+suffix)
|
||||||
} else {
|
} else {
|
||||||
navigator.clipboard.writeText(s).then(() => {
|
navigator.clipboard.writeText(s).then(() => {
|
||||||
toast.success('复制成功')
|
toast.success('复制成功')
|
||||||
|
@@ -11,6 +11,7 @@ import {
|
|||||||
LANGUAGES,
|
LANGUAGES,
|
||||||
MODEL_DEFAULT,
|
MODEL_DEFAULT,
|
||||||
MODEL_MAP,
|
MODEL_MAP,
|
||||||
|
MODEL_TIP,
|
||||||
MODELS,
|
MODELS,
|
||||||
PAGE_MAIN,
|
PAGE_MAIN,
|
||||||
PROMPT_DEFAULTS,
|
PROMPT_DEFAULTS,
|
||||||
@@ -257,13 +258,18 @@ const Settings = () => {
|
|||||||
{MODELS.map(model => <option key={model.code} value={model.code}>{model.name}</option>)}
|
{MODELS.map(model => <option key={model.code} value={model.code}>{model.name}</option>)}
|
||||||
</select>
|
</select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<div className='desc text-xs'>
|
||||||
|
{MODEL_TIP}
|
||||||
|
</div>
|
||||||
{modelValue === 'custom' && <FormItem title='模型名' htmlFor='customModel'>
|
{modelValue === 'custom' && <FormItem title='模型名' htmlFor='customModel'>
|
||||||
<input id='customModel' type='text' className='input input-sm input-bordered w-full' placeholder='llama2'
|
<input id='customModel' type='text' className='input input-sm input-bordered w-full' placeholder='llama2'
|
||||||
value={customModelValue} onChange={onChangeCustomModelValue}/>
|
value={customModelValue} onChange={onChangeCustomModelValue}/>
|
||||||
</FormItem>}
|
</FormItem>}
|
||||||
{modelValue === 'custom' && <FormItem title='Token上限' htmlFor='customModelTokens'>
|
{modelValue === 'custom' && <FormItem title='Token上限' htmlFor='customModelTokens'>
|
||||||
<input id='customModelTokens' type='number' className='input input-sm input-bordered w-full' placeholder={''+CUSTOM_MODEL_TOKENS}
|
<input id='customModelTokens' type='number' className='input input-sm input-bordered w-full'
|
||||||
value={customModelTokensValue} onChange={e => setCustomModelTokensValue(e.target.value?parseInt(e.target.value):undefined)}/>
|
placeholder={'' + CUSTOM_MODEL_TOKENS}
|
||||||
|
value={customModelTokensValue}
|
||||||
|
onChange={e => setCustomModelTokensValue(e.target.value ? parseInt(e.target.value) : undefined)}/>
|
||||||
</FormItem>}
|
</FormItem>}
|
||||||
</Section>}
|
</Section>}
|
||||||
|
|
||||||
@@ -274,10 +280,12 @@ const Settings = () => {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
<div>
|
<div>
|
||||||
<div className='desc text-xs'>
|
<div className='desc text-xs'>
|
||||||
<div>官方网址:<a className='link link-primary' href='https://makersuite.google.com/app/apikey' target='_blank'
|
<div>官方网址:<a className='link link-primary' href='https://makersuite.google.com/app/apikey'
|
||||||
rel="noreferrer">Google AI Studio</a> (目前免费)
|
target='_blank'
|
||||||
|
rel="noreferrer">Google AI Studio</a> (目前免费)
|
||||||
|
</div>
|
||||||
|
<div className='text-xs text-error flex items-center'><IoWarning className='text-sm text-warning'/>谷歌模型安全要求比较高,有些视频可能无法生成总结!
|
||||||
</div>
|
</div>
|
||||||
<div className='text-xs text-error flex items-center'><IoWarning className='text-sm text-warning'/>谷歌模型安全要求比较高,有些视频可能无法生成总结!</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Section>}
|
</Section>}
|
||||||
|
@@ -222,24 +222,21 @@ export const ASK_ENABLED_DEFAULT = true
|
|||||||
export const DEFAULT_SERVER_URL_OPENAI = 'https://api.openai.com'
|
export const DEFAULT_SERVER_URL_OPENAI = 'https://api.openai.com'
|
||||||
export const CUSTOM_MODEL_TOKENS = 16385
|
export const CUSTOM_MODEL_TOKENS = 16385
|
||||||
|
|
||||||
|
export const MODEL_TIP = '推荐gpt-4o-mini,能力强,价格低,token上限大'
|
||||||
export const MODELS = [{
|
export const MODELS = [{
|
||||||
code: 'gpt-3.5-turbo',
|
code: 'gpt-4o-mini',
|
||||||
name: 'gpt-3.5-turbo',
|
name: 'gpt-4o-mini',
|
||||||
tokens: 4096,
|
tokens: 128000,
|
||||||
}, {
|
}, {
|
||||||
code: 'gpt-3.5-turbo-0125',
|
code: 'gpt-3.5-turbo-0125',
|
||||||
name: 'gpt-3.5-turbo-0125',
|
name: 'gpt-3.5-turbo-0125',
|
||||||
tokens: 16385,
|
tokens: 16385,
|
||||||
}, {
|
|
||||||
code: 'gpt-3.5-turbo-1106',
|
|
||||||
name: 'gpt-3.5-turbo-1106',
|
|
||||||
tokens: 16385,
|
|
||||||
}, {
|
}, {
|
||||||
code: 'custom',
|
code: 'custom',
|
||||||
name: '自定义',
|
name: '自定义',
|
||||||
}]
|
}]
|
||||||
export const GEMINI_TOKENS = 32768
|
export const GEMINI_TOKENS = 32768
|
||||||
export const MODEL_DEFAULT = MODELS[1].code
|
export const MODEL_DEFAULT = MODELS[0].code
|
||||||
export const MODEL_MAP: {[key: string]: typeof MODELS[number]} = {}
|
export const MODEL_MAP: {[key: string]: typeof MODELS[number]} = {}
|
||||||
for (const model of MODELS) {
|
for (const model of MODELS) {
|
||||||
MODEL_MAP[model.code] = model
|
MODEL_MAP[model.code] = model
|
||||||
|
Reference in New Issue
Block a user