File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
content-script/selection-tools Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ export const defaultConfig = {
215215 userLanguage : getNavigatorLanguage ( ) ,
216216 apiModes : Object . keys ( Models ) ,
217217 selectionTools : [
218+ 'explain' ,
218219 'translate' ,
219220 'translateToEn' ,
220221 'translateToZh' ,
@@ -227,6 +228,7 @@ export const defaultConfig = {
227228 'ask' ,
228229 ] ,
229230 selectionToolsDesc : [
231+ 'Explain' ,
230232 'Translate' ,
231233 'Translate (To English)' ,
232234 'Translate (Bidirectional)' ,
Original file line number Diff line number Diff line change @@ -7,10 +7,19 @@ import {
77 Translate ,
88 Braces ,
99 Globe ,
10+ ChatTextFill ,
1011} from 'react-bootstrap-icons'
1112import { getPreferredLanguage } from '../../config/language.mjs'
1213
1314export const config = {
15+ explain : {
16+ icon : < ChatTextFill /> ,
17+ label : 'Explain' ,
18+ genPrompt : async ( selection ) => {
19+ const preferredLanguage = await getPreferredLanguage ( )
20+ return `Reply in ${ preferredLanguage } .Explain the following:\n"${ selection } "`
21+ } ,
22+ } ,
1423 translate : {
1524 icon : < Translate /> ,
1625 label : 'Translate' ,
You can’t perform that action at this time.
0 commit comments