ChatPromptSubmit

Eine Schaltfläche zum Senden von Chat-Aufforderungen mit automatischer Statusbehandlung.

Bearbeiten

Die ChatPromptSubmit-Komponente wird in der Komponente ChatPrompt verwendet, um die Eingabeaufforderung zu senden.

Es erweitert die Komponente Button, so dass Sie jede Eigenschaft wie color, variant, size usw. übergeben können.

<template>
  <UChatPrompt>
    <UChatPromptSubmit />
  </UChatPrompt>
</template>
Sie können es auch innerhalb des footer-Steckplatzes der ChatPrompt-Komponente verwenden.

ready ist verfügbar

Wenn der Status ready ist, verwenden Sie die Props color, variant und icon, um die Schaltfläche anzupassen.

  • color="primary" (nicht vorhanden)
  • variant="solid" (nicht vorhanden)
  • icon="i-lucide-arrow-up" (nicht vorhanden)
<template>
  <UChatPromptSubmit color="primary" variant="solid" icon="i-lucide-arrow-up" />
</template>
Sie können dieses Symbol global in Ihrem app.config.ts unter ui.icons.arrowUp Schlüssel anpassen.
Sie können dieses Symbol global in Ihrem vite.config.ts unter ui.icons.arrowUp Schlüssel anpassen.

Eingereicht

Wenn der Status submitted ist, verwenden Sie die Props submitted-color, submitted-variant und submitted-icon, um die Schaltfläche anzupassen.

  • submittedColor="neutral" (nicht vorhanden)
  • submittedVariant="subtle"x077xx07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x07x007x07x07x007x07x007x07x007x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  • submittedIcon="i-lucide-square" (nicht vorhanden)
Das stop-Ereignis wird ausgegeben, wenn der Benutzer auf den Button klickt.
<template>
  <UChatPromptSubmit
    submitted-color="neutral"
    submitted-variant="subtle"
    submitted-icon="i-lucide-square"
    status="submitted"
  />
</template>
Sie können dieses Symbol global in Ihrem app.config.ts unter ui.icons.stop Schlüssel anpassen.
Sie können dieses Symbol global in Ihrem vite.config.ts unter ui.icons.stop Schlüssel anpassen.

streaming (englisch)

Wenn der Status streaming ist, verwenden Sie die Props streaming-color, streaming-variant und streaming-icon, um die Schaltfläche anzupassen.

  • streamingColor="neutral" (nicht)
  • streamingVariant="subtle" (nicht)
  • streamingIcon="i-lucide-square" (nicht)
Das stop-Ereignis wird ausgegeben, wenn der Benutzer auf den Button klickt.
<template>
  <UChatPromptSubmit
    streaming-color="neutral"
    streaming-variant="subtle"
    streaming-icon="i-lucide-square"
    status="streaming"
  />
</template>
Sie können dieses Symbol global in Ihrem app.config.ts unter ui.icons.stop Schlüssel anpassen.
Sie können dieses Symbol global in Ihrem vite.config.ts unter ui.icons.stop Schlüssel anpassen.

Fehler

Wenn der Status error ist, verwenden Sie die Props error-color, error-variant und error-icon, um die Schaltfläche anzupassen.

  • errorColor="error" (englisch)
  • errorVariant="soft" (englisch)
  • errorIcon="i-lucide-rotate-ccw" (englisch)
Das reload-Ereignis wird ausgegeben, wenn der Benutzer auf den Button klickt.
<template>
  <UChatPromptSubmit
    error-color="error"
    error-variant="soft"
    error-icon="i-lucide-rotate-ccw"
    status="error"
  />
</template>
Sie können dieses Symbol global in Ihrem app.config.ts unter der ui.icons.reload-Taste.
Sie können dieses Symbol global in Ihrem vite.config.ts unter ui.icons.reload Schlüssel anpassen.

Beispiele

Auf der Übersichtsseite von Chat finden Sie Installationsanweisungen, Server-Setup und Anwendungsbeispiele.

API

Props (englisch)

Prop Default Type
as
'button'
any

The element or component this component should render as when not a link.

status
'ready'
"error" | "ready" | "submitted" | "streaming"
icon
appConfig.ui.icons.arrowUp
any

The icon displayed in the button when the status is ready. Set to false to hide the icon.

color
'primary'
"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"

The color of the button when the status is ready.

variant
'solid'
"link" | "outline" | "soft" | "subtle" | "ghost" | "solid"

The variant of the button when the status is ready.

streamingIcon
appConfig.ui.icons.stop
any

The icon displayed in the button when the status is streaming.

streamingColor
'neutral'
"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"

The color of the button when the status is streaming.

streamingVariant
'subtle'
"link" | "outline" | "soft" | "subtle" | "ghost" | "solid"

The variant of the button when the status is streaming.

submittedIcon
appConfig.ui.icons.stop
any

The icon displayed in the button when the status is submitted.

submittedColor
'neutral'
"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"

The color of the button when the status is submitted.

submittedVariant
'subtle'
"link" | "outline" | "soft" | "subtle" | "ghost" | "solid"

The variant of the button when the status is submitted.

errorIcon
appConfig.ui.icons.reload
any

The icon displayed in the button when the status is error.

errorColor
'error'
"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"

The color of the button when the status is error.

errorVariant
'soft'
"link" | "outline" | "soft" | "subtle" | "ghost" | "solid"

The variant of the button when the status is error.

autofocus
false | true | "true" | "false"
avatar
AvatarProps

Display an avatar on the left side.

loading
boolean

When true, the loading icon will be displayed.

loadingIcon
appConfig.ui.icons.loading
any

The icon when the loading prop is true.

disabled
boolean
name
string
label
string
size
'md'
"xs" | "sm" | "md" | "lg" | "xl"
leading
boolean

When true, the icon will be displayed on the left side.

leadingIcon
any

Display an icon on the left side.

trailing
boolean

When true, the icon will be displayed on the right side.

trailingIcon
any

Display an icon on the right side.

type
'button'
"reset" | "submit" | "button"

The type of the button when not a link.

activeColor
"error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"
activeVariant
"link" | "outline" | "soft" | "subtle" | "ghost" | "solid"
square
boolean

Render the button with equal padding on all sides.

block
boolean

Render the button full width.

loadingAuto
boolean

Set loading state automatically based on the @click promise state

ui
{ base?: SlotClass; } & { base?: SlotClass; label?: SlotClass; leadingIcon?: SlotClass; leadingAvatar?: SlotClass; leadingAvatarSize?: SlotClass; trailingIcon?: SlotClass; }
Diese Komponente unterstützt auch alle nativen <button>-HTML-Attribute.

Slots (englisch)

Slot Type
leading
{ ui: object; }
default
{ ui: object; }
trailing
{ ui: object; }

Emits Bearbeiten

Event Type
stop
[event: MouseEvent]
reload
[event: MouseEvent]

Theme Bearbeiten

app.config.ts
export default defineAppConfig({
  ui: {
    chatPromptSubmit: {
      slots: {
        base: ''
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    vue(),
    ui({
      ui: {
        chatPromptSubmit: {
          slots: {
            base: ''
          }
        }
      }
    })
  ]
})

Changelog (deutsch)

No recent changes