feat: enhance chat functionality with markdown support and default prompts

- Added support for rendering markdown in chat messages using ReactMarkdown with custom renderers.
- Integrated a default format prompt for the chat system, improving user experience by initializing with a predefined prompt.
- Updated the prompt generator to handle model selection more robustly, including loading states and fallback options for model selection.
- Enhanced UI components for better accessibility and user feedback during prompt generation.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-19 00:34:57 -03:00
1 parent b2a06ed994
commit 032722e21b
11 files changed
+1167 -24

No files matched your search

+4 -1
View File
@@ -15,6 +15,8 @@ import { useLocalModels } from "@/hooks/use-local-models";
import { useState, useEffect, useRef } from "react";
import { useTheme } from "next-themes";
import { ImperativePanelHandle } from "react-resizable-panels";
// @ts-ignore
import defaultFormatPrompt from "@/data/prompts/default-format.md";
export default function ChatPage() {
const { messages, sendMessage, isLoading, stop } = useChat();
@@ -22,7 +24,8 @@ export default function ChatPage() {
const { theme, setTheme } = useTheme();
const [selectedModel, setSelectedModel] = useState("");
const [systemPrompt, setSystemPrompt] = useState("Você é um assistente útil e prestativo.");
// Initialize with default format prompt
const [systemPrompt, setSystemPrompt] = useState(defaultFormatPrompt || "Você é um assistente útil e prestativo.");
const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false);
const sidebarRef = useRef<ImperativePanelHandle>(null);