fix: support setting visibility on initial chat creation (#975)

This commit is contained in:
Jeremy 2025-05-01 17:47:48 -07:00 committed by GitHub
parent a3221fbcdc
commit 575c12503c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 158 additions and 32 deletions

View file

@ -26,6 +26,7 @@ import type { UseChatHelpers } from '@ai-sdk/react';
import { AnimatePresence, motion } from 'framer-motion';
import { ArrowDown } from 'lucide-react';
import { useScrollToBottom } from '@/hooks/use-scroll-to-bottom';
import type { VisibilityType } from './visibility-selector';
function PureMultimodalInput({
chatId,
@ -40,6 +41,7 @@ function PureMultimodalInput({
append,
handleSubmit,
className,
selectedVisibilityType,
}: {
chatId: string;
input: UseChatHelpers['input'];
@ -53,6 +55,7 @@ function PureMultimodalInput({
append: UseChatHelpers['append'];
handleSubmit: UseChatHelpers['handleSubmit'];
className?: string;
selectedVisibilityType: VisibilityType;
}) {
const textareaRef = useRef<HTMLTextAreaElement>(null);
const { width } = useWindowSize();
@ -220,7 +223,11 @@ function PureMultimodalInput({
{messages.length === 0 &&
attachments.length === 0 &&
uploadQueue.length === 0 && (
<SuggestedActions append={append} chatId={chatId} />
<SuggestedActions
append={append}
chatId={chatId}
selectedVisibilityType={selectedVisibilityType}
/>
)}
<input
@ -309,6 +316,8 @@ export const MultimodalInput = memo(
if (prevProps.input !== nextProps.input) return false;
if (prevProps.status !== nextProps.status) return false;
if (!equal(prevProps.attachments, nextProps.attachments)) return false;
if (prevProps.selectedVisibilityType !== nextProps.selectedVisibilityType)
return false;
return true;
},