Shiftclick on llm

This commit is contained in:
Enrico Ros
2024-09-18 13:54:19 -07:00
parent e1664458c5
commit 20927d4da6
3 changed files with 12 additions and 8 deletions
+6 -3
View File
@@ -39,8 +39,12 @@ function ModelItem(props: {
const handleLLMConfigure = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
if (event.shiftKey) {
console.log('llm', llm);
return;
}
onModelClicked(llm.id);
}, [llm.id, onModelClicked]);
}, [llm, onModelClicked]);
const handleLLMHide = React.useCallback((event: React.MouseEvent) => {
event.stopPropagation();
@@ -150,7 +154,6 @@ export function ModelsList(props: {
}) {
// external state
const { updateLLM } = llmsStoreActions();
const { chatLLMId, fastLLMId, funcLLMId } = useDefaultLLMIDs();
const llms = useFilteredLLMs(props.filterServiceId === null ? false : props.filterServiceId);
@@ -158,7 +161,7 @@ export function ModelsList(props: {
const handleModelClicked = React.useCallback((llmId: DLLMId) => onOpenLLMOptions(llmId), [onOpenLLMOptions]);
const handleModelSetHidden = React.useCallback((llmId: DLLMId, hidden: boolean) => updateLLM(llmId, { hidden }), [updateLLM]);
const handleModelSetHidden = React.useCallback((llmId: DLLMId, hidden: boolean) => llmsStoreActions().updateLLM(llmId, { hidden }), []);
// are we showing multiple services
@@ -67,7 +67,8 @@ export function ModelsModal(props: { suspendAutoModelsSetup?: boolean }) {
title={<>Configure <b>AI Models</b></>}
startButton={
multiService ? <Checkbox
label='All Services' sx={{ my: 'auto' }}
label='All Services'
sx={{ my: 'auto' }}
checked={showAllServices} onChange={() => setShowAllServices(all => !all)}
/> : undefined
}
+4 -4
View File
@@ -28,14 +28,14 @@ export function useServiceSetup<TServiceSettings extends object, TAccess, TLLMOp
} {
// invalidates only when the setup changes
const { updateServiceSettings, ...rest } = useModelsStore(useShallow(state => {
const { updateServiceSettings, ...rest } = useModelsStore(useShallow(({ llms, sources, updateServiceSettings }) => {
// find the service | null
const service: DModelsService<TServiceSettings> | null = state.sources.find(s => s.id === serviceId) ?? null;
const service: DModelsService<TServiceSettings> | null = sources.find(s => s.id === serviceId) ?? null;
// (safe) service-derived properties
const serviceSetupValid = (service?.setup && vendor?.validateSetup) ? vendor.validateSetup(service.setup as TServiceSettings) : false;
const serviceLLms = service ? state.llms.filter(llm => llm.sId === serviceId) : stableNoLlms;
const serviceLLms = service ? llms.filter(llm => llm.sId === serviceId) : stableNoLlms;
const serviceAccess = vendor.getTransportAccess(service?.setup);
return {
@@ -48,7 +48,7 @@ export function useServiceSetup<TServiceSettings extends object, TAccess, TLLMOp
serviceSetupValid: serviceSetupValid,
partialSettings: service?.setup ?? null, // NOTE: do not use - prefer ACCESS; only used in 1 edge case now
updateServiceSettings: state.updateServiceSettings,
updateServiceSettings,
};
}));