2024-10-26.5.29.59.mov
Note
A compact demo of streaming Markdown from Google AI Gemini and save to Tiptap Extension demo
/app/routes/_index.tsxthe main page/app/routes/api.ai.completions.tsai api/app/extensions/stream/index.tsextension config/app/extensions/stream/markdown-component.tsxhandling ai call and streaming markdown
- Tiptap
- React Markdown - Rendering streaming
- MarkdownIt - Render MD to HTML cater to Tiptap
- AI-SDK - Streaming functionality
- Gemini - Providing MD format response
- [Tiptap] Send prompt to Streaming Preview extension
- [StreamingPreview] Get prompt from attributes (node.attrs.prompt)
- [StreamingPreview] Call Gemini @ai/api/completions with ai-sdk
- [StreamingPreview] Rendering completion stream
- [StreamingPreview] Choosing to discard or save the response
- [StreamingPreview] Transform data and execute editor's api (commands)
- [Tiptap] Tiptap get's
HTMLand automatically transform it to visible format
Run the dev server:
npm run dev
First, build your app for production:
npm run buildThen run the app in production mode:
npm startNow you'll need to pick a host to deploy it to.
If you're familiar with deploying Node applications, the built-in Remix app server is production-ready.
Make sure to deploy the output of npm run build
build/serverbuild/client
This template comes with Tailwind CSS already configured for a simple default starting experience. You can use whatever css framework you prefer. See the Vite docs on css for more information.