feat: code explain for selection tools

This commit is contained in:
josc146
2023-03-16 20:31:10 +08:00
parent e17c810a93
commit 83e9cd02d8
@@ -5,6 +5,7 @@ import {
Palette,
QuestionCircle,
Translate,
Braces,
} from 'react-bootstrap-icons'
import { getPreferredLanguage } from '../../config.mjs'
@@ -49,6 +50,14 @@ export const config = {
genPrompt: async (selection) =>
`Divide the following into paragraphs that are easy to read and understand:\n"${selection}"`,
},
code: {
icon: <Braces />,
label: 'Code Explain',
genPrompt: async (selection) => {
const preferredLanguage = await getPreferredLanguage()
return `Reply in ${preferredLanguage}.Explain the following code:\n"${selection}"`
},
},
ask: {
icon: <QuestionCircle />,
label: 'Ask',