Skip to content

Commit b7af995

Browse files
committed
feat: code explain for selection tools
1 parent 68f8f00 commit b7af995

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/content-script/selection-tools/index.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Palette,
66
QuestionCircle,
77
Translate,
8+
Braces,
89
} from 'react-bootstrap-icons'
910
import { getPreferredLanguage } from '../../config.mjs'
1011

@@ -49,6 +50,14 @@ export const config = {
4950
genPrompt: async (selection) =>
5051
`Divide the following into paragraphs that are easy to read and understand:\n"${selection}"`,
5152
},
53+
code: {
54+
icon: <Braces />,
55+
label: 'Code Explain',
56+
genPrompt: async (selection) => {
57+
const preferredLanguage = await getPreferredLanguage()
58+
return `Reply in ${preferredLanguage}.Explain the following code:\n"${selection}"`
59+
},
60+
},
5261
ask: {
5362
icon: <QuestionCircle />,
5463
label: 'Ask',

0 commit comments

Comments
 (0)