proto: Add ZedProTrial
to Plan
(#28885)
This PR adds the `ZedProTrial` member to the `Plan` enum. Release Notes: - N/A
This commit is contained in:
parent
1e25e6b3cc
commit
97b044acf5
6 changed files with 17 additions and 9 deletions
|
@ -1561,14 +1561,18 @@ impl AssistantPanel {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
let error_message = match plan {
|
let error_message = match plan {
|
||||||
Plan::Free => "Model request limit reached. Upgrade to Zed Pro for more requests.",
|
|
||||||
Plan::ZedPro => {
|
Plan::ZedPro => {
|
||||||
"Model request limit reached. Upgrade to usage-based billing for more requests."
|
"Model request limit reached. Upgrade to usage-based billing for more requests."
|
||||||
}
|
}
|
||||||
|
Plan::ZedProTrial => {
|
||||||
|
"Model request limit reached. Upgrade to Zed Pro for more requests."
|
||||||
|
}
|
||||||
|
Plan::Free => "Model request limit reached. Upgrade to Zed Pro for more requests.",
|
||||||
};
|
};
|
||||||
let call_to_action = match plan {
|
let call_to_action = match plan {
|
||||||
Plan::Free => "Upgrade to Zed Pro",
|
|
||||||
Plan::ZedPro => "Upgrade to usage-based billing",
|
Plan::ZedPro => "Upgrade to usage-based billing",
|
||||||
|
Plan::ZedProTrial => "Upgrade to Zed Pro",
|
||||||
|
Plan::Free => "Upgrade to Zed Pro",
|
||||||
};
|
};
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
|
|
|
@ -3707,7 +3707,9 @@ async fn count_language_model_tokens(
|
||||||
|
|
||||||
let rate_limit: Box<dyn RateLimit> = match session.current_plan(&session.db().await).await? {
|
let rate_limit: Box<dyn RateLimit> = match session.current_plan(&session.db().await).await? {
|
||||||
proto::Plan::ZedPro => Box::new(ZedProCountLanguageModelTokensRateLimit),
|
proto::Plan::ZedPro => Box::new(ZedProCountLanguageModelTokensRateLimit),
|
||||||
proto::Plan::Free => Box::new(FreeCountLanguageModelTokensRateLimit),
|
proto::Plan::Free | proto::Plan::ZedProTrial => {
|
||||||
|
Box::new(FreeCountLanguageModelTokensRateLimit)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
session
|
session
|
||||||
|
@ -3827,7 +3829,7 @@ async fn compute_embeddings(
|
||||||
|
|
||||||
let rate_limit: Box<dyn RateLimit> = match session.current_plan(&session.db().await).await? {
|
let rate_limit: Box<dyn RateLimit> = match session.current_plan(&session.db().await).await? {
|
||||||
proto::Plan::ZedPro => Box::new(ZedProComputeEmbeddingsRateLimit),
|
proto::Plan::ZedPro => Box::new(ZedProComputeEmbeddingsRateLimit),
|
||||||
proto::Plan::Free => Box::new(FreeComputeEmbeddingsRateLimit),
|
proto::Plan::Free | proto::Plan::ZedProTrial => Box::new(FreeComputeEmbeddingsRateLimit),
|
||||||
};
|
};
|
||||||
|
|
||||||
session
|
session
|
||||||
|
|
|
@ -154,6 +154,9 @@ impl fmt::Display for ModelRequestLimitReachedError {
|
||||||
Plan::ZedPro => {
|
Plan::ZedPro => {
|
||||||
"Model request limit reached. Upgrade to usage-based billing for more requests."
|
"Model request limit reached. Upgrade to usage-based billing for more requests."
|
||||||
}
|
}
|
||||||
|
Plan::ZedProTrial => {
|
||||||
|
"Model request limit reached. Upgrade to Zed Pro for more requests."
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{message}")
|
write!(f, "{message}")
|
||||||
|
|
|
@ -546,7 +546,6 @@ impl PickerDelegate for LanguageModelPickerDelegate {
|
||||||
use feature_flags::FeatureFlagAppExt;
|
use feature_flags::FeatureFlagAppExt;
|
||||||
|
|
||||||
let plan = proto::Plan::ZedPro;
|
let plan = proto::Plan::ZedPro;
|
||||||
let is_trial = false;
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
h_flex()
|
h_flex()
|
||||||
|
@ -558,7 +557,6 @@ impl PickerDelegate for LanguageModelPickerDelegate {
|
||||||
.justify_between()
|
.justify_between()
|
||||||
.when(cx.has_flag::<ZedPro>(), |this| {
|
.when(cx.has_flag::<ZedPro>(), |this| {
|
||||||
this.child(match plan {
|
this.child(match plan {
|
||||||
// Already a Zed Pro subscriber
|
|
||||||
Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
|
Plan::ZedPro => Button::new("zed-pro", "Zed Pro")
|
||||||
.icon(IconName::ZedAssistant)
|
.icon(IconName::ZedAssistant)
|
||||||
.icon_size(IconSize::Small)
|
.icon_size(IconSize::Small)
|
||||||
|
@ -568,10 +566,9 @@ impl PickerDelegate for LanguageModelPickerDelegate {
|
||||||
window
|
window
|
||||||
.dispatch_action(Box::new(zed_actions::OpenAccountSettings), cx)
|
.dispatch_action(Box::new(zed_actions::OpenAccountSettings), cx)
|
||||||
}),
|
}),
|
||||||
// Free user
|
Plan::Free | Plan::ZedProTrial => Button::new(
|
||||||
Plan::Free => Button::new(
|
|
||||||
"try-pro",
|
"try-pro",
|
||||||
if is_trial {
|
if plan == Plan::ZedProTrial {
|
||||||
"Upgrade to Pro"
|
"Upgrade to Pro"
|
||||||
} else {
|
} else {
|
||||||
"Try Pro"
|
"Try Pro"
|
||||||
|
|
|
@ -18,6 +18,7 @@ message GetPrivateUserInfoResponse {
|
||||||
enum Plan {
|
enum Plan {
|
||||||
Free = 0;
|
Free = 0;
|
||||||
ZedPro = 1;
|
ZedPro = 1;
|
||||||
|
ZedProTrial = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UpdateUserPlan {
|
message UpdateUserPlan {
|
||||||
|
|
|
@ -751,6 +751,7 @@ impl TitleBar {
|
||||||
None => "",
|
None => "",
|
||||||
Some(proto::Plan::Free) => "Free",
|
Some(proto::Plan::Free) => "Free",
|
||||||
Some(proto::Plan::ZedPro) => "Pro",
|
Some(proto::Plan::ZedPro) => "Pro",
|
||||||
|
Some(proto::Plan::ZedProTrial) => "Pro (Trial)",
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
zed_actions::OpenAccountSettings.boxed_clone(),
|
zed_actions::OpenAccountSettings.boxed_clone(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue