fix: support setting visibility on initial chat creation (#975)
This commit is contained in:
parent
a3221fbcdc
commit
575c12503c
15 changed files with 158 additions and 32 deletions
|
|
@ -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;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue