Fixed commented out programs

This commit is contained in:
PawelC4
2025-11-09 00:37:24 -05:00
parent 972df9b70b
commit 44b5a4dc49
17 changed files with 1558 additions and 1257 deletions
+24 -24
View File
@@ -1,30 +1,30 @@
"use client";
import { useRef, useEffect } from "react";
import { ChatHistory } from "@/app/exportType/types";
import {User, Bot} from "lucide-react"
import { User, Bot } from "lucide-react"
interface MessageWindowProps{
history :ChatHistory
interface MessageWindowProps {
history: ChatHistory
}
export default function MessageWindow({history}:MessageWindowProps){
export default function MessageWindow({ history }: MessageWindowProps) {
const messageEndRef = useRef<HTMLDivElement>(null);
useEffect(() =>{
messageEndRef.current?.scrollIntoView({behavior:"smooth"});
useEffect(() => {
messageEndRef.current?.scrollIntoView({ behavior: "smooth" });
}, [history]);
return(
return (
<div className="flex-1 p-3 overflow-y-auto">
<div className="max-w-3xl mx-auto">
{history.map((msg,index)=>{
{history.map((msg, index) => {
const isUser = msg.role === "user"
return (
<div
key={index}
className={`flex ${isUser ? "justify-end" : "justify-start"}`}>
{!isUser &&(
<div
key={index}
className={`flex ${isUser ? "justify-end" : "justify-start"}`}>
{!isUser && (
<div className="mr-2">
<div className="flex items-center justify-center w-8 h-8 rounded-full bg-gray">
<Bot size={15} className="text-gray-700">
@@ -41,20 +41,20 @@ export default function MessageWindow({history}:MessageWindowProps){
<span key={idx}>{part.text}</span>))}
</div>
</div>
{isUser && (
<div className="ml-2">
<div className="flex items-center justify-center w-8 h-8 rounded-full bg-purple-500">
<User size={16} className="text-white" />
{isUser && (
<div className="ml-2">
<div className="flex items-center justify-center w-8 h-8 rounded-full bg-purple-500">
<User size={16} className="text-white" />
</div>
</div>
</div>
)}
)}
</div>
);
})}
{/* Invisible element to help scroll to bottom */}
<div ref={messageEndRef} />
);
})}
{/* Invisible element to help scroll to bottom */}
<div ref={messageEndRef} />
</div>
</div>
</div>
);
}