Revert "Push route state on generation finish" (#494)
This commit is contained in:
parent
5bf585e9c5
commit
d782400cfa
2 changed files with 5 additions and 5 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
import { Attachment, Message } from 'ai';
|
import { Attachment, Message } from 'ai';
|
||||||
import { useChat } from 'ai/react';
|
import { useChat } from 'ai/react';
|
||||||
import { AnimatePresence } from 'framer-motion';
|
import { AnimatePresence } from 'framer-motion';
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import useSWR, { useSWRConfig } from 'swr';
|
import useSWR, { useSWRConfig } from 'swr';
|
||||||
import { useWindowSize } from 'usehooks-ts';
|
import { useWindowSize } from 'usehooks-ts';
|
||||||
|
|
@ -28,7 +27,6 @@ export function Chat({
|
||||||
initialMessages: Array<Message>;
|
initialMessages: Array<Message>;
|
||||||
selectedModelId: string;
|
selectedModelId: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
|
||||||
const { mutate } = useSWRConfig();
|
const { mutate } = useSWRConfig();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -46,7 +44,6 @@ export function Chat({
|
||||||
initialMessages,
|
initialMessages,
|
||||||
onFinish: () => {
|
onFinish: () => {
|
||||||
mutate('/api/history');
|
mutate('/api/history');
|
||||||
router.push(`/chat/${id}`);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import { Message } from 'ai';
|
import { Message } from 'ai';
|
||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
|
import { motion } from 'framer-motion';
|
||||||
import { Sparkles } from 'lucide-react';
|
import { Sparkles } from 'lucide-react';
|
||||||
import { Dispatch, SetStateAction } from 'react';
|
import { Dispatch, SetStateAction } from 'react';
|
||||||
|
|
||||||
|
|
@ -30,8 +31,10 @@ export const PreviewMessage = ({
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<motion.div
|
||||||
className="w-full mx-auto max-w-3xl px-4 group/message "
|
className="w-full mx-auto max-w-3xl px-4 group/message "
|
||||||
|
initial={{ y: 5, opacity: 0 }}
|
||||||
|
animate={{ y: 0, opacity: 1 }}
|
||||||
data-role={message.role}
|
data-role={message.role}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
@ -142,6 +145,6 @@ export const PreviewMessage = ({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue