Msrc/runtime/types/index.ts+24-3
Msrc/runtime/composables/useAiChat.ts+18-5
Msrc/module.ts+8-2
MREADME.md+45-12
Code blocks, terminals, artifacts, and dev tooling UI working together.
CodeBlock
1import { streamText } from 'ai'
2import { openai } from '@ai-sdk/openai'
3
4const result = await streamText({
5 model: openai('gpt-4o'),
6 prompt: 'What is RAG?',
7 system: 'You are a helpful assistant.',
8})
Terminal
File Tree
Artifact
<script setup lang="ts">
const { aiMessages, input, handleSubmit, isStreaming } = useAiChat({ api: '/api/chat' })
</script>
<template>
<AiMessage v-for="(msg, i) in aiMessages" :key="i" v-bind="msg">
<template #content="{ content, isStreaming: streaming }">
{{ content }}<AiStreamingCursor v-if="streaming" />
</template>
</AiMessage>
<AiPromptInput v-model="input" :loading="isStreaming" @submit="handleSubmit" />
</template>Snippet
import type { AiMessageProps } from 'ai-elements-nuxt/types'Commit
Env Vars
Test Results
Stack Trace
Agent