fix: only alert free trial if using free trial
This commit is contained in:
parent
08bd14c7ab
commit
f0e73ef63a
4 changed files with 12 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { SecretType } from "@continuedev/config-yaml";
|
||||
import { BrowserSerializedContinueConfig } from "core";
|
||||
import { usesFreeTrialApiKey } from "./freeTrialHelpers";
|
||||
import { vi } from "vitest";
|
||||
import { BrowserSerializedContinueConfig } from "..";
|
||||
import { usesFreeTrialApiKey } from "./usesFreeTrialApiKey";
|
||||
|
||||
// Mock the decodeSecretLocation function
|
||||
vi.mock("@continuedev/config-yaml", async () => {
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
import { decodeSecretLocation, SecretType } from "@continuedev/config-yaml";
|
||||
import { BrowserSerializedContinueConfig } from "core";
|
||||
/**
|
||||
* Helper function to determine if the config uses a free trial API key
|
||||
* @param config The serialized config object
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import { fetchwithRequestOptions } from "@continuedev/fetch";
|
||||
import { ChatMessage, IDE, PromptLog } from "..";
|
||||
import { ConfigHandler } from "../config/ConfigHandler";
|
||||
import { usesFreeTrialApiKey } from "../config/usesFreeTrialApiKey";
|
||||
import { FromCoreProtocol, ToCoreProtocol } from "../protocol";
|
||||
import { IMessenger, Message } from "../protocol/messenger";
|
||||
import { Telemetry } from "../util/posthog";
|
||||
|
|
@ -149,6 +150,13 @@ async function checkForFreeTrialExceeded(
|
|||
configHandler: ConfigHandler,
|
||||
messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
) {
|
||||
const { config } = await configHandler.getSerializedConfig();
|
||||
|
||||
// Only check if the user is using the free trial
|
||||
if (!usesFreeTrialApiKey(config)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const freeTrialStatus =
|
||||
await configHandler.controlPlaneClient.getFreeTrialStatus();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import { ErrorsSectionTooltip } from "../sections/errors/ErrorsSectionTooltip";
|
|||
import { McpSectionTooltip } from "../sections/mcp/MCPTooltip";
|
||||
import { ToolsSectionTooltip } from "../sections/tool-policies/ToolPoliciesSectionTooltip";
|
||||
|
||||
import { usesFreeTrialApiKey } from "core/config/usesFreeTrialApiKey";
|
||||
import type { FreeTrialStatus } from "core/control-plane/client";
|
||||
import { usesFreeTrialApiKey } from "../../../../util/freeTrialHelpers";
|
||||
|
||||
interface BlockSettingsToolbarIcon {
|
||||
title: string;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue