feat: enhance chat and settings functionality with debugging and new features

- Integrated useRouter for navigation in chat and settings pages, improving user experience.
- Added detailed debug logging for web context generation and chat payloads to assist in troubleshooting.
- Updated settings page to include a hardware dashboard and enhanced sources configuration management.
- Implemented auto-start feature for the application and improved task management with new scheduled task options.
- Refined user interface components for better accessibility and usability across chat and settings pages.
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-20 05:25:34 -03:00
1 parent 8834ef2b4f
commit a44d1bba44
18 files changed
+1692 -223

No files matched your search

+21
View File
@@ -264,6 +264,27 @@ export function useChat() {
content: m.content // Send only content, not metadata (unless we want to inject it back)
}));
// [DEBUG INJECTION START]
const systemMsg = apiMessages.find(m => m.role === 'system');
console.group('📦 Debug: Ollama Payload');
console.log('1. Total Messages:', apiMessages.length);
console.log('2. Has System Message?', !!systemMsg);
if (systemMsg) {
console.log('3. System Message Length:', systemMsg.content.length);
console.log('4. System Content Preview:', systemMsg.content.substring(0, 300) + '...');
console.log('5. Web Context Present in Payload?', systemMsg.content.includes('CONTEXTO WEB RECUPERADO'));
if (systemMsg.content.includes('CONTEXTO WEB RECUPERADO')) {
const contextStart = systemMsg.content.indexOf('CONTEXTO WEB RECUPERADO');
console.log('6. Web Context Position in Payload:', contextStart);
console.log('7. Web Context Preview in Payload:', systemMsg.content.substring(contextStart, contextStart + 200) + '...');
}
} else {
console.error('❌ CRITICAL: System Message is MISSING in payload!');
console.log('Available roles:', apiMessages.map(m => m.role));
}
console.groupEnd();
// [DEBUG INJECTION END]
abortControllerRef.current = new AbortController();
try {
+16
View File
@@ -83,6 +83,22 @@ export function useWebSearch() {
const results = await webSearchService.search(query, limit, excludedDomains, searchConfig);
// [DEBUG INJECTION START]
console.log('🌐 Debug: Web Search Service Results', {
count: results.length,
firstResultHasMarkdown: results[0] ? !!results[0].markdown : 'N/A',
firstResultMarkdownLen: results[0]?.markdown?.length || 0,
allResults: results.map((r, idx) => ({
index: idx,
url: r.url,
title: r.title,
hasMarkdown: !!r.markdown,
markdownLength: r.markdown?.length || 0,
markdownPreview: r.markdown?.substring(0, 150) || 'SEM MARKDOWN'
}))
});
// [DEBUG INJECTION END]
setState(prev => ({
...prev,
status: 'completed',