diff --git a/src/interface/desktop/chat.html b/src/interface/desktop/chat.html index f37ae562..0a19fe3d 100644 --- a/src/interface/desktop/chat.html +++ b/src/interface/desktop/chat.html @@ -638,6 +638,7 @@ const khojToken = await window.tokenAPI.getToken(); const headers = { 'Authorization': `Bearer ${khojToken}` }; + let firstRunSetupMessageRendered = false; let chatBody = document.getElementById("chat-body"); chatBody.innerHTML = ""; let chatHistoryUrl = `/api/chat/history?client=desktop`; @@ -650,19 +651,8 @@ .then(data => { if (data.detail) { // If the server returns a 500 error with detail, render a setup hint. - first_run_message = `Hi 👋🏾, to get started: -
    -
  1. Generate an API token in the Khoj Web settings
  2. -
  3. Paste it into the API Key field in the Khoj Desktop settings
  4. -
` - .trim() - .replace(/(\r\n|\n|\r)/gm, ""); - - renderMessage(first_run_message, "khoj", null, null, true); - - // Disable chat input field and update placeholder text - document.getElementById("chat-input").setAttribute("disabled", "disabled"); - document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat"); + renderFirstRunSetupMessage(); + firstRunSetupMessageRendered = true; } else if (data.status != "ok") { throw new Error(data.message); } else { @@ -697,19 +687,8 @@ }) .catch(err => { // If the server returns a 500 error with detail, render a setup hint. - first_run_message = `Hi 👋🏾, to get started: -
    -
  1. Generate an API token in the Khoj Web settings
  2. -
  3. Paste it into the API Key field in the Khoj Desktop settings
  4. -
` - .trim() - .replace(/(\r\n|\n|\r)/gm, ""); - - renderMessage(first_run_message, "khoj", null, null, true); - - // Disable chat input field and update placeholder text - document.getElementById("chat-input").setAttribute("disabled", "disabled"); - document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat"); + if (!firstRunSetupMessageRendered) + renderFirstRunSetupMessage(); return; }); @@ -760,6 +739,22 @@ } } + function renderFirstRunSetupMessage() { + first_run_message = `Hi 👋🏾, to get started: +
    +
  1. Generate an API token in the Khoj Web settings
  2. +
  3. Paste it into the API Key field in the Khoj Desktop settings
  4. +
` + .trim() + .replace(/(\r\n|\n|\r)/gm, ""); + + renderMessage(first_run_message, "khoj", null, null, true); + + // Disable chat input field and update placeholder text + document.getElementById("chat-input").setAttribute("disabled", "disabled"); + document.getElementById("chat-input").setAttribute("placeholder", "Configure Khoj to enable chat"); + } + function flashStatusInChatInput(message) { // Get chat input element and original placeholder let chatInput = document.getElementById("chat-input"); diff --git a/src/interface/desktop/main.js b/src/interface/desktop/main.js index 2a4168aa..ec631384 100644 --- a/src/interface/desktop/main.js +++ b/src/interface/desktop/main.js @@ -472,7 +472,8 @@ app.whenReady().then(() => { }); ipcMain.handle('deleteAllFiles', deleteAllFiles); - createWindow() + createWindow(); + app.setAboutPanelOptions({ applicationName: "Khoj",