free trial logic fixes

This commit is contained in:
Dallin Romney 2025-01-20 15:16:50 -08:00
parent 709e597bfe
commit 442b8637fb
4 changed files with 16 additions and 23 deletions

View file

@ -9,7 +9,7 @@ export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b";
export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B";
/**
* We set the "best" chat + autocopmlete models by default
* We set the "best" chat + autocomplete models by default
* whenever a user doesn't have a config.json
*/
export function setupBestConfig(

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.252",
"version": "0.9.253",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.252",
"version": "0.9.253",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",

View file

@ -151,11 +151,7 @@ const Layout = () => {
"incrementFtc",
async () => {
const u = getLocalStorage("ftc");
if (u) {
setLocalStorage("ftc", u + 1);
} else {
setLocalStorage("ftc", 1);
}
setLocalStorage("ftc", (u ?? 0) + 1);
},
[],
);

View file

@ -247,21 +247,18 @@ export function Chat() {
editorToClearOnSend?: Editor,
) => {
if (defaultModel?.provider === "free-trial") {
const u = getLocalStorage("ftc");
if (u) {
setLocalStorage("ftc", u + 1);
if (u >= FREE_TRIAL_LIMIT_REQUESTS) {
onboardingCard.open("Best");
posthog?.capture("ftc_reached");
ideMessenger.ide.showToast(
"info",
"You've reached the free trial limit. Please configure a model to continue.",
);
return;
}
} else {
setLocalStorage("ftc", 1);
const u = getLocalStorage("ftc") ?? 0;
setLocalStorage("ftc", u + 1);
if (u === FREE_TRIAL_LIMIT_REQUESTS) {
posthog?.capture("ftc_reached");
}
if (u >= FREE_TRIAL_LIMIT_REQUESTS) {
onboardingCard.open("Best");
ideMessenger.ide.showToast(
"info",
"You've reached the free trial limit. Please configure a model to continue.",
);
return;
}
}