refactor: update chat input handling, prune unused settings menu items, and enable turbopack configuration

This commit is contained in:
poyrazavsever
2026-06-06 22:06:49 +03:00
parent 4a52deec4d
commit 44f4423082
4 changed files with 14 additions and 9 deletions
+8 -1
View File
@@ -5,6 +5,7 @@ import { Brain, Send, MessageSquare, Plus, Trash2, Loader2, Wrench } from "lucid
import { createClient } from "@/lib/supabase/client";
import { Button } from "poyraz-ui/atoms";
import { useChat } from "@ai-sdk/react";
import toast from "react-hot-toast";
interface ChatSession {
id: string;
@@ -18,16 +19,22 @@ export default function AIChatPage() {
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
const messagesEndRef = useRef<HTMLDivElement>(null);
const { messages, input, setInput, handleInputChange, handleSubmit, append, setMessages, isLoading, stop } = useChat({
const [input, setInput] = useState("");
const { messages, append, setMessages, isLoading, stop } = useChat({
api: "/api/chat",
body: {
sessionId: activeSessionId
},
onError: (err) => {
console.error(err);
toast.error(err.message || "Yapay zeka ile iletişim kurulurken bir hata oluştu.");
}
});
const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setInput(e.target.value);
};
// Auto-scroll to bottom
const scrollToBottom = () => {
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });