-
- );
+ return attachments?.files.length > 0
+ ? attachments?.files.map((file) => (
+ {children(file)}
+ ))
+ : null;
}
export type PromptInputActionAddAttachmentsProps = ComponentProps<
@@ -890,7 +859,7 @@ export const PromptInputHeader = ({
}: PromptInputHeaderProps) => (
);
diff --git a/packages/examples/src/chatbot.tsx b/packages/examples/src/chatbot.tsx
index 12593b4..6ed8c8b 100644
--- a/packages/examples/src/chatbot.tsx
+++ b/packages/examples/src/chatbot.tsx
@@ -24,7 +24,7 @@ import {
PromptInputAttachments,
PromptInputBody,
PromptInputButton,
- PromptInputFooter,
+ PromptInputHeader,
type PromptInputMessage,
PromptInputModelSelect,
PromptInputModelSelectContent,
@@ -162,14 +162,14 @@ React hooks are a powerful feature that let you use state and other React featur
\`\`\`jsx
function ProfilePage({ userId }) {
const [user, setUser] = useState(null);
-
+
useEffect(() => {
// This runs after render and when userId changes
fetchUser(userId).then(userData => {
setUser(userData);
});
}, [userId]);
-
+
return user ? : ;
}
\`\`\`
@@ -208,7 +208,7 @@ Would you like me to explain any specific hook in more detail?`,
from: "assistant",
reasoning: {
content: `The user is asking for a detailed explanation of useCallback and useMemo. I should provide a clear and concise explanation of each hook's purpose and how they differ.
-
+
The useCallback hook is used to memoize functions to prevent unnecessary re-renders of child components that receive functions as props.
The useMemo hook is used to memoize values to avoid expensive recalculations on every render.
@@ -485,10 +485,12 @@ const Example = () => {