diff --git a/apps/www/content/3.components/1.chatbot/prompt-input.md b/apps/www/content/3.components/1.chatbot/prompt-input.md index aa604e6..7d450f7 100644 --- a/apps/www/content/3.components/1.chatbot/prompt-input.md +++ b/apps/www/content/3.components/1.chatbot/prompt-input.md @@ -1,12 +1,12 @@ --- title: Prompt Input -description: -icon: lucide:send +description: Allows a user to send a message with file attachments to a large language model. It includes a textarea, file upload capabilities, a submit button, and a dropdown for selecting the model. +icon: lucide:corner-down-left --- -The `PromptInput` component allows a user to send a message to a large language model. It includes a textarea, a submit button, and a dropdown for selecting the model. +The `PromptInput` component allows a user to send a message with file attachments to a large language model. It includes a textarea, file upload capabilities, a submit button, and a dropdown for selecting the model. -:::ComponentLoader{label="PromptInput" componentName="PromptInput"} +:::ComponentLoader{label="Preview" componentName="PromptInput"} ::: ## Install using CLI @@ -30,281 +30,1485 @@ The `PromptInput` component allows a user to send a message to a large language Copy and paste the following code in the same folder. :::code-group - ```vue [PromptInput.vue] - + + +``` + +```vue [PromptInput.vue] height=300 collapse + + + +``` + +```vue [PromptInputTextarea.vue] height=300 collapse + + + +``` + +```vue [PromptInputTools.vue] height=300 collapse + + + +``` + +```vue [PromptInputButton.vue] height=300 collapse + + + +``` + +```vue [PromptInputSubmit.vue] height=300 collapse + + + +``` + +```vue [PromptInputBody.vue] height=300 collapse + + + +``` + +```vue [PromptInputAttachments.vue] height=300 collapse + + + +``` + +```vue [PromptInputAttachment.vue] height=300 collapse + + + +``` + +```vue [PromptInputHeader.vue] height=300 collapse + + + +``` + +```vue [PromptInputFooter.vue] height=300 collapse + + + +``` + +```vue [PromptInputActionMenu.vue] height=300 collapse + + + +``` + +```vue [PromptInputActionMenuTrigger.vue] height=300 collapse + + + +``` + +```vue [PromptInputActionMenuContent.vue] height=300 collapse + + + +``` + +```vue [PromptInputActionMenuItem.vue] height=300 collapse + + + +``` + +```vue [PromptInputActionAddAttachments.vue] height=300 collapse + + + +``` + +```vue [PromptInputSpeechButton.vue] height=300 collapse + + + +``` + +```vue [PromptInputSelect.vue] height=300 collapse + + + +``` + +```vue [PromptInputSelectTrigger.vue] height=300 collapse + + + +``` + +```vue [PromptInputSelectContent.vue] height=300 collapse + + + +``` + +```vue [PromptInputSelectItem.vue] height=300 collapse + + + +``` + +```vue [PromptInputSelectValue.vue] height=300 collapse + + + +``` + +```vue [PromptInputHoverCard.vue] height=300 collapse + + + +``` + +```vue [PromptInputHoverCardTrigger.vue] height=300 collapse + + + +``` + +```vue [PromptInputHoverCardContent.vue] height=300 collapse + + + +``` + +```vue [PromptInputTabsList.vue] height=300 collapse + + + +``` + +```vue [PromptInputTab.vue] height=300 collapse + + + +``` + +```vue [PromptInputTabLabel.vue] height=300 collapse + + + +``` + +```vue [PromptInputTabBody.vue] height=300 collapse + + + +``` + +```vue [PromptInputTabItem.vue] height=300 collapse + + + +``` + +```vue [PromptInputCommand.vue] height=300 collapse + + + +``` + +```vue [PromptInputCommandInput.vue] height=300 collapse + + + +``` + +```vue [PromptInputCommandList.vue] height=300 collapse + - interface Props { - class?: string - } + +``` - const props = defineProps() - const attrs = useAttrs() +```vue [PromptInputCommandEmpty.vue] height=300 collapse + +type PromptInputCommandEmptyProps = InstanceType['$props'] - - ``` +interface Props extends /* @vue-ignore */ PromptInputCommandEmptyProps { + class?: HTMLAttributes['class'] +} - ```vue [PromptInputTextarea.vue] - - interface Props { - class?: string - placeholder?: string - } + +``` - const props = defineProps() - const attrs = useAttrs() - - const placeholder = props.placeholder ?? 'What would you like to know?' - - const classes = computed(() => [ - 'w-full resize-none rounded-none border-none p-3 shadow-none outline-none ring-0', - 'field-sizing-content max-h-[6lh] bg-transparent dark:bg-transparent', - 'focus-visible:ring-0', - props.class, - ]) - - function handleKeyDown(e: KeyboardEvent) { - if (e.key === 'Enter') { - if ((e as any).nativeEvent?.isComposing) - return - if (e.shiftKey) - return - e.preventDefault() - const form = (e.target as HTMLTextAreaElement).form - form?.requestSubmit() - } - } - - -