diff --git a/app/components/chat.tsx b/app/components/chat.tsx index d4e1dcd8483..505af77da23 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -27,6 +27,7 @@ import DarkIcon from "../icons/dark.svg"; import AutoIcon from "../icons/auto.svg"; import BottomIcon from "../icons/bottom.svg"; import StopIcon from "../icons/pause.svg"; +import RobotIcon from "../icons/robot.svg"; import { ChatMessage, @@ -38,6 +39,7 @@ import { Theme, useAppConfig, DEFAULT_TOPIC, + ALL_MODELS, } from "../store"; import { @@ -385,6 +387,19 @@ export function ChatActions(props: { const couldStop = ChatControllerPool.hasPending(); const stopAll = () => ChatControllerPool.stopAll(); + // switch model + const currentModel = chatStore.currentSession().mask.modelConfig.model; + function nextModel() { + const models = ALL_MODELS.filter((m) => m.available).map((m) => m.name); + const modelIndex = models.indexOf(currentModel); + const nextIndex = (modelIndex + 1) % models.length; + const nextModel = models[nextIndex]; + chatStore.updateCurrentSession((session) => { + session.mask.modelConfig.model = nextModel; + session.mask.syncGlobalConfig = false; + }); + } + return (
{couldStop && ( @@ -453,6 +468,12 @@ export function ChatActions(props: { }); }} /> + + } + />
); } diff --git a/app/icons/robot.svg b/app/icons/robot.svg new file mode 100644 index 00000000000..62dd9dc8d84 --- /dev/null +++ b/app/icons/robot.svg @@ -0,0 +1 @@ +