Merge branch 'main' into main

This commit is contained in:
sageTheDm 2024-10-08 16:09:51 +02:00
commit 588cc98db5
8 changed files with 202 additions and 121 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(
@ -58,7 +60,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 (
<div