Skip to content

Commit

Permalink
Fixed the state reassignment (#2899)
Browse files Browse the repository at this point in the history
Co-authored-by: Shakker Nerd <[email protected]>
  • Loading branch information
AIFlowML and shakkernerd authored Jan 28, 2025
1 parent b81a5d4 commit 4831125
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/plugin-open-weather/src/actions/getCurrentWeather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down

0 comments on commit 4831125

Please sign in to comment.