This demo integrates with OpenAI's completions API (i.e. ChatGPT) using Emscripten's fetch mechanism in the browser, providing a simple interface with Dear Imgui.
This is part four of a simple proof of concept, a minimal 3D engine written in C++, compiled to WASM with Emscripten. Running in the browser, rendering with WebGPU.
You need to provide your own OpenAI API key.
For the other demos, see:
- https://github.com/Armchair-Software/webgpu-demo
- https://github.com/Armchair-Software/webgpu-demo2
- https://github.com/Armchair-Software/webgpu-shader-demo
Live demo: https://armchair-software.github.io/chatgpt-emscripten-demo/
This requires Firefox Nightly, or a recent version of Chrome or Chromium, with webgpu and Vulkan support explicitly enabled.
- Emscripten
- CMake
- Emscripten Browser Clipboard (included)
- VectorStorm (included)
- LogStorm (included)
- magic_enum (included)
- JSON for Modern C++ (included)
- dear imgui with the proposed
imgui_impl_emscripten
backend (included)
The easiest way to assemble everything is to use the included build script:
./build.sh
To launch a local server and bring up a browser:
./run.sh
For manual builds with CMake, and to adjust how the example is run locally, inspect the build.sh
and run.sh
scripts.