diff --git a/ts/packages/shell/src/main/index.ts b/ts/packages/shell/src/main/index.ts index 1eb0bd41a..4cc2db736 100644 --- a/ts/packages/shell/src/main/index.ts +++ b/ts/packages/shell/src/main/index.ts @@ -60,7 +60,10 @@ process.argv.forEach((arg) => { }); export function runningTests(): boolean { - return process.env["INSTANCE_NAME"] !== undefined && process.env["INSTANCE_NAME"].startsWith("test_") === true; + return ( + process.env["INSTANCE_NAME"] !== undefined && + process.env["INSTANCE_NAME"].startsWith("test_") === true + ); } let mainWindow: BrowserWindow | null = null; @@ -619,11 +622,20 @@ async function initialize() { ShellSettings.getinstance().onSettingsChanged!(); // Load chat history if enabled - const chatHistory: string = path.join(getInstanceDir(), "chat_history.html") - if (ShellSettings.getinstance().chatHistory && existsSync(chatHistory)) { + const chatHistory: string = path.join( + getInstanceDir(), + "chat_history.html", + ); + if ( + ShellSettings.getinstance().chatHistory && + existsSync(chatHistory) + ) { chatView?.webContents.send( "chat-history", - readFileSync(path.join(getInstanceDir(), "chat_history.html"), "utf-8"), + readFileSync( + path.join(getInstanceDir(), "chat_history.html"), + "utf-8", + ), ); } @@ -640,19 +652,16 @@ async function initialize() { // send the agent greeting if it's turned on if (ShellSettings.getinstance().agentGreeting) { dispatcher.processCommand("@greeting", "agent-0", []); - } + } }); // Store the chat history whenever the DOM changes // this let's us rehydrate the chat when reopening the shell - ipcMain.on("dom changed", async(_event, html) => { + ipcMain.on("dom changed", async (_event, html) => { // store the modified DOM contents const file: string = path.join(getInstanceDir(), "chat_history.html"); - debugShell( - `Saving chat history to '${file}'.`, - performance.now(), - ); + debugShell(`Saving chat history to '${file}'.`, performance.now()); try { writeFileSync(file, html); @@ -660,7 +669,7 @@ async function initialize() { debugShell( `Unable to save history to '${file}'. Error: ${e}`, performance.now(), - ); + ); } }); @@ -710,8 +719,7 @@ async function initialize() { // On windows, we will spin up a local end point that listens // for pen events which will trigger speech reco // Don't spin this up during testing - if ( - process.platform == "win32" && !runningTests()) { + if (process.platform == "win32" && !runningTests()) { const pipePath = path.join("\\\\.\\pipe\\TypeAgent", "speech"); const server = net.createServer((stream) => { stream.on("data", (c) => { diff --git a/ts/packages/shell/src/main/shellSettingsType.ts b/ts/packages/shell/src/main/shellSettingsType.ts index 43bdd93e7..4b48c9a8d 100644 --- a/ts/packages/shell/src/main/shellSettingsType.ts +++ b/ts/packages/shell/src/main/shellSettingsType.ts @@ -39,5 +39,5 @@ export const defaultSettings: ShellSettingsType = { partialCompletion: true, disallowedDisplayType: [], darkMode: false, - chatHistory: true + chatHistory: true, }; diff --git a/ts/packages/shell/src/preload/electronTypes.ts b/ts/packages/shell/src/preload/electronTypes.ts index 45fdffc57..a3c731714 100644 --- a/ts/packages/shell/src/preload/electronTypes.ts +++ b/ts/packages/shell/src/preload/electronTypes.ts @@ -72,7 +72,9 @@ export interface ClientAPI { settings: ShellSettings, ) => void, ): void; - onChatHistory(callback: (e: Electron.IpcRendererEvent, chatHistory: string) => void): void; + onChatHistory( + callback: (e: Electron.IpcRendererEvent, chatHistory: string) => void, + ): void; registerClientIO(clientIO: ClientIO); } diff --git a/ts/packages/shell/src/renderer/assets/styles.less b/ts/packages/shell/src/renderer/assets/styles.less index 6c5277423..bbd6ef395 100644 --- a/ts/packages/shell/src/renderer/assets/styles.less +++ b/ts/packages/shell/src/renderer/assets/styles.less @@ -88,7 +88,7 @@ body { } .chat-separator-text { - margin: 0px 10px; + margin: 0px 10px; color: darkgray; height: 20px; } diff --git a/ts/packages/shell/src/renderer/src/main.ts b/ts/packages/shell/src/renderer/src/main.ts index 05f634c81..46780370b 100644 --- a/ts/packages/shell/src/renderer/src/main.ts +++ b/ts/packages/shell/src/renderer/src/main.ts @@ -276,20 +276,28 @@ function addEvents( // add the separator if (history.length > 0) { - // don't add a separator if there's already one there - if (!chatView.getScollContainer().children[0].classList.contains("chat-separator")) { - let separator: HTMLDivElement = document.createElement("div"); + if ( + !chatView + .getScollContainer() + .children[0].classList.contains("chat-separator") + ) { + let separator: HTMLDivElement = + document.createElement("div"); separator.classList.add("chat-separator"); - separator.innerHTML = "