Deprecate pro budget in app since it's not accurate (#210)

This commit is contained in:
Will Chen
2025-05-20 21:51:34 -07:00
committed by GitHub
parent be8252c130
commit 96153f29bb
3 changed files with 6 additions and 27 deletions

View File

@@ -114,14 +114,17 @@ export const UserSettingsSchema = z.object({
telemetryUserId: z.string().optional(),
hasRunBefore: z.boolean().optional(),
enableDyadPro: z.boolean().optional(),
dyadProBudget: DyadProBudgetSchema.optional(),
experiments: ExperimentsSchema.optional(),
lastShownReleaseNotesVersion: z.string().optional(),
maxChatTurnsInContext: z.number().optional(),
enableProSaverMode: z.boolean().optional(),
enableProLazyEditsMode: z.boolean().optional(),
enableProSmartFilesContextMode: z.boolean().optional(),
////////////////////////////////
// DEPRECATED.
////////////////////////////////
dyadProBudget: DyadProBudgetSchema.optional(),
runtimeMode: RuntimeModeSchema.optional(),
});

View File

@@ -189,21 +189,12 @@ function handleDeepLinkReturn(url: string) {
// dyad://dyad-pro-return?key=123&budget_reset_at=2025-05-26T16:31:13.492000Z&max_budget=100
if (parsed.hostname === "dyad-pro-return") {
const apiKey = parsed.searchParams.get("key");
// UTC time
// budget_reset_at: '2025-05-26T16:31:13.492000Z'
const budgetResetAt = parsed.searchParams.get("budget_reset_at");
const maxBudget = Number(parsed.searchParams.get("max_budget"));
if (!apiKey) {
dialog.showErrorBox(
"Invalid URL",
"Expected key, budget_reset_at, and max_budget",
);
dialog.showErrorBox("Invalid URL", "Expected key");
return;
}
handleDyadProReturn({
apiKey,
budgetResetAt,
maxBudget,
});
// Send message to renderer to trigger re-render
mainWindow?.webContents.send("deep-link-received", {

View File

@@ -1,14 +1,6 @@
import { readSettings, writeSettings } from "./settings";
export function handleDyadProReturn({
apiKey,
budgetResetAt,
maxBudget,
}: {
apiKey: string;
budgetResetAt: string | null | undefined;
maxBudget: number | null | undefined;
}) {
export function handleDyadProReturn({ apiKey }: { apiKey: string }) {
const settings = readSettings();
writeSettings({
providerSettings: {
@@ -20,13 +12,6 @@ export function handleDyadProReturn({
},
},
},
dyadProBudget:
budgetResetAt && maxBudget
? {
budgetResetAt,
maxBudget,
}
: undefined,
enableDyadPro: true,
});
}