Changes
This commit is contained in:
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { useSettings } from '@/contexts/SettingsContext';
|
||||
import { useAchievements, incrementAiMessageCount } from '@/contexts/AchievementsContext';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import GlitchText from '@/components/GlitchText';
|
||||
import MessageContent from '@/components/MessageContent';
|
||||
@@ -79,6 +80,7 @@ const AIChat = () => {
|
||||
const [tempCustomConfig, setTempCustomConfig] = useState<CustomApiConfig>({ endpoint: '', apiKey: '', model: '' });
|
||||
const scrollRef = useRef<HTMLDivElement>(null);
|
||||
const { playSound } = useSettings();
|
||||
const { checkAiAchievements } = useAchievements();
|
||||
const { toast } = useToast();
|
||||
|
||||
// Persist messages to localStorage
|
||||
@@ -134,6 +136,10 @@ const AIChat = () => {
|
||||
setInput('');
|
||||
setIsLoading(true);
|
||||
playSound('click');
|
||||
|
||||
// Track AI message count for achievements
|
||||
incrementAiMessageCount();
|
||||
checkAiAchievements();
|
||||
|
||||
try {
|
||||
// Build chat history, filtering out empty messages, system notices, and ensuring proper alternation
|
||||
|
||||
Reference in New Issue
Block a user