mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
fix: gptCustom icon should show as same in model and message
This commit is contained in:
parent
5d0b849930
commit
45ca0a8713
4 changed files with 15 additions and 10 deletions
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||||
import ModelItem from './ModelItem';
|
import ModelItem from './ModelItem';
|
||||||
|
|
||||||
export default function MenuItems({ models, onSelect }) {
|
export default function MenuItems({ models, onSelect }) {
|
||||||
console.log(models)
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{models.map((modelItem) => (
|
{models.map((modelItem) => (
|
||||||
|
|
@ -11,6 +10,7 @@ export default function MenuItems({ models, onSelect }) {
|
||||||
id={modelItem._id}
|
id={modelItem._id}
|
||||||
modelName={modelItem.name}
|
modelName={modelItem.name}
|
||||||
value={modelItem.value}
|
value={modelItem.value}
|
||||||
|
model={modelItem.model || 'chatgptCustom'}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
chatGptLabel={modelItem.chatGptLabel}
|
chatGptLabel={modelItem.chatGptLabel}
|
||||||
promptPrefix={modelItem.promptPrefix}
|
promptPrefix={modelItem.promptPrefix}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import TrashIcon from '../svg/TrashIcon';
|
||||||
import manualSWR from '~/utils/fetchers';
|
import manualSWR from '~/utils/fetchers';
|
||||||
import { getIconOfModel } from '../../utils';
|
import { getIconOfModel } from '../../utils';
|
||||||
|
|
||||||
export default function ModelItem({ modelName, value, onSelect, id, chatGptLabel, promptPrefix }) {
|
export default function ModelItem({ modelName, value, model, onSelect, id, chatGptLabel, promptPrefix }) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { customModel } = useSelector((state) => state.submit);
|
const { customModel } = useSelector((state) => state.submit);
|
||||||
const { initial } = useSelector((state) => state.models);
|
const { initial } = useSelector((state) => state.models);
|
||||||
|
|
@ -28,7 +28,7 @@ export default function ModelItem({ modelName, value, onSelect, id, chatGptLabel
|
||||||
dispatch(setModels(fetchedModels));
|
dispatch(setModels(fetchedModels));
|
||||||
});
|
});
|
||||||
|
|
||||||
const icon = getIconOfModel({ size: 16, sender: modelName, isCreatedByUser: false, model: value, chatGptLabel, promptPrefix, error: false, className: "mr-2" });
|
const icon = getIconOfModel({ size: 16, sender: modelName, isCreatedByUser: false, model, chatGptLabel, promptPrefix, error: false, className: "mr-2" });
|
||||||
|
|
||||||
if (value === 'chatgptCustom') {
|
if (value === 'chatgptCustom') {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -5,27 +5,32 @@ const initialState = {
|
||||||
{
|
{
|
||||||
_id: '0',
|
_id: '0',
|
||||||
name: 'ChatGPT',
|
name: 'ChatGPT',
|
||||||
value: 'chatgpt'
|
value: 'chatgpt',
|
||||||
|
model: 'chatgpt'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: '1',
|
_id: '1',
|
||||||
name: 'CustomGPT',
|
name: 'CustomGPT',
|
||||||
value: 'chatgptCustom'
|
value: 'chatgptCustom',
|
||||||
|
model: 'chatgptCustom'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: '2',
|
_id: '2',
|
||||||
name: 'BingAI',
|
name: 'BingAI',
|
||||||
value: 'bingai'
|
value: 'bingai',
|
||||||
|
model: 'bingai'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: '3',
|
_id: '3',
|
||||||
name: 'Sydney',
|
name: 'Sydney',
|
||||||
value: 'sydney'
|
value: 'sydney',
|
||||||
|
model: 'sydney'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: '4',
|
_id: '4',
|
||||||
name: 'ChatGPT',
|
name: 'ChatGPT',
|
||||||
value: 'chatgptBrowser'
|
value: 'chatgptBrowser',
|
||||||
|
model: 'chatgptBrowser'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
modelMap: {},
|
modelMap: {},
|
||||||
|
|
@ -45,7 +50,8 @@ const currentSlice = createSlice({
|
||||||
models.slice(initialState.models.length).forEach((modelItem) => {
|
models.slice(initialState.models.length).forEach((modelItem) => {
|
||||||
modelMap[modelItem.value] = {
|
modelMap[modelItem.value] = {
|
||||||
chatGptLabel: modelItem.chatGptLabel,
|
chatGptLabel: modelItem.chatGptLabel,
|
||||||
promptPrefix: modelItem.promptPrefix
|
promptPrefix: modelItem.promptPrefix,
|
||||||
|
model: 'chatgptCustom'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ export const getIconOfModel = ({ size=30, sender, isCreatedByUser, model, chatGp
|
||||||
else if (!isCreatedByUser) {
|
else if (!isCreatedByUser) {
|
||||||
// TODO: use model from convo, rather than submit
|
// TODO: use model from convo, rather than submit
|
||||||
// const { model, chatGptLabel, promptPrefix } = convo;
|
// const { model, chatGptLabel, promptPrefix } = convo;
|
||||||
console.log(model, chatGptLabel)
|
|
||||||
let background = bgColors[model];
|
let background = bgColors[model];
|
||||||
const isBing = model === 'bingai' || model === 'sydney';
|
const isBing = model === 'bingai' || model === 'sydney';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue