新增字幕提问功能

This commit is contained in:
IndieKKY
2024-03-18 11:36:30 +08:00
parent a86ba9e09f
commit 7a03d37c61
3 changed files with 24 additions and 7 deletions

View File

@@ -14,7 +14,16 @@ import {
setTotalHeight,
} from '../redux/envReducer'
import {EventBusContext} from '../Router'
import {EVENT_EXPAND, TOTAL_HEIGHT_MAX, TOTAL_HEIGHT_MIN, WORDS_DEFAULT, WORDS_MIN} from '../const'
import {
EVENT_EXPAND,
GEMINI_TOKENS,
MODEL_DEFAULT,
MODEL_MAP,
TOTAL_HEIGHT_MAX,
TOTAL_HEIGHT_MIN,
WORDS_MIN,
WORDS_RATE
} from '../const'
import {useInterval} from 'ahooks'
import {getWholeText} from '../util/biz_util'
@@ -156,7 +165,14 @@ const useSubtitleService = () => {
const items = data?.body
if (items != null) {
if (envData.summarizeEnable) { // 分段
let size = envData.words??WORDS_DEFAULT
let size = envData.words
if (!size) { // 默认
if (envData.aiType === 'gemini') {
size = GEMINI_TOKENS*WORDS_RATE
} else {
size = (MODEL_MAP[envData.model??MODEL_DEFAULT]?.tokens??4000)*WORDS_RATE
}
}
size = Math.max(size, WORDS_MIN)
segments = []