Skip to content

Commit 448df4b

Browse files
committed
useLLMSelect: model options
1 parent dafd090 commit 448df4b

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

src/common/components/forms/useLLMSelect.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import { llmsGetVendorIcon, LLMVendorIcon } from '~/modules/llms/components/LLMV
1212

1313
import type { DModelDomainId } from '~/common/stores/llms/model.domains.types';
1414
import { DLLM, DLLMId, LLM_IF_OAI_Reasoning, LLM_IF_Outputs_Audio, LLM_IF_Outputs_Image, LLM_IF_Tools_WebSearch } from '~/common/stores/llms/llms.types';
15+
import { PhGearSixIcon } from '~/common/components/icons/phosphor/PhGearSixIcon';
1516
import { TooltipOutlined } from '~/common/components/TooltipOutlined';
1617
import { getChatLLMId, llmsStoreActions } from '~/common/stores/llms/store-llms';
17-
import { optimaOpenModels } from '~/common/layout/optima/useOptima';
18+
import { optimaActions, optimaOpenModels } from '~/common/layout/optima/useOptima';
1819
import { useVisibleLLMs } from '~/common/stores/llms/llms.hooks';
1920

2021
import { FormLabelStart } from './FormLabelStart';
@@ -49,6 +50,13 @@ const _styles = {
4950
backgroundColor: 'background.popup',
5051
boxShadow: 'xs',
5152
},
53+
configButton: {
54+
ml: 'auto',
55+
my: -0.5,
56+
// mr: -0.25,
57+
backgroundColor: 'background.popup',
58+
boxShadow: 'xs',
59+
},
5260
listVendor: {
5361
// see OptimaBarDropdown's _styles.separator
5462
fontSize: 'sm',
@@ -187,6 +195,8 @@ export function useLLMSelect(
187195
features += '🖼️ '; // can draw images
188196
}
189197

198+
const showModelOptions = llm.id === llmId && !optimizeToSingleVisibleId;
199+
190200
// the option component
191201
acc.push(
192202
<Option
@@ -206,7 +216,25 @@ export function useLLMSelect(
206216
<div className='agi-ellipsize'>{llm.label}</div>
207217

208218
{/* Features Chips - sync with `ModelsList.tsx` */}
209-
{!!features && <Chip size='sm' color={seemsFree ? 'success' : undefined} variant='plain' sx={_styles.chips}>{features.trim().replace(' ', ' ')}</Chip>}
219+
{!!features && !showModelOptions && <Chip size='sm' color={seemsFree ? 'success' : undefined} variant='plain' sx={_styles.chips}>{features.trim().replace(' ', ' ')}</Chip>}
220+
221+
{/* Settings button on active model (only when not optimized) */}
222+
{showModelOptions && (
223+
<TooltipOutlined title='Model Settings'>
224+
<IconButton
225+
size='sm'
226+
// color='neutral'
227+
// variant='outlined'
228+
onClick={(e) => {
229+
e.stopPropagation();
230+
optimaActions().openModelOptions(llm.id);
231+
}}
232+
sx={_styles.configButton}
233+
>
234+
<PhGearSixIcon />
235+
</IconButton>
236+
</TooltipOutlined>
237+
)}
210238

211239
{/*</Tooltip>*/}
212240
{/*{llm.gen === 'sdxl' && <Chip size='sm' variant='outlined'>XL</Chip>} {llm.label}*/}
@@ -215,7 +243,7 @@ export function useLLMSelect(
215243

216244
return acc;
217245
}, [] as React.JSX.Element[]);
218-
}, [_filteredLLMs, noIcons, optimizeToSingleVisibleId]);
246+
}, [_filteredLLMs, llmId, noIcons, optimizeToSingleVisibleId]);
219247

220248

221249
const onSelectChange = React.useCallback((_event: unknown, value: DLLMId | null) => {

0 commit comments

Comments
 (0)