feat: direct translation and bidi translation

This commit is contained in:
josc146
2023-03-19 21:44:56 +08:00
parent bb8e61366b
commit 573bebd7e6
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ export const defaultConfig = {
// others
activeSelectionTools: Object.keys(toolsConfig),
activeSelectionTools: Object.keys(toolsConfig).filter((i) => i !== 'translateBidi'),
activeSiteAdapters: [
'bilibili',
'github',
@@ -6,6 +6,7 @@ import {
QuestionCircle,
Translate,
Braces,
Globe,
} from 'react-bootstrap-icons'
import { getPreferredLanguage } from '../../config.mjs'
@@ -13,6 +14,14 @@ export const config = {
translate: {
icon: <Translate />,
label: 'Translate',
genPrompt: async (selection) => {
const preferredLanguage = await getPreferredLanguage()
return `Translate the following into ${preferredLanguage} and only show me the translated content:\n"${selection}"`
},
},
translateBidi: {
icon: <Globe />,
label: 'Translate (Bidirectional)',
genPrompt: async (selection) => {
const preferredLanguage = await getPreferredLanguage()
return (