You've already forked bilibili-subtitle
由于gemini兼容了openai格式,因此去除了专门的gemini选项,简化代码
This commit is contained in:
@@ -36,16 +36,3 @@ export const handleChatCompleteTask = async (task: Task) => {
|
||||
throw new Error(`${task.resp.error.code as string??''} ${task.resp.error.message as string ??''}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const handleGeminiChatCompleteTask = async (task: Task) => {
|
||||
const data = task.def.data
|
||||
const resp = await fetch('https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-goog-api-key': task.def.extra.geminiApiKey,
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
task.resp = await resp.json()
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import {TASK_EXPIRE_TIME} from '../consts/const'
|
||||
import {handleChatCompleteTask, handleGeminiChatCompleteTask} from './openaiService'
|
||||
import {handleChatCompleteTask} from './openaiService'
|
||||
|
||||
export const tasksMap = new Map<string, Task>()
|
||||
|
||||
@@ -11,9 +11,6 @@ export const handleTask = async (task: Task) => {
|
||||
case 'chatComplete':
|
||||
await handleChatCompleteTask(task)
|
||||
break
|
||||
case 'geminiChatComplete':
|
||||
await handleGeminiChatCompleteTask(task)
|
||||
break
|
||||
default:
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
throw new Error(`任务类型不支持: ${task.def.type}`)
|
||||
|
@@ -4,10 +4,8 @@ import { openOptionsPage } from '../utils/chromeUtils'
|
||||
|
||||
const ApiKeyReminder: React.FC = () => {
|
||||
const apiKey = useAppSelector(state => state.env.envData.apiKey)
|
||||
const geminiApiKey = useAppSelector(state => state.env.envData.geminiApiKey)
|
||||
const aiType = useAppSelector(state => state.env.envData.aiType)
|
||||
|
||||
if ((aiType === 'gemini' && geminiApiKey) || (aiType !== 'gemini' && apiKey)) {
|
||||
if (apiKey) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ const Ask = (props: {
|
||||
const {addAskTask} = useTranslate()
|
||||
|
||||
const onRegenerate = useCallback(() => {
|
||||
const apiKey = envData.aiType === 'gemini'?envData.geminiApiKey:envData.apiKey
|
||||
const apiKey = envData.apiKey
|
||||
if (apiKey) {
|
||||
if (segments != null && segments.length > 0) {
|
||||
addAskTask(ask.id, segments[0], ask.question).catch(console.error)
|
||||
@@ -26,7 +26,7 @@ const Ask = (props: {
|
||||
} else {
|
||||
toast.error('请先在选项页面设置ApiKey!')
|
||||
}
|
||||
}, [addAskTask, ask.id, ask.question, envData.aiType, envData.apiKey, envData.geminiApiKey, segments])
|
||||
}, [addAskTask, ask.id, ask.question, envData.apiKey, segments])
|
||||
|
||||
const onAskFold = useCallback(() => {
|
||||
dispatch(mergeAskInfo({
|
||||
|
@@ -105,7 +105,7 @@ const Body = () => {
|
||||
}, [dispatch])
|
||||
|
||||
const onSummarizeAll = useCallback(() => {
|
||||
const apiKey = envData.aiType === 'gemini' ? envData.geminiApiKey : envData.apiKey
|
||||
const apiKey = envData.apiKey
|
||||
if (!apiKey) {
|
||||
toast.error('请先在选项页面设置ApiKey!')
|
||||
return
|
||||
@@ -127,7 +127,7 @@ const Body = () => {
|
||||
}
|
||||
toast.success(`已添加${segments_.length}个总结任务!`)
|
||||
}
|
||||
}, [addSummarizeTask, curSummaryType, envData.aiType, envData.apiKey, envData.geminiApiKey, segments])
|
||||
}, [addSummarizeTask, curSummaryType, envData.apiKey, segments])
|
||||
|
||||
const onFoldAll = useCallback(() => {
|
||||
dispatch(setFoldAll(!foldAll))
|
||||
@@ -146,13 +146,13 @@ const Body = () => {
|
||||
}, [asks, dispatch, foldAll, segments])
|
||||
|
||||
const toggleAutoTranslateCallback = useCallback(() => {
|
||||
const apiKey = envData.aiType === 'gemini' ? envData.geminiApiKey : envData.apiKey
|
||||
const apiKey = envData.apiKey
|
||||
if (apiKey) {
|
||||
dispatch(setAutoTranslate(!autoTranslate))
|
||||
} else {
|
||||
toast.error('请先在选项页面设置ApiKey!')
|
||||
}
|
||||
}, [autoTranslate, dispatch, envData.aiType, envData.apiKey, envData.geminiApiKey])
|
||||
}, [autoTranslate, dispatch, envData.apiKey])
|
||||
|
||||
const onEnableAutoScroll = useCallback(() => {
|
||||
dispatch(setAutoScroll(true))
|
||||
@@ -185,7 +185,7 @@ const Body = () => {
|
||||
|
||||
const onAsk = useCallback(() => {
|
||||
if ((envData.askEnabled ?? ASK_ENABLED_DEFAULT) && searchText) {
|
||||
const apiKey = envData.aiType === 'gemini' ? envData.geminiApiKey : envData.apiKey
|
||||
const apiKey = envData.apiKey
|
||||
if (apiKey) {
|
||||
if (segments != null && segments.length > 0) {
|
||||
const id = v4()
|
||||
@@ -201,7 +201,7 @@ const Body = () => {
|
||||
toast.error('请先在选项页面设置ApiKey!')
|
||||
}
|
||||
}
|
||||
}, [addAskTask, dispatch, envData.aiType, envData.apiKey, envData.askEnabled, envData.geminiApiKey, searchText, segments])
|
||||
}, [addAskTask, dispatch, envData.apiKey, envData.askEnabled, searchText, segments])
|
||||
|
||||
// service
|
||||
useKeyService()
|
||||
|
@@ -73,13 +73,13 @@ const Summarize = (props: {
|
||||
const {addSummarizeTask} = useTranslate()
|
||||
|
||||
const onGenerate = useCallback(() => {
|
||||
const apiKey = envData.aiType === 'gemini'?envData.geminiApiKey:envData.apiKey
|
||||
const apiKey = envData.apiKey
|
||||
if (apiKey) {
|
||||
addSummarizeTask(curSummaryType, segment).catch(console.error)
|
||||
} else {
|
||||
toast.error('请先在选项页面设置ApiKey!')
|
||||
}
|
||||
}, [addSummarizeTask, curSummaryType, envData.aiType, envData.apiKey, envData.geminiApiKey, segment])
|
||||
}, [addSummarizeTask, curSummaryType, envData.apiKey, segment])
|
||||
|
||||
const onCopy = useCallback(() => {
|
||||
if (summary != null) {
|
||||
|
@@ -284,7 +284,6 @@ export const MODELS = [{
|
||||
code: 'custom',
|
||||
name: '自定义',
|
||||
}]
|
||||
export const GEMINI_TOKENS = 32768
|
||||
export const MODEL_DEFAULT = MODELS[0].code
|
||||
export const MODEL_MAP: {[key: string]: typeof MODELS[number]} = {}
|
||||
for (const model of MODELS) {
|
||||
|
@@ -16,7 +16,7 @@ import {
|
||||
setTempData,
|
||||
} from '../redux/envReducer'
|
||||
import {EventBusContext} from '../Router'
|
||||
import {EVENT_EXPAND, GEMINI_TOKENS, TOTAL_HEIGHT_MAX, TOTAL_HEIGHT_MIN, WORDS_MIN, WORDS_RATE} from '../consts/const'
|
||||
import {EVENT_EXPAND, TOTAL_HEIGHT_MAX, TOTAL_HEIGHT_MIN, WORDS_MIN, WORDS_RATE} from '../consts/const'
|
||||
import {useAsyncEffect, useInterval} from 'ahooks'
|
||||
import {getModelMaxTokens, getWholeText} from '../utils/bizUtil'
|
||||
import { useMessage } from './useMessageService'
|
||||
@@ -152,11 +152,7 @@ const useSubtitleService = () => {
|
||||
if (envData.summarizeEnable) { // 分段
|
||||
let size = envData.words
|
||||
if (!size) { // 默认
|
||||
if (envData.aiType === 'gemini') {
|
||||
size = GEMINI_TOKENS*WORDS_RATE
|
||||
} else {
|
||||
size = getModelMaxTokens(envData)*WORDS_RATE
|
||||
}
|
||||
size = getModelMaxTokens(envData)*WORDS_RATE
|
||||
}
|
||||
size = Math.max(size, WORDS_MIN)
|
||||
|
||||
|
@@ -88,24 +88,9 @@ const useTranslate = () => {
|
||||
prompt = prompt.replaceAll('{{subtitles}}', lineStr)
|
||||
|
||||
const taskDef: TaskDef = {
|
||||
type: envData.aiType === 'gemini'?'geminiChatComplete':'chatComplete',
|
||||
type: 'chatComplete',
|
||||
serverUrl: envData.serverUrl,
|
||||
data: envData.aiType === 'gemini'
|
||||
?{
|
||||
contents: [
|
||||
{
|
||||
parts: [
|
||||
{
|
||||
text: prompt
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
generationConfig: {
|
||||
maxOutputTokens: 2048
|
||||
}
|
||||
}
|
||||
:{
|
||||
data: {
|
||||
model: getModel(envData),
|
||||
messages: [
|
||||
{
|
||||
@@ -120,7 +105,6 @@ const useTranslate = () => {
|
||||
extra: {
|
||||
type: 'translate',
|
||||
apiKey: envData.apiKey,
|
||||
geminiApiKey: envData.geminiApiKey,
|
||||
startIdx,
|
||||
size: lines.length,
|
||||
}
|
||||
@@ -165,24 +149,9 @@ const useTranslate = () => {
|
||||
prompt = prompt.replaceAll('{{segment}}', segment.text)
|
||||
|
||||
const taskDef: TaskDef = {
|
||||
type: envData.aiType === 'gemini'?'geminiChatComplete':'chatComplete',
|
||||
type: 'chatComplete',
|
||||
serverUrl: envData.serverUrl,
|
||||
data: envData.aiType === 'gemini'
|
||||
?{
|
||||
contents: [
|
||||
{
|
||||
parts: [
|
||||
{
|
||||
text: prompt
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
generationConfig: {
|
||||
maxOutputTokens: 2048
|
||||
}
|
||||
}
|
||||
:{
|
||||
data: {
|
||||
model: getModel(envData),
|
||||
messages: [
|
||||
{
|
||||
@@ -199,7 +168,6 @@ const useTranslate = () => {
|
||||
summaryType: type,
|
||||
startIdx: segment.startIdx,
|
||||
apiKey: envData.apiKey,
|
||||
geminiApiKey: envData.geminiApiKey,
|
||||
}
|
||||
}
|
||||
console.debug('addSummarizeTask', taskDef)
|
||||
@@ -220,24 +188,9 @@ const useTranslate = () => {
|
||||
prompt = prompt.replaceAll('{{question}}', question)
|
||||
|
||||
const taskDef: TaskDef = {
|
||||
type: envData.aiType === 'gemini'?'geminiChatComplete':'chatComplete',
|
||||
type: 'chatComplete',
|
||||
serverUrl: envData.serverUrl,
|
||||
data: envData.aiType === 'gemini'
|
||||
?{
|
||||
contents: [
|
||||
{
|
||||
parts: [
|
||||
{
|
||||
text: prompt
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
generationConfig: {
|
||||
maxOutputTokens: 2048
|
||||
}
|
||||
}
|
||||
:{
|
||||
data: {
|
||||
model: getModel(envData),
|
||||
messages: [
|
||||
{
|
||||
@@ -253,7 +206,6 @@ const useTranslate = () => {
|
||||
type: 'ask',
|
||||
// startIdx: segment.startIdx,
|
||||
apiKey: envData.apiKey,
|
||||
geminiApiKey: envData.geminiApiKey,
|
||||
askId: id,
|
||||
}
|
||||
}
|
||||
@@ -335,7 +287,7 @@ const useTranslate = () => {
|
||||
console.debug('getTask', taskResp.task)
|
||||
const task: Task = taskResp.task
|
||||
const taskType: string | undefined = task.def.extra?.type
|
||||
const content = envData.aiType === 'gemini'?task.resp?.candidates[0]?.content?.parts[0]?.text?.trim():task.resp?.choices?.[0]?.message?.content?.trim()
|
||||
const content = task.resp?.choices?.[0]?.message?.content?.trim()
|
||||
if (task.status === 'done') {
|
||||
// 异常提示
|
||||
if (task.error) {
|
||||
@@ -355,7 +307,7 @@ const useTranslate = () => {
|
||||
} else {
|
||||
dispatch(delTaskId(taskId))
|
||||
}
|
||||
}, [dispatch, envData.aiType, handleAsk, handleSummarize, handleTranslate, sendExtension])
|
||||
}, [dispatch, handleAsk, handleSummarize, handleTranslate, sendExtension])
|
||||
|
||||
return {getFetch, getTask, addTask, addSummarizeTask, addAskTask}
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ import {
|
||||
CUSTOM_MODEL_TOKENS,
|
||||
DEFAULT_SERVER_URL_GEMINI,
|
||||
DEFAULT_SERVER_URL_OPENAI,
|
||||
GEMINI_TOKENS,
|
||||
LANGUAGE_DEFAULT,
|
||||
LANGUAGES,
|
||||
MODEL_DEFAULT,
|
||||
@@ -80,7 +79,6 @@ const OptionsPage = () => {
|
||||
const {value: summarizeFloatValue, onChange: setSummarizeFloatValue} = useEventChecked(envData.summarizeFloat)
|
||||
const [apiKeyValue, { onChange: onChangeApiKeyValue }] = useEventTarget({initialValue: envData.apiKey??''})
|
||||
const [serverUrlValue, setServerUrlValue] = useState(envData.serverUrl)
|
||||
const [geminiApiKeyValue, { onChange: onChangeGeminiApiKeyValue }] = useEventTarget({initialValue: envData.geminiApiKey??''})
|
||||
const [languageValue, { onChange: onChangeLanguageValue }] = useEventTarget({initialValue: envData.language??LANGUAGE_DEFAULT})
|
||||
const [modelValue, { onChange: onChangeModelValue }] = useEventTarget({initialValue: envData.model??MODEL_DEFAULT})
|
||||
const [customModelValue, { onChange: onChangeCustomModelValue }] = useEventTarget({initialValue: envData.customModel})
|
||||
@@ -89,7 +87,6 @@ const OptionsPage = () => {
|
||||
const [hideOnDisableAutoTranslateValue, setHideOnDisableAutoTranslateValue] = useState(envData.hideOnDisableAutoTranslate)
|
||||
const [themeValue, setThemeValue] = useState(envData.theme)
|
||||
const [fontSizeValue, setFontSizeValue] = useState(envData.fontSize)
|
||||
const [aiTypeValue, setAiTypeValue] = useState(envData.aiType)
|
||||
const [transDisplayValue, setTransDisplayValue] = useState(envData.transDisplay)
|
||||
const [wordsValue, setWordsValue] = useState<number | undefined>(envData.words)
|
||||
const [fetchAmountValue, setFetchAmountValue] = useState(envData.fetchAmount??TRANSLATE_FETCH_DEFAULT)
|
||||
@@ -110,11 +107,8 @@ const OptionsPage = () => {
|
||||
return list
|
||||
}, [])
|
||||
const apiKeySetted = useMemo(() => {
|
||||
if (aiTypeValue === 'gemini') {
|
||||
return !!geminiApiKeyValue
|
||||
}
|
||||
return !!apiKeyValue
|
||||
}, [aiTypeValue, apiKeyValue, geminiApiKeyValue])
|
||||
}, [apiKeyValue])
|
||||
|
||||
const onChangeHideOnDisableAutoTranslate = useCallback((e: any) => {
|
||||
setHideOnDisableAutoTranslateValue(e.target.checked)
|
||||
@@ -125,13 +119,11 @@ const OptionsPage = () => {
|
||||
sidePanel: sidePanelValue,
|
||||
manualInsert: !autoInsertValue,
|
||||
autoExpand: autoExpandValue,
|
||||
aiType: aiTypeValue,
|
||||
apiKey: apiKeyValue,
|
||||
serverUrl: serverUrlValue,
|
||||
model: modelValue,
|
||||
customModel: customModelValue,
|
||||
customModelTokens: customModelTokensValue,
|
||||
geminiApiKey: geminiApiKeyValue,
|
||||
translateEnable: translateEnableValue,
|
||||
language: languageValue,
|
||||
hideOnDisableAutoTranslate: hideOnDisableAutoTranslateValue,
|
||||
@@ -154,7 +146,7 @@ const OptionsPage = () => {
|
||||
setTimeout(() => {
|
||||
window.close()
|
||||
}, 3000)
|
||||
}, [dispatch, sendExtension, sidePanelValue, autoInsertValue, autoExpandValue, aiTypeValue, apiKeyValue, serverUrlValue, modelValue, customModelValue, customModelTokensValue, geminiApiKeyValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue])
|
||||
}, [dispatch, sendExtension, sidePanelValue, autoInsertValue, autoExpandValue, apiKeyValue, serverUrlValue, modelValue, customModelValue, customModelTokensValue, translateEnableValue, languageValue, hideOnDisableAutoTranslateValue, themeValue, transDisplayValue, summarizeEnableValue, summarizeFloatValue, summarizeLanguageValue, wordsValue, fetchAmountValue, fontSizeValue, promptsValue, searchEnabledValue, cnSearchEnabledValue, askEnabledValue])
|
||||
|
||||
const onCancel = useCallback(() => {
|
||||
window.close()
|
||||
@@ -200,14 +192,6 @@ const OptionsPage = () => {
|
||||
setFontSizeValue('large')
|
||||
}, [])
|
||||
|
||||
const onSelOpenai = useCallback(() => {
|
||||
setAiTypeValue('openai')
|
||||
}, [])
|
||||
|
||||
const onSelGemini = useCallback(() => {
|
||||
setAiTypeValue('gemini')
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='container mx-auto max-w-3xl p-4'>
|
||||
<OptionCard title="通用配置">
|
||||
@@ -236,25 +220,19 @@ const OptionsPage = () => {
|
||||
<button onClick={onSelFontSize2} className={classNames('btn btn-sm no-animation', fontSizeValue === 'large'?'btn-active':'')}>加大</button>
|
||||
</div>
|
||||
</FormItem>
|
||||
<FormItem title='AI类型' tip='OPENAI质量更高'>
|
||||
<div className="btn-group">
|
||||
<button onClick={onSelOpenai} className={classNames('btn btn-sm', (!aiTypeValue || aiTypeValue === 'openai')?'btn-active':'')}>OpenAI</button>
|
||||
<button onClick={onSelGemini} className={classNames('btn btn-sm', aiTypeValue === 'gemini'?'btn-active':'')}>Gemini</button>
|
||||
</div>
|
||||
</FormItem>
|
||||
</OptionCard>
|
||||
|
||||
<OptionCard title="AI 配置">
|
||||
{(!aiTypeValue || aiTypeValue === 'openai') && <FormItem title='ApiKey' htmlFor='apiKey'>
|
||||
{<FormItem title='ApiKey' htmlFor='apiKey'>
|
||||
<input id='apiKey' type='text' className='input input-sm input-bordered w-full' placeholder='sk-xxx'
|
||||
value={apiKeyValue} onChange={onChangeApiKeyValue}/>
|
||||
</FormItem>}
|
||||
{(!aiTypeValue || aiTypeValue === 'openai') && <FormItem title='服务器' htmlFor='serverUrl'>
|
||||
{<FormItem title='服务器' htmlFor='serverUrl'>
|
||||
<input id='serverUrl' type='text' className='input input-sm input-bordered w-full'
|
||||
placeholder={DEFAULT_SERVER_URL_OPENAI} value={serverUrlValue}
|
||||
onChange={e => setServerUrlValue(e.target.value)}/>
|
||||
</FormItem>}
|
||||
{(!aiTypeValue || aiTypeValue === 'openai') && <div>
|
||||
{<div>
|
||||
<div className='desc text-sm text-center'>
|
||||
<div className='flex justify-center font-semibold'>【OpenAI官方地址】</div>
|
||||
<div>官方网址:<a className='link link-primary' href='https://platform.openai.com/' target='_blank'
|
||||
@@ -279,13 +257,13 @@ const OptionsPage = () => {
|
||||
<div className='text-amber-600 flex justify-center items-center'><FaGripfire/>国内可访问,无需🪜<FaGripfire/></div>
|
||||
</div>
|
||||
</div>}
|
||||
{(!aiTypeValue || aiTypeValue === 'openai') && <FormItem title='模型选择' htmlFor='modelSel' tip='注意,不同模型有不同价格与token限制'>
|
||||
{<FormItem title='模型选择' htmlFor='modelSel' tip='注意,不同模型有不同价格与token限制'>
|
||||
<select id='modelSel' className="select select-sm select-bordered" value={modelValue}
|
||||
onChange={onChangeModelValue}>
|
||||
{MODELS.map(model => <option key={model.code} value={model.code}>{model.name}</option>)}
|
||||
</select>
|
||||
</FormItem>}
|
||||
{(!aiTypeValue || aiTypeValue === 'openai') && <div className='desc text-sm'>
|
||||
{<div className='desc text-sm'>
|
||||
{MODEL_TIP}
|
||||
</div>}
|
||||
{modelValue === 'custom' && <FormItem title='模型名' htmlFor='customModel'>
|
||||
@@ -298,20 +276,6 @@ const OptionsPage = () => {
|
||||
value={customModelTokensValue}
|
||||
onChange={e => setCustomModelTokensValue(e.target.value ? parseInt(e.target.value) : undefined)}/>
|
||||
</FormItem>}
|
||||
{aiTypeValue === 'gemini' && <FormItem title='ApiKey' htmlFor='geminiApiKey'>
|
||||
<input id='geminiApiKey' type='text' className='input input-sm input-bordered w-full' placeholder='xxx'
|
||||
value={geminiApiKeyValue} onChange={onChangeGeminiApiKeyValue}/>
|
||||
</FormItem>}
|
||||
{aiTypeValue === 'gemini' && <div>
|
||||
<div className='desc text-sm'>
|
||||
<div>官方网址:<a className='link link-primary' href='https://makersuite.google.com/app/apikey'
|
||||
target='_blank'
|
||||
rel="noreferrer">Google AI Studio</a> (目前免费)
|
||||
</div>
|
||||
<div className='text-sm text-error flex items-center'><IoWarning className='text-sm text-warning'/>谷歌模型安全要求比较高,有些视频可能无法生成总结!
|
||||
</div>
|
||||
</div>
|
||||
</div>}
|
||||
</OptionCard>
|
||||
|
||||
<OptionCard title={<div className='flex items-center'>
|
||||
@@ -379,7 +343,7 @@ const OptionsPage = () => {
|
||||
</div>
|
||||
</FormItem>
|
||||
<div className='desc text-sm'>
|
||||
当前选择的模型的分段字数上限是<span className='font-semibold font-mono'>{aiTypeValue === 'gemini'?GEMINI_TOKENS:(MODEL_MAP[modelValue??MODEL_DEFAULT]?.tokens??'未知')}</span>
|
||||
当前选择的模型的分段字数上限是<span className='font-semibold font-mono'>{MODEL_MAP[modelValue??MODEL_DEFAULT]?.tokens??'未知'}</span>
|
||||
(太接近上限总结会报错)
|
||||
</div>
|
||||
</OptionCard>
|
||||
|
5
src/typings.d.ts
vendored
5
src/typings.d.ts
vendored
@@ -11,15 +11,12 @@ interface EnvData {
|
||||
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
|
||||
@@ -54,7 +51,7 @@ interface TempData {
|
||||
}
|
||||
|
||||
interface TaskDef {
|
||||
type: 'chatComplete' | 'geminiChatComplete'
|
||||
type: 'chatComplete'
|
||||
serverUrl?: string
|
||||
data: any
|
||||
extra?: any
|
||||
|
Reference in New Issue
Block a user