Compare commits

...

5 Commits

Author SHA1 Message Date
wellCh4n
2b73b3a28f Merge 8aaee2c40c into 64d2a467b0 2025-03-19 13:03:32 +08:00
ItzCrazyKns
64d2a467b0 Merge pull request #672 from sjiampojamarn/scrolling
Only set scrollIntoView for user msg.
2025-03-17 12:03:05 +05:30
sjiampojamarn
9a2c4fe3b6 Only set scrollIntoView for user msg. 2025-03-16 22:15:58 -07:00
ItzCrazyKns
060c68a900 feat(message-box): lint & beautify 2025-03-14 22:05:07 +05:30
wellCh4n
8aaee2c40c feat(app): support complex title 2025-02-15 16:48:21 +08:00
3 changed files with 15 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ export const getDocumentsFromLinks = async ({ links }: { links: string[] }) => {
const splittedText = await splitter.splitText(parsedText); const splittedText = await splitter.splitText(parsedText);
const title = res.data const title = res.data
.toString('utf8') .toString('utf8')
.match(/<title>(.*?)<\/title>/)?.[1]; .match(/<title.*>(.*?)<\/title>/)?.[1];
const linkDocs = splittedText.map((text) => { const linkDocs = splittedText.map((text) => {
return new Document({ return new Document({

View File

@@ -48,11 +48,17 @@ const Chat = ({
}); });
useEffect(() => { useEffect(() => {
messageEnd.current?.scrollIntoView({ behavior: 'smooth' }); const scroll = () => {
messageEnd.current?.scrollIntoView({ behavior: 'smooth' });
};
if (messages.length === 1) { if (messages.length === 1) {
document.title = `${messages[0].content.substring(0, 30)} - Perplexica`; document.title = `${messages[0].content.substring(0, 30)} - Perplexica`;
} }
if (messages[messages.length - 1]?.role == 'user') {
scroll();
}
}, [messages]); }, [messages]);
return ( return (

View File

@@ -68,7 +68,13 @@ const MessageBox = ({
return ( return (
<div> <div>
{message.role === 'user' && ( {message.role === 'user' && (
<div className={cn('w-full', messageIndex === 0 ? 'pt-16' : 'pt-8', 'break-words')}> <div
className={cn(
'w-full',
messageIndex === 0 ? 'pt-16' : 'pt-8',
'break-words',
)}
>
<h2 className="text-black dark:text-white font-medium text-3xl lg:w-9/12"> <h2 className="text-black dark:text-white font-medium text-3xl lg:w-9/12">
{message.content} {message.content}
</h2> </h2>