chore: refine Next.js configuration and improve error handling
- Simplified the Next.js webpack configuration to apply raw-loader for markdown files universally. - Updated build script in package.json to ensure webpack is used during the build process. - Enhanced error logging across various hooks to provide clearer messages when exceptions occur, improving debugging capabilities.
This commit is contained in:
1 parent
655d9c1b45
commit
55749c07e3
12 files changed
+44
-37
No files matched your search
@@ -87,23 +87,18 @@ export function useAppUpdater(): AppUpdaterState {
|
||||
const update = await checkForUpdate();
|
||||
|
||||
if (update?.available) {
|
||||
// Escutar progresso do download
|
||||
const unlisten = await update.on('download-progress', (progress: any) => {
|
||||
setDownloadProgress(progress.progress || 0);
|
||||
});
|
||||
|
||||
// Baixar e instalar atualização
|
||||
// O progresso pode ser monitorado via eventos do Tauri se necessário
|
||||
await update.downloadAndInstall();
|
||||
|
||||
unlisten();
|
||||
|
||||
// Reiniciar aplicativo após instalação
|
||||
await update.installAndRestart();
|
||||
|
||||
// Após downloadAndInstall(), o app será reiniciado automaticamente
|
||||
// Não é necessário chamar installAndRestart() que não existe na API
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to install update:', err);
|
||||
setError(err instanceof Error ? err.message : 'Erro ao instalar atualização');
|
||||
setIsDownloading(false);
|
||||
setDownloadProgress(0);
|
||||
}
|
||||
}, [updateAvailable]);
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ export function useChatStorage() {
|
||||
const keywords = Array.isArray(msg.metadata.keywords)
|
||||
? msg.metadata.keywords
|
||||
: [];
|
||||
memoryContext.push(...keywords.filter(k => typeof k === 'string'));
|
||||
memoryContext.push(...keywords.filter((k: unknown) => typeof k === 'string'));
|
||||
}
|
||||
});
|
||||
const uniqueMemoryContext = Array.from(new Set(memoryContext));
|
||||
@@ -457,7 +457,7 @@ export function useChatStorage() {
|
||||
const keywords = Array.isArray(msg.metadata.keywords)
|
||||
? msg.metadata.keywords
|
||||
: [];
|
||||
memoryContext.push(...keywords.filter(k => typeof k === 'string'));
|
||||
memoryContext.push(...keywords.filter((k: unknown) => typeof k === 'string'));
|
||||
}
|
||||
});
|
||||
// Deduplicate
|
||||
|
||||
@@ -195,7 +195,7 @@ export function useDeepResearch() {
|
||||
setState(s => ({ ...s, context }));
|
||||
return context;
|
||||
} catch (error) {
|
||||
log.warn('Contextual analysis failed, continuing without context:', error);
|
||||
log.warn(`Contextual analysis failed, continuing without context: ${error instanceof Error ? error.message : String(error)}`);
|
||||
return null;
|
||||
}
|
||||
}, []);
|
||||
@@ -219,7 +219,7 @@ export function useDeepResearch() {
|
||||
setState(s => ({ ...s, enrichedQueries: enriched }));
|
||||
return enriched;
|
||||
} catch (error) {
|
||||
log.warn('Query enrichment failed, continuing without enrichment:', error);
|
||||
log.warn(`Query enrichment failed, continuing without enrichment: ${error instanceof Error ? error.message : String(error)}`);
|
||||
return null;
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -53,6 +53,8 @@ export function useOllamaDownload() {
|
||||
downloadError: null,
|
||||
filePath: null,
|
||||
isInstalled: false,
|
||||
isChecking: false,
|
||||
checkStatus: '',
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -66,6 +68,8 @@ export function useOllamaDownload() {
|
||||
downloadError: null,
|
||||
filePath: existingPath,
|
||||
isInstalled: false,
|
||||
isChecking: false,
|
||||
checkStatus: '',
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -79,6 +83,8 @@ export function useOllamaDownload() {
|
||||
downloadError: null,
|
||||
filePath,
|
||||
isInstalled: false,
|
||||
isChecking: false,
|
||||
checkStatus: '',
|
||||
});
|
||||
} catch (error) {
|
||||
setState({
|
||||
@@ -88,6 +94,8 @@ export function useOllamaDownload() {
|
||||
downloadError: error instanceof Error ? error.message : 'Erro desconhecido durante download',
|
||||
filePath: null,
|
||||
isInstalled: false,
|
||||
isChecking: false,
|
||||
checkStatus: '',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user