come on mannnnnn

This commit is contained in:
YasinOnm08 2024-10-08 15:33:21 +02:00
parent 1f12a1d708
commit 9350a41197
4 changed files with 104 additions and 39 deletions

View file

@ -2,6 +2,7 @@ import React, { ForwardedRef, useState, useEffect, useRef } from 'react';
import Markdown from 'react-markdown'
import rehypeRaw from 'rehype-raw';
import remarkGfm from 'remark-gfm';
import { useChatHistory } from '../hooks/useChatHistory';
type Message = {
role: string
@ -21,6 +22,7 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
({ messages, onStopClick, onResendClick, onEditClick, onCopyClick, isClicked }, ref: ForwardedRef<HTMLDivElement>) => {
const [isScrolling, setIsScrolling] = useState(true);
const messagesEndRef = useRef<HTMLDivElement | null>(null);
const [chatHistory, setChatHistory, setSelectedIndex] = useChatHistory()
useEffect(() => {
const observer = new IntersectionObserver(
@ -61,7 +63,7 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
return (
<div className="output" ref={ref}>
<div className="conversation resize" id="conversation">
{messages.map((message, index) => {
{chatHistory.chats[chatHistory.selectedIndex].messages.map((message, index) => {
if (index >= 1) {
return (