Skip to content

Commit

Permalink
fix needs-cody-pro model selector bugs (#4131)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed May 10, 2024
1 parent c3e8efc commit c49642c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vscode/webviews/components/modelSelectField/ModelSelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const ModelSelectField: React.FunctionComponent<{

const onModelSelect = useCallback(
(model: ModelProvider): void => {
if (showCodyProBadge && selectedModel.codyProOnly) {
if (showCodyProBadge && model.codyProOnly) {
getVSCodeAPI().postMessage({
command: 'links',
value: 'https://sourcegraph.com/cody/subscription',
Expand All @@ -51,11 +51,11 @@ export const ModelSelectField: React.FunctionComponent<{
getVSCodeAPI().postMessage({
command: 'event',
eventName: 'CodyVSCodeExtension:chooseLLM:clicked',
properties: { LLM_provider: selectedModel.model },
properties: { LLM_provider: model.model },
})
parentOnModelSelect(model)
},
[showCodyProBadge, selectedModel, parentOnModelSelect]
[showCodyProBadge, parentOnModelSelect]
)

const onPopoverOpen = useCallback((): void => {
Expand Down Expand Up @@ -86,7 +86,11 @@ export const ModelSelectField: React.FunctionComponent<{
/>
),
filterKeywords: [m.title, m.provider],
disabled: modelAvailability(userInfo, m) !== 'available',
// needs-cody-pro models should be clickable (not disabled) so the user can
// be taken to the upgrade page.
disabled: !['available', 'needs-cody-pro'].includes(
modelAvailability(userInfo, m)
),
group: m.uiGroup ?? 'Other',
}) satisfies SelectListOption
),
Expand Down

0 comments on commit c49642c

Please sign in to comment.