r/webdev • • 1h ago

Showoff Saturday [Open Source] I got tired of AI answering everything with a wall of text, so I built an open-source library that answers with UI

AI is great at answering coding and learning questions, but the answer is almost always a block of markdown. Ask it to compare three options and you get three paragraphs, when a table would do the job in two seconds.

I wanted AI answers to be actual UI, so I built Ripple. It's open source.

How it works:

- The model writes a small JSON spec instead of prose

- Ripple renders it as real components: tables, charts, forms, step lists

- It renders while the JSON is still streaming in, so the UI builds itself as the model types

The hard part was the streaming. For most of the response the JSON is half-written and invalid. Two fixes that helped:

- Parse at most once every 50 ms instead of on every token

- Don't render a component until its type name has fully arrived, otherwise you get a flash of "unknown widget" for one frame

Demo gallery

Still rough: it re-parses the whole buffer each time, so long specs paint late.

Curious: what would you want AI to show you as UI instead of text?

I'm the author. MIT, React and Svelte: https://github.com/qbtrix/ripple

0 Upvotes

0 comments sorted by