From d1e23b7c71e6a0e1c7d920e147ec15a0dbbf689c Mon Sep 17 00:00:00 2001 From: jerop Date: Wed, 11 Jun 2025 04:46:39 +0000 Subject: refactor: Centralize session ID generation and propagation --- packages/core/src/utils/nextSpeakerChecker.test.ts | 1 + packages/core/src/utils/session.ts | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 packages/core/src/utils/session.ts (limited to 'packages/core/src/utils') diff --git a/packages/core/src/utils/nextSpeakerChecker.test.ts b/packages/core/src/utils/nextSpeakerChecker.test.ts index 2514c99d..a19045d1 100644 --- a/packages/core/src/utils/nextSpeakerChecker.test.ts +++ b/packages/core/src/utils/nextSpeakerChecker.test.ts @@ -71,6 +71,7 @@ describe('checkNextSpeaker', () => { chatInstance = new GeminiChat( mockModelsInstance, // This is the instance returned by mockGoogleGenAIInstance.getGenerativeModel 'gemini-pro', // model name + 'test-session-id', {}, [], // initial history ); diff --git a/packages/core/src/utils/session.ts b/packages/core/src/utils/session.ts new file mode 100644 index 00000000..57726019 --- /dev/null +++ b/packages/core/src/utils/session.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { randomUUID } from 'crypto'; + +export const sessionId = randomUUID(); -- cgit v1.2.3