自定义prompt功能

This commit is contained in:
IndieKKY
2023-05-20 09:52:03 +08:00
parent d9d905facb
commit d6a41df2d0
6 changed files with 162 additions and 95 deletions

View File

@@ -68,18 +68,17 @@ const Summarize = (props: {
const dispatch = useAppDispatch()
const apiKey = useAppSelector(state => state.env.envData.apiKey)
const fontSize = useAppSelector(state => state.env.envData.fontSize)
const title = useAppSelector(state => state.env.title)
const curSummaryType = useAppSelector(state => state.env.tempData.curSummaryType)
const {addSummarizeTask} = useTranslate()
const onGenerate = useCallback(() => {
if (apiKey) {
addSummarizeTask(title, curSummaryType, segment).catch(console.error)
addSummarizeTask(curSummaryType, segment).catch(console.error)
} else {
dispatch(setPage(PAGE_SETTINGS))
toast.error('需要先设置ApiKey!')
}
}, [addSummarizeTask, apiKey, curSummaryType, dispatch, segment, title])
}, [addSummarizeTask, apiKey, curSummaryType, dispatch, segment])
const onCopy = useCallback(() => {
if (summary != null) {