From 3a27782916135b0454cd6d037413880329268d68 Mon Sep 17 00:00:00 2001 From: Simon Farshid Date: Wed, 18 Sep 2024 11:37:13 -0700 Subject: [PATCH] fix: only deprecate the null usage of switchToThread (#854) --- packages/react/src/context/stores/AssistantActions.tsx | 4 +++- packages/react/src/runtimes/core/AssistantRuntime.tsx | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react/src/context/stores/AssistantActions.tsx b/packages/react/src/context/stores/AssistantActions.tsx index 7774ca36ff..bd1fd43491 100644 --- a/packages/react/src/context/stores/AssistantActions.tsx +++ b/packages/react/src/context/stores/AssistantActions.tsx @@ -7,7 +7,9 @@ export type AssistantActionsState = Readonly<{ /** * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0. */ - switchToThread: (threadId: string | null) => void; + switchToThread(threadId: null): void; + switchToThread(threadId: string): void; + switchToNewThread: () => void; registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe; }>; diff --git a/packages/react/src/runtimes/core/AssistantRuntime.tsx b/packages/react/src/runtimes/core/AssistantRuntime.tsx index ace2e7012a..a2b158fd54 100644 --- a/packages/react/src/runtimes/core/AssistantRuntime.tsx +++ b/packages/react/src/runtimes/core/AssistantRuntime.tsx @@ -12,6 +12,7 @@ export type AssistantRuntime = ThreadRuntimeWithSubscribe & { /** * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0. */ - switchToThread: (threadId: string | null) => void; + switchToThread(threadId: null): void; + switchToThread(threadId: string): void; registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe; };