From c6482b16f2222469878d341a8f138043eee42538 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Wed, 11 Dec 2024 01:15:02 +0700 Subject: [PATCH] chore: update Node.js version and refine launch configuration - Updated the Node.js version in .nvmrc from 22.6.0 to 24.0.0-nightly for compatibility with the latest features. - Modified the launch.json configuration to reflect the new Node.js runtime path, ensuring the development environment is aligned with the updated version. - Cleaned up whitespace in document.service.ts for improved code readability. These changes ensure the project is using the latest Node.js version and maintain a clean and efficient development setup. --- .nvmrc | 2 +- .vscode/launch.json | 3 ++- src/Document/document.service.ts | 9 ++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.nvmrc b/.nvmrc index 6ddfd1a..7b8e176 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.6.0 \ No newline at end of file +24.0.0-nightly202412106c03beba46 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 6e9d8b5..fae2a7d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "name": "Attach by Process ID", "processId": "${command:PickProcess}", @@ -15,7 +16,7 @@ "type": "node", "request": "launch", "name": "Launch Program", - "runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v22.6.0\\installation\\node.exe", + "runtimeExecutable": "C:\\Users\\AliensVN\\AppData\\Roaming\\fnm\\node-versions\\v24.0.0-nightly202412106c03beba46\\installation\\node.exe", "skipFiles": ["/**"], "cwd": "${workspaceFolder}", "program": "${file}", diff --git a/src/Document/document.service.ts b/src/Document/document.service.ts index 261dcdd..6bf7517 100644 --- a/src/Document/document.service.ts +++ b/src/Document/document.service.ts @@ -120,7 +120,7 @@ export class DocumentService { // Process the entire page text const grammarCheckResult = await this.openai.processText(pageText, 0, PromptType.CHECK_GRAMMAR) - + if (!grammarCheckResult.result) { return } @@ -132,11 +132,7 @@ export class DocumentService { const diff = await this.diff(pageText, grammarCheckResult.result) // Build payload - const payload: DocumentDelta = { - documentId, - pageIndex: pageId, - ops: diff.ops, - } + // Publish the result to the subscriber this.pubSub.publish(`${DocumentEvent.AI_SUGGESTION}.${documentId}.${pageId}`, payload) @@ -150,4 +146,3 @@ export class DocumentService { return diff } } -