- Added new Radix UI components including checkbox, label, popover, slider, switch, and tooltip to improve UI interactions. - Integrated react-syntax-highlighter for better code rendering in chat messages. - Updated package.json and pnpm-lock.yaml to include new dependencies and ensure compatibility. - Enhanced chat input to support web search toggling, improving user experience during message composition. - Implemented auto-saving of chat sessions and improved session management features. - Refactored chat message rendering to clean up metadata and improve display quality.
28 lines
676 B
TypeScript
28 lines
676 B
TypeScript
'use client';
|
|
|
|
import { useState, useCallback } from 'react';
|
|
|
|
interface Toast {
|
|
title: string;
|
|
description?: string;
|
|
variant?: 'default' | 'destructive';
|
|
}
|
|
|
|
export function useToast() {
|
|
const showToast = useCallback(({ title, description, variant }: Toast) => {
|
|
// Simple implementation using console and alert for now
|
|
// Can be enhanced later with a proper toast component
|
|
if (variant === 'destructive') {
|
|
console.error(`[Toast] ${title}: ${description || ''}`);
|
|
alert(`Erro: ${title}\n${description || ''}`);
|
|
} else {
|
|
console.log(`[Toast] ${title}: ${description || ''}`);
|
|
}
|
|
}, []);
|
|
|
|
return {
|
|
toast: showToast,
|
|
};
|
|
}
|
|
|