Skip to content

Commit

Permalink
Clear chat API ID when clearing Assistant convo
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekelund committed Feb 18, 2025
1 parent 9e369b5 commit 8bceb5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/content-tab-assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export function ContentTabAssistant( { selectedSite }: ContentTabAssistantProps
const clearConversation = () => {
dispatch( chatActions.setChatInput( { siteId: selectedSite.id, input: '' } ) );
dispatch( chatActions.setMessages( { instanceId, messages: [] } ) );
dispatch( chatActions.setChatApiId( { instanceId, chatApiId: undefined } ) );
};

// We should render only one notice at a time in the bottom area
Expand Down
7 changes: 7 additions & 0 deletions src/stores/chat-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ const chatSlice = createSlice( {
state.themeName = action.payload.name;
state.isBlockTheme = action.payload.isBlockTheme;
},
setChatApiId: (
state,
action: PayloadAction< { instanceId: string; chatApiId: number | undefined } >
) => {
const { instanceId, chatApiId } = action.payload;
state.chatApiIdDict[ instanceId ] = chatApiId;
},
setMessages: (
state,
action: PayloadAction< { instanceId: string; messages: Message[] } >
Expand Down

0 comments on commit 8bceb5e

Please sign in to comment.