mirror of
https://github.com/PinkSheep27/SBU-Hackathon.git
synced 2026-10-11 00:30:26 -04:00
added a exit button on the chat bot and make sure it still working
This commit is contained in:
@@ -4,11 +4,12 @@ import { ChatHistory } from "@/app/exportType/types";
|
||||
import {User, Bot} from "lucide-react"
|
||||
|
||||
interface MessageWindowProps{
|
||||
history :ChatHistory
|
||||
history :ChatHistory;
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export default function MessageWindow({history}:MessageWindowProps){
|
||||
const messageEndRef = useRef<HTMLDivElement>(null);
|
||||
export default function MessageWindow({history, isLoading}:MessageWindowProps){
|
||||
const messageEndRef = useRef<HTMLDivVElement>(null);
|
||||
|
||||
useEffect(() =>{
|
||||
messageEndRef.current?.scrollIntoView({behavior:"smooth"});
|
||||
@@ -52,6 +53,20 @@ export default function MessageWindow({history}:MessageWindowProps){
|
||||
);
|
||||
})}
|
||||
|
||||
{isLoading && (
|
||||
<div className="flex justify-start">
|
||||
<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" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 py-2 shadow-sm rounded-lg bg-white text-gray-800 rounded-bl-none max-w-xs sm:max-w-md">
|
||||
<div className="whitespace-pre-wrap break-words">
|
||||
<span>Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{/* Invisible element to help scroll to bottom */}
|
||||
<div ref={messageEndRef} />
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function chatToGemini(
|
||||
):Promise<string>{
|
||||
const model = genAI.getGenerativeModel({
|
||||
model:settings.model || "gemini-2.5-flash",
|
||||
systemInstruction: settings.sysTemInstructions || "you are going to create a project idea, explain it in summery first before going to detail",
|
||||
systemInstruction: settings.systemInstruction || "you are going to create a project idea, explain it in summery first before going to detail",
|
||||
});
|
||||
|
||||
const generationConfig:GenerateConfig = {
|
||||
|
||||
Reference in New Issue
Block a user