diff --git a/packages/console/app/src/i18n/en.ts b/packages/console/app/src/i18n/en.ts index 726a9282d2..ac5efc7368 100644 --- a/packages/console/app/src/i18n/en.ts +++ b/packages/console/app/src/i18n/en.ts @@ -390,6 +390,8 @@ export const dict = { "zen.api.error.modelDisabled": "Model is disabled", "zen.api.error.regionNotAllowed": "The latest version of this model is only available hosted in China and requires explicit opt in: {{consoleGoUrl}}", + "zen.api.error.nonZdrNotAllowed": + "This model collects data used to improve its quality and requires explicit opt in: {{consoleGoUrl}}", "zen.api.error.trialEnded": "Free promotion has ended for {{model}}. You can continue using the model by subscribing to OpenCode Go - {{link}}", @@ -671,6 +673,7 @@ export const dict = { 'Select "OpenCode Go" as the provider in your opencode configuration to use Go models.', "workspace.lite.providers.title": "Providers", "workspace.lite.providers.description": "Control which providers are used for routing.", + "workspace.lite.providers.allowNonZdr": "Enable models without zero data retention", "workspace.lite.providers.useChina": "Enable models hosted in China", "workspace.lite.black.message": "You're currently subscribed to OpenCode Black or on the waitlist. Please unsubscribe first if you'd like to switch to Go.", diff --git a/packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx b/packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx index 4de88cba3c..dca06a196c 100644 --- a/packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx +++ b/packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx @@ -39,6 +39,7 @@ export const queryLiteSubscription = query(async (workspaceID: string) => { timeCreated: LiteTable.timeCreated, lite: BillingTable.lite, region: WorkspaceTable.region, + allowNonZdr: WorkspaceTable.allow_non_zdr, }) .from(BillingTable) .innerJoin(LiteTable, eq(LiteTable.workspaceID, BillingTable.workspaceID)) @@ -54,6 +55,7 @@ export const queryLiteSubscription = query(async (workspaceID: string) => { return { mine, useBalance: row.lite?.useBalance ?? false, + allowNonZdr: row.allowNonZdr ?? false, region: row.region ?? (await Workspace.setDefaultRegion({ country: countryFromRequest(getRequestEvent()?.request) })), rollingUsage: Subscription.analyzeRollingUsage({ @@ -154,6 +156,24 @@ const setGoProviderRouting = action(async (form: FormData) => { ) }, "go.providerRouting.set") +const setGoAllowNonZdr = action(async (form: FormData) => { + "use server" + const workspaceID = form.get("workspaceID") as string | null + if (!workspaceID) return { error: formError.workspaceRequired } + const allowNonZdr = (form.get("allowNonZdr") as string | null) === "true" + + return json( + await withActor( + () => + Workspace.update({ allow_non_zdr: allowNonZdr }) + .then(() => ({ error: undefined })) + .catch((e) => ({ error: e.message as string })), + workspaceID, + ), + { revalidate: queryLiteSubscription.key }, + ) +}, "go.allowNonZdr.set") + function LiteUsageItem(props: { label: string; usage: { usagePercent: number; resetInSec: number } }) { const i18n = useI18n() @@ -186,6 +206,7 @@ export function LiteSection(props: { lite: LiteSubscription | undefined }) { const checkoutSubmission = useSubmission(createLiteCheckoutUrl) const useBalanceSubmission = useSubmission(setLiteUseBalance) const providerRoutingSubmission = useSubmission(setGoProviderRouting) + const allowNonZdrSubmission = useSubmission(setGoAllowNonZdr) const [store, setStore] = createStore({ loading: undefined as undefined | "session" | "checkout" | "alipay" | "upi", showModal: false, @@ -264,6 +285,20 @@ export function LiteSection(props: { lite: LiteSubscription | undefined }) {
{i18n.t("workspace.lite.providers.description")}
+