mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
front and backend logic for model switching
This commit is contained in:
parent
a5afd5c48f
commit
c00a2c902b
9 changed files with 58 additions and 39 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState } from 'react';
|
||||
import { useSelector, useDispatch } from 'react-redux';
|
||||
import { setConversation, setError } from '~/store/convoSlice';
|
||||
import { setModel } from '~/store/submitSlice';
|
||||
import GPTIcon from '../svg/GPTIcon';
|
||||
import { DropdownMenuCheckboxItemProps } from '@radix-ui/react-dropdown-menu';
|
||||
|
||||
|
|
@ -17,7 +17,11 @@ import {
|
|||
} from '../ui/DropdownMenu.tsx';
|
||||
|
||||
export default function ModelMenu() {
|
||||
const [model, setModel] = useState('chatgpt');
|
||||
const dispatch = useDispatch();
|
||||
const { model } = useSelector((state) => state.submit);
|
||||
const onChange = (value) => {
|
||||
dispatch(setModel(value));
|
||||
};
|
||||
|
||||
const defaultColorProps = [
|
||||
'text-gray-500',
|
||||
|
|
@ -57,7 +61,7 @@ export default function ModelMenu() {
|
|||
<DropdownMenuSeparator />
|
||||
<DropdownMenuRadioGroup
|
||||
value={model}
|
||||
onValueChange={setModel}
|
||||
onValueChange={onChange}
|
||||
>
|
||||
<DropdownMenuRadioItem value="chatgpt">ChatGPT</DropdownMenuRadioItem>
|
||||
<DropdownMenuRadioItem value="davinci">Davinci</DropdownMenuRadioItem>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue