mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-15 00:00:04 +00:00
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run
This commit fixes the timing of the /whoami call used for the PrefixLogger (a logger for puter.js that displays app names) to ensure the API origin and token are available. This is done by waiting for a service called 'api-access' to be initialized first. This was discovered while testing changes for /whoami responses that display icons, because the current behavior breaks the call for non-puter.com instances.
Puter.js
The official JavaScript SDK for Puter.com. Cloud and AI features right from your frontend code!
« LIVE DEMO »
Docs
·
Puter.com
·
Discord
·
Reddit
·
X (Twitter)
Example
Make sure the development server is running.
<html>
<body>
<script src="http://puter.localhost:4100/sdk/puter.dev.js"></script>
<script>
// Loading ...
puter.print(`Loading...`);
// Chat with GPT-3.5 Turbo
puter.ai.chat(`What color was Napoleon's white horse?`).then((response) => {
puter.print(response);
});
</script>
</body>
</html>