mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-09-11 15:26:19 +03:00
fix parsing number
This commit is contained in:
parent
6952d72cc9
commit
e0f740f871
@ -421,7 +421,7 @@ export function OnSuccessModal({ isOpen, setIsOpen, appGenerationResult }) {
|
|||||||
const logText = appGenerationResult?.project?.logs?.find((log) => /tokens usage/i.test(log.content))?.content;
|
const logText = appGenerationResult?.project?.logs?.find((log) => /tokens usage/i.test(log.content))?.content;
|
||||||
const tokenNumberStr = logText ? logText.split(":")[1]?.trim() : null;
|
const tokenNumberStr = logText ? logText.split(":")[1]?.trim() : null;
|
||||||
if (tokenNumberStr) {
|
if (tokenNumberStr) {
|
||||||
const num = Number(tokenNumberStr.replace(/[\s~k]/gi, '')) * 1000;
|
const num = parseInt(tokenNumberStr.replace(/[\s~k]/gi, '')) * 1000;
|
||||||
if (num.toString().match(/^[0-9]+$/)) {
|
if (num.toString().match(/^[0-9]+$/)) {
|
||||||
setNumTokensSpent(num);
|
setNumTokensSpent(num);
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ export function OnSuccessModal({ isOpen, setIsOpen, appGenerationResult }) {
|
|||||||
<p className="text-base leading-relaxed text-gray-500">
|
<p className="text-base leading-relaxed text-gray-500">
|
||||||
We've made this tool completely <span className="font-semibold">free</span> and cover all the costs 😇
|
We've made this tool completely <span className="font-semibold">free</span> and cover all the costs 😇
|
||||||
</p>
|
</p>
|
||||||
{numTokensSpent && (
|
{numTokensSpent ? (
|
||||||
<table className="bg-slate-50 rounded-lg divide-y divide-gray-100 w-full text-base leading-relaxed text-gray-500 text-sm">
|
<table className="bg-slate-50 rounded-lg divide-y divide-gray-100 w-full text-base leading-relaxed text-gray-500 text-sm">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
@ -477,7 +477,7 @@ export function OnSuccessModal({ isOpen, setIsOpen, appGenerationResult }) {
|
|||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
)}
|
) : null}
|
||||||
<p className="text-base leading-relaxed text-gray-500">
|
<p className="text-base leading-relaxed text-gray-500">
|
||||||
But you can still show your support by starring us on GitHub:
|
But you can still show your support by starring us on GitHub:
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user