diff --git a/.github/workflows/build-nitro-node.yml b/.github/workflows/build-nitro-node.yml index cce5bc310..4fe80b692 100644 --- a/.github/workflows/build-nitro-node.yml +++ b/.github/workflows/build-nitro-node.yml @@ -1,8 +1,8 @@ name: Build nitro-node on: - #schedule: - # - cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7 + schedule: + - cron: "0 20 * * *" # At 0:20 UTC, which is 7:20 AM UTC+7 push: branches: - main diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cef349c9..c8b799187 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: CI on: schedule: - - cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7 + - cron: "0 20 * * *" # At 0:20 UTC, which is 7:20 AM UTC+7 push: branches: - main diff --git a/.github/workflows/test-install-nitro-node.yml b/.github/workflows/test-install-nitro-node.yml index de9abb29f..755551b82 100644 --- a/.github/workflows/test-install-nitro-node.yml +++ b/.github/workflows/test-install-nitro-node.yml @@ -1,8 +1,8 @@ name: Test install nitro-node on: - #schedule: - # - cron: "0 20 * * *" # At 8 PM UTC, which is 3 AM UTC+7 + schedule: + - cron: "0 20 * * *" # At 0:20 UTC, which is 7:20 AM UTC+7 push: branches: - main diff --git a/nitro-node/test/nitro-process.test.ts b/nitro-node/test/nitro-process.test.ts index cd2740c23..bd231db5c 100644 --- a/nitro-node/test/nitro-process.test.ts +++ b/nitro-node/test/nitro-process.test.ts @@ -178,6 +178,7 @@ describe("Manage nitro process", () => { await validateModelStatus(); // Arrays of all the chunked response let streamedContent: Record[] = []; + let chunkCounter = 0; // Run chat completion with stream const response = await chatCompletion( { @@ -208,7 +209,14 @@ describe("Manage nitro process", () => { if (data.match(/\[DONE\]/)) { return; } - streamedContent.push(JSON.parse(data)); + chunkCounter++; + try { + // Parse the streamed content + streamedContent.push(JSON.parse(data)); + } catch (e) { + // Skip invalid json data + console.error(e, data); + } }, //close() {}, //abort(_err) {} @@ -227,8 +235,8 @@ describe("Manage nitro process", () => { await expect(response.json).rejects.toThrow(); // Response body should be used already expect(response.bodyUsed).toBeTruthy(); - // There should be multiple chunks of json data - expect(streamedContent.length).toBeGreaterThan(0); + // There should be no invalid chunk of json data + expect(streamedContent.length).toEqual(chunkCounter); // Stop nitro await stopModel(); },