From c96244ee69f90a81890f00bc36879d50cd3c036a Mon Sep 17 00:00:00 2001 From: AIFlow_ML Date: Tue, 28 Jan 2025 16:26:56 +0700 Subject: [PATCH] Fixed the state reassignment --- .../plugin-open-weather/src/actions/getCurrentWeather.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/plugin-open-weather/src/actions/getCurrentWeather.ts b/packages/plugin-open-weather/src/actions/getCurrentWeather.ts index f2921a1c315..4253ce76588 100644 --- a/packages/plugin-open-weather/src/actions/getCurrentWeather.ts +++ b/packages/plugin-open-weather/src/actions/getCurrentWeather.ts @@ -40,14 +40,15 @@ export const getCurrentWeatherAction: Action = { callback: HandlerCallback ) => { // Initialize/update state - if (!state) { - state = (await runtime.composeState(message)) as State; + let currentState: State = state; + if (!currentState) { + currentState = (await runtime.composeState(message)) as State; } - state = await runtime.updateRecentMessageState(state); + currentState = await runtime.updateRecentMessageState(currentState); // state -> context const weatherContext = composeContext({ - state, + state: currentState, template: getCurrentWeatherTemplate, });