@overmap-ai/core 1.0.53-add-agent-conversations.0 → 1.0.53-add-agent-conversations.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4460,8 +4460,11 @@ const agentsSlice = createSlice({
4460
4460
  initialState: initialState$1,
4461
4461
  extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
4462
4462
  reducers: {
4463
- setHistory: (state, action) => {
4464
- state.conversations = action.payload;
4463
+ setConversations: (state, action) => {
4464
+ state.conversations = {};
4465
+ for (const conversation of action.payload) {
4466
+ state.conversations[conversation.offline_id] = conversation;
4467
+ }
4465
4468
  },
4466
4469
  addConversation: (state, action) => {
4467
4470
  if (action.payload.offline_id in state.conversations) {
@@ -4470,11 +4473,14 @@ const agentsSlice = createSlice({
4470
4473
  state.conversations[action.payload.offline_id] = action.payload;
4471
4474
  },
4472
4475
  setConversation: (state, action) => {
4476
+ if (!(action.payload.offline_id in state.conversations)) {
4477
+ throw new Error("Conversation does not exist in history");
4478
+ }
4473
4479
  state.conversations[action.payload.offline_id] = action.payload;
4474
4480
  }
4475
4481
  }
4476
4482
  });
4477
- const { setHistory, addConversation, setConversation } = agentsSlice.actions;
4483
+ const { setConversations, addConversation, setConversation } = agentsSlice.actions;
4478
4484
  const selectConversationMapping = (state) => state.agentsReducer.conversations;
4479
4485
  const selectConversation = restructureCreateSelectorWithArgs(
4480
4486
  createSelector(
@@ -8531,15 +8537,17 @@ class AgentService extends BaseApiService {
8531
8537
  blocks: ["rate"]
8532
8538
  });
8533
8539
  }
8534
- async fetchAll() {
8535
- const activeProject = this.client.store.getState().projectReducer.activeProjectId;
8536
- return this.enqueueRequest({
8540
+ async refreshStore() {
8541
+ const { store } = this.client;
8542
+ const activeProject = store.getState().projectReducer.activeProjectId;
8543
+ const result = await this.enqueueRequest({
8537
8544
  description: "Get agent conversation history",
8538
8545
  method: HttpMethod.GET,
8539
8546
  url: `/projects/${activeProject}/agents-conversations/`,
8540
8547
  blockers: ["agent-conversations"],
8541
8548
  blocks: ["agent-conversations"]
8542
8549
  });
8550
+ store.dispatch(setConversations(result));
8543
8551
  }
8544
8552
  }
8545
8553
  class TeamService extends BaseApiService {
@@ -17079,6 +17087,7 @@ export {
17079
17087
  setComponentTypes,
17080
17088
  setComponents,
17081
17089
  setConversation,
17090
+ setConversations,
17082
17091
  setCreateProjectType,
17083
17092
  setCurrentUser,
17084
17093
  setDocumentAttachments,
@@ -17094,7 +17103,6 @@ export {
17094
17103
  setFormSubmissionAttachments,
17095
17104
  setFormSubmissions,
17096
17105
  setForms,
17097
- setHistory,
17098
17106
  setIsFetchingInitialData,
17099
17107
  setIsImportingProjectFile,
17100
17108
  setIsLoading,