Skip to content

Commit

Permalink
Updated Wasp version to 0.12.3 + Mage to use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martinsos committed Mar 1, 2024
1 parent b784571 commit f2721e7
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN cd .wasp/build/server && npm run bundle
# TODO: Use pm2?
# TODO: Use non-root user (node).
FROM base AS server-production
RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.12.2
RUN curl -sSL https://get.wasp-lang.dev/installer.sh | sh -s -- -v 0.12.3
ENV PATH "$PATH:/root/.local/bin"
ENV NODE_ENV production
WORKDIR /app
Expand Down
13 changes: 10 additions & 3 deletions mage/src/client/pages/ResultPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,15 @@ export function OnSuccessModal({ isOpen, setIsOpen, appGenerationResult }) {
return <span className="py-1 px-2 font-semibold text-pink-800 rounded">{children}</span>;
}

function calcCostForGpt_3_5_Turbo_0125 (numTokensSpent) {
const estimatedInputTokenShare = 0.8;
const estimatedOutputTokenShare = 1 - estimatedInputTokenShare;
const costInUsdForMillionInputTokens = 0.5; // This is price for GPT 3.5 Turbo 0125.
const costInUsdForMillionOutputTokens = 1.5; // This is price for GPT 3.5 Turbo 0125.
const costInUsdForMillionTokens = costInUsdForMillionInputTokens * estimatedInputTokenShare + costInUsdForMillionOutputTokens * estimatedOutputTokenShare;
return (numTokensSpent / 1e6 * costInUsdForMillionTokens).toFixed(2);
}

return (
<MyDialog
isOpen={isOpen}
Expand All @@ -481,9 +490,7 @@ export function OnSuccessModal({ isOpen, setIsOpen, appGenerationResult }) {
<td className="p-2 text-gray-600"> Cost to generate your app: </td>
<td className="p-2 text-gray-600">
{" "}
<FormattedText>{`$${((Number(numTokensSpent) / 1000) * 0.004).toFixed(
2
)}`}</FormattedText>{" "}
<FormattedText>{`~$${calcCostForGpt_3_5_Turbo_0125(Number(numTokensSpent))}`}</FormattedText>{" "}
</td>
</tr>
{numTotalProjects && (
Expand Down
6 changes: 6 additions & 0 deletions waspc/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.12.3

### 🎉 New features

- Wasp AI switched from GPT 3.5 Turbo 0613 to GPT 3.5 Turbo 0125, which gives it bigger context, ensuring generation doesn't fail for bigger apps, while also being cheaper.

## 0.12.2

### 🐞 Bug fixes
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion waspc/waspc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cabal-version: 2.4
-- Consider using hpack, or maybe even hpack-dhall.

name: waspc
version: 0.12.2
version: 0.12.3
description: Please see the README on GitHub at <https://github.com/wasp-lang/wasp/waspc#readme>
homepage: https://github.com/wasp-lang/wasp/waspc#readme
bug-reports: https://github.com/wasp-lang/wasp/issues
Expand Down

0 comments on commit f2721e7

Please sign in to comment.