Fix function params (#2012)

This commit is contained in:
Lily Delalande
2025-04-02 16:21:03 -04:00
committed by GitHub
parent 5ece6592b3
commit a923d24f27
@@ -1,8 +1,9 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import Model, { getProviderMetadata } from '../modelInterface'; import Model from '../modelInterface';
import { useRecentModels } from './recentModels'; import { useRecentModels } from './recentModels';
import { changeModel, getCurrentModelAndProvider } from '../index'; import { changeModel, getCurrentModelAndProvider } from '../index';
import { useConfig } from '../../../ConfigContext'; import { useConfig } from '../../../ConfigContext';
import { toastInfo } from '../../../../toasts';
interface ModelRadioListProps { interface ModelRadioListProps {
renderItem: (props: { renderItem: (props: {
@@ -29,7 +30,7 @@ export function BaseModelsList({
} else { } else {
modelList = providedModelList; modelList = providedModelList;
} }
const { read, upsert, getProviders } = useConfig(); const { read, upsert, getExtensions, addExtension } = useConfig();
const [selectedModel, setSelectedModel] = useState<Model | null>(null); const [selectedModel, setSelectedModel] = useState<Model | null>(null);
const [isInitialized, setIsInitialized] = useState(false); const [isInitialized, setIsInitialized] = useState(false);
@@ -71,8 +72,7 @@ export function BaseModelsList({
}, [read]); }, [read]);
const handleModelSelection = async (model: Model) => { const handleModelSelection = async (model: Model) => {
// Fix: Use the model parameter that's passed in await changeModel({ model: model, writeToConfig: upsert, getExtensions, addExtension });
await changeModel({ model: model, writeToConfig: upsert });
}; };
// Updated to work with CustomRadio // Updated to work with CustomRadio
@@ -83,7 +83,11 @@ export function BaseModelsList({
selectedModel.name === model.name && selectedModel.name === model.name &&
selectedModel.provider === model.provider selectedModel.provider === model.provider
) { ) {
console.log(`Model "${model.name}" is already active.`); toastInfo({
title: 'No change',
msg: `Model "${model.name}" is already active.`,
});
return; return;
} }