@@ -37,6 +37,7 @@ import AutoIcon from "../icons/auto.svg";
3737import BottomIcon from "../icons/bottom.svg" ;
3838import StopIcon from "../icons/pause.svg" ;
3939import RobotIcon from "../icons/robot.svg" ;
40+ import PluginIcon from "../icons/plugin.svg" ;
4041
4142import {
4243 ChatMessage ,
@@ -89,6 +90,7 @@ import {
8990 REQUEST_TIMEOUT_MS ,
9091 UNFINISHED_INPUT ,
9192 ServiceProvider ,
93+ Plugin ,
9294} from "../constant" ;
9395import { Avatar } from "./emoji" ;
9496import { ContextPrompts , MaskAvatar , MaskConfig } from "./mask" ;
@@ -476,6 +478,7 @@ export function ChatActions(props: {
476478 return model ?. displayName ?? "" ;
477479 } , [ models , currentModel , currentProviderName ] ) ;
478480 const [ showModelSelector , setShowModelSelector ] = useState ( false ) ;
481+ const [ showPluginSelector , setShowPluginSelector ] = useState ( false ) ;
479482 const [ showUploadImage , setShowUploadImage ] = useState ( false ) ;
480483
481484 useEffect ( ( ) => {
@@ -620,6 +623,33 @@ export function ChatActions(props: {
620623 } }
621624 />
622625 ) }
626+
627+ < ChatAction
628+ onClick = { ( ) => setShowPluginSelector ( true ) }
629+ text = { Locale . Plugin . Name }
630+ icon = { < PluginIcon /> }
631+ />
632+ { showPluginSelector && (
633+ < Selector
634+ multiple
635+ defaultSelectedValue = { chatStore . currentSession ( ) . mask ?. plugin }
636+ items = { [
637+ {
638+ title : Locale . Plugin . Artifact ,
639+ value : Plugin . Artifact ,
640+ } ,
641+ ] }
642+ onClose = { ( ) => setShowPluginSelector ( false ) }
643+ onSelection = { ( s ) => {
644+ if ( s . length === 0 ) return ;
645+ const plugin = s [ 0 ] ;
646+ chatStore . updateCurrentSession ( ( session ) => {
647+ session . mask . plugin = s ;
648+ } ) ;
649+ showToast ( plugin ) ;
650+ } }
651+ />
652+ ) }
623653 </ div >
624654 ) ;
625655}
0 commit comments