Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

fix: harden Windows startup blank screen

nash_su216f096765cd
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 1791039c..740399ba 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -181,6 +181,10 @@ pub fn run() {
app.manage(commands::codex_cli::CodexCliState::default());
app.manage(commands::file_sync::FileSyncState::default());
app.manage(CloseBehaviorState(Mutex::new("minimize".to_string())));
+ app.manage(TrayAvailabilityState(Mutex::new(false)));
+ // Start the API before optional desktop integrations so the
+ // backend is reachable if tray setup or another integration fails.
+ api_server::start_api_server(app.handle().clone());
let tray_available = match tray::create_tray(app.handle()) {
Ok(()) => true,
Err(err) => {
@@ -188,8 +192,14 @@ pub fn run() {
false
}
};
- app.manage(TrayAvailabilityState(Mutex::new(tray_available)));
- api_server::start_api_server(app.handle().clone());
+ match app.state::<TrayAvailabilityState>().0.lock() {
+ Ok(mut state) => {
+ *state = tray_available;
+ }
+ Err(err) => {
+ eprintln!("[tray] failed to update tray availability state: {err}");
+ }
+ }
Ok(())
})
.invoke_handler(tauri::generate_handler![
diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json
index 7746574b..a5ac7d0a 100644
--- a/src-tauri/tauri.windows.conf.json
+++ b/src-tauri/tauri.windows.conf.json
@@ -1,4 +1,13 @@
{
+ "app": {
+ "windows": [
+ {
+ "label": "main",
+ "hiddenTitle": false,
+ "titleBarStyle": "Visible"
+ }
+ ]
+ },
"bundle": {
"resources": ["pdfium/pdfium.dll"]
}
diff --git a/src/main.tsx b/src/main.tsx
index c68671ac..9425bcf6 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -14,15 +14,36 @@ function applyPlatformClass() {
// Apply theme before render to avoid flash
async function initApp() {
- applyPlatformClass();
- await loadAndApplyTheme();
- watchSystemTheme();
+ try {
+ applyPlatformClass();
+ await loadAndApplyTheme();
+ watchSystemTheme();
- ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
- <React.StrictMode>
- <App />
- </React.StrictMode>
- );
+ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
+ <React.StrictMode>
+ <App />
+ </React.StrictMode>
+ );
+ } catch (err) {
+ console.error("[startup] failed to initialize LLM Wiki:", err);
+ const root = document.getElementById("root");
+ if (root) {
+ const message = err instanceof Error ? (err.stack ?? err.message) : String(err);
+ root.innerHTML = `
+ <div style="font-family: system-ui, sans-serif; padding: 24px; color: #111; color: light-dark(#111, #f5f5f5); background: #fff; background: light-dark(#fff, #111); min-height: 100vh; color-scheme: light dark;">
+ <h1 style="font-size: 18px; margin: 0 0 12px;">LLM Wiki failed to start</h1>
+ <p style="margin: 0 0 12px;">The frontend startup code threw an error before React could render.</p>
+ <pre style="white-space: pre-wrap; border: 1px solid light-dark(#ddd, #333); border-radius: 8px; padding: 12px; background: light-dark(#f7f7f7, #1d1d1d);">${message.replace(/[&<>"']/g, (ch) => ({
+ "&": "&amp;",
+ "<": "&lt;",
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&#39;",
+ }[ch] ?? ch))}</pre>
+ </div>
+ `;
+ }
+ }
}
initApp();