-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error modal when you run out of tokens
- Loading branch information
1 parent
2070298
commit f4defff
Showing
7 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,5 @@ | |
display: flex; | ||
justify-content: flex-end; | ||
margin-top: 16px; | ||
gap: 8px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { settingsAtom } from "@/state/settings"; | ||
import { getDefaultStore } from "jotai"; | ||
import { alert } from "./alert"; | ||
|
||
export function showUpsell() { | ||
alert({ | ||
alertId: "OUT_OF_CREDITS", | ||
message: ( | ||
<div style={{ display: "flex", flexDirection: "column", gap: "8px" }}> | ||
<p> | ||
You've used all your available tokens for high-quality | ||
generations with Claude 3.5 Sonnet. | ||
</p> | ||
<p>To continue using Windows 9X, you have two options:</p> | ||
<ul style={{ paddingLeft: "20px", marginTop: "4px" }}> | ||
<li>Purchase additional quality tokens</li> | ||
<li>Switch to our free model (with reduced capabilities)</li> | ||
</ul> | ||
</div> | ||
), | ||
icon: "x", | ||
actions: [ | ||
{ | ||
label: "Use Free Model", | ||
callback: (close) => { | ||
getDefaultStore().set(settingsAtom, { | ||
...getDefaultStore().get(settingsAtom), | ||
model: "cheap", | ||
}); | ||
close(); | ||
}, | ||
}, | ||
{ | ||
label: "Get Tokens", | ||
callback: (close) => { | ||
const form = document.createElement("form"); | ||
form.method = "POST"; | ||
form.action = "/api/checkout"; | ||
form.target = "_blank"; | ||
document.body.appendChild(form); | ||
form.submit(); | ||
document.body.removeChild(form); | ||
close(); | ||
}, | ||
}, | ||
], | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters