-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow Model switching based on User Tier #1151
base: master
Are you sure you want to change the base?
Conversation
Enables users on free plan to choose AI models marked for free tier
- Update API to allow free tier users to switch between free models - Update web app to allow model switching on agent creation, settings chat page (via right side pane), even for free tier users. Previously the model switching APIs and UX fields on web app were completely disabled for free tier users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! will be awesome to extend model switching to unsubbed users.
> | ||
{model.name} | ||
{model.name} {model.tier === "standard" && <span className="text-green-500 ml-2">(Pro)</span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be consistent in naming?
{model.name} {model.tier === "standard" && <span className="text-green-500 ml-2">(Pro)</span>} | |
{model.name} {model.tier === "standard" && <span className="text-green-500 ml-2">(Futurist)</span>} |
{modelOption.name}{" "} | ||
{modelOption.tier === "standard" && ( | ||
<span className="text-green-500 ml-2"> | ||
(Pro) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
> | ||
{item.name} | ||
{item.name} {item.tier === "standard" && <span className="text-green-500 ml-2">(Pro)</span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
config = UserConversationConfig.objects.filter(user=user).first() | ||
if config: | ||
return config.setting | ||
subscribed = is_user_subscribed(user) | ||
if not subscribed: | ||
return ConversationAdapters.get_default_chat_model(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should come before the config check, in case the user is not subscribed & had an older setting that's using an upgraded chat model. We can also use this function to opportunistically correct that mismatch.
@@ -202,11 +202,16 @@ class ModelType(models.TextChoices): | |||
ANTHROPIC = "anthropic" | |||
GOOGLE = "google" | |||
|
|||
class PriceTier(models.TextChoices): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can define the PriceTier
class outside of the data model class so that it can be reused across data models.
@@ -452,6 +462,17 @@ class ServerChatSettings(DbBaseModel): | |||
WebScraper, on_delete=models.CASCADE, default=None, null=True, blank=True, related_name="web_scraper" | |||
) | |||
|
|||
def clean(self): | |||
error = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than throwing an error, let's correct it automatically? If the admin ends up here, it's most likely a mistake on their part, so we can gracefully correct it imo.
Overview
Enable free tier users to chat with any AI model made available on free tier
of production deployments like like Khoj cloud.
Previously model switching was completely disabled for users on free tier.
Details
chat page (via right side pane), even for free tier users.