Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send info if model is available together with the model #5804

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

pkukielka
Copy link
Contributor

@pkukielka pkukielka commented Oct 4, 2024

Changes

This change will allow clients to know if model is useable for them with of manually fetching account tier and computing model availability.
This makes client code simpler, ensures the same conditions are used by both Cody and clients, and is less error prone.

Test plan

This is only used in JetBrains currently.

Testplan on the JetBrains side:
sourcegraph/jetbrains#2386

Copy link
Contributor

@mkondratek mkondratek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ModelTag approach would be slightly cleaner but anyway lgtm

Comment on lines +210 to +213
export interface ModelAvailabilityStatus {
model: Model
isModelAvailable: boolean
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is OK but...

image

We have ModelTags to provide the model's meta-data. And a few values are called "statuses" in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have model tags in the model.
But that does not solve our issue.
It's ok to know if model is available for free or pro user, but that in itself does not answer the question if current user is pro or free. That is something outside of the model itself.

@pkukielka pkukielka merged commit f4138ff into main Oct 4, 2024
18 of 19 checks passed
@pkukielka pkukielka deleted the pkukielka/change-chat-model-endpoint branch October 4, 2024 13:00
pkukielka added a commit to sourcegraph/jetbrains that referenced this pull request Oct 4, 2024
…#2386)

## Changes

Follow-up to sourcegraph/cody#5804

Instead of manually fetching account tier and computing model
availability we instead receiving it from agent.
This makes code simpler, ensures the same consitions are used by both
Cody and JetBrains, and is less error prone.

## Test plan

**Free user**

1. Login as free user
2. Open Edit Code popup
3. Ensure models are visible
4. Choose one without `Pro` label and do the edit -> it should success
5. Choose one with `Pro` label and do the edit -> it should open the
account upgrade website

**Pro use**

1. Login as pro user
2. Open Edit Code popup
3. Ensure models are visible, and there are no `Pro` labels anywhere
4. Choose model which was previously marked as pro on the free tier and
do the edit -> it should success

**Enterprise user**

1. Login as enterprise user
2. Open Edit Code popup
3. Ensure models are visible, and there are no `Pro` labels anywhere
4. Choose model which was previously marked as pro (if such exists) on
the free tier and do the edit -> it should success

Attention: This is different than the current behaviour, but I checked
Cody and it allows for model selection for the enterprise accounts so I
think JetBrains behaviour drifted there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants