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

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.
@@ -4450,8 +4450,11 @@ var __publicField = (obj, key, value) => {
4450
4450
  initialState: initialState$1,
4451
4451
  extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
4452
4452
  reducers: {
4453
- setHistory: (state, action) => {
4454
- state.conversations = action.payload;
4453
+ setConversations: (state, action) => {
4454
+ state.conversations = {};
4455
+ for (const conversation of action.payload) {
4456
+ state.conversations[conversation.offline_id] = conversation;
4457
+ }
4455
4458
  },
4456
4459
  addConversation: (state, action) => {
4457
4460
  if (action.payload.offline_id in state.conversations) {
@@ -4460,11 +4463,14 @@ var __publicField = (obj, key, value) => {
4460
4463
  state.conversations[action.payload.offline_id] = action.payload;
4461
4464
  },
4462
4465
  setConversation: (state, action) => {
4466
+ if (!(action.payload.offline_id in state.conversations)) {
4467
+ throw new Error("Conversation does not exist in history");
4468
+ }
4463
4469
  state.conversations[action.payload.offline_id] = action.payload;
4464
4470
  }
4465
4471
  }
4466
4472
  });
4467
- const { setHistory, addConversation, setConversation } = agentsSlice.actions;
4473
+ const { setConversations, addConversation, setConversation } = agentsSlice.actions;
4468
4474
  const selectConversationMapping = (state) => state.agentsReducer.conversations;
4469
4475
  const selectConversation = restructureCreateSelectorWithArgs(
4470
4476
  toolkit.createSelector(
@@ -8521,15 +8527,17 @@ var __publicField = (obj, key, value) => {
8521
8527
  blocks: ["rate"]
8522
8528
  });
8523
8529
  }
8524
- async fetchAll() {
8525
- const activeProject = this.client.store.getState().projectReducer.activeProjectId;
8526
- return this.enqueueRequest({
8530
+ async refreshStore() {
8531
+ const { store } = this.client;
8532
+ const activeProject = store.getState().projectReducer.activeProjectId;
8533
+ const result = await this.enqueueRequest({
8527
8534
  description: "Get agent conversation history",
8528
8535
  method: HttpMethod.GET,
8529
8536
  url: `/projects/${activeProject}/agents-conversations/`,
8530
8537
  blockers: ["agent-conversations"],
8531
8538
  blocks: ["agent-conversations"]
8532
8539
  });
8540
+ store.dispatch(setConversations(result));
8533
8541
  }
8534
8542
  }
8535
8543
  class TeamService extends BaseApiService {
@@ -17068,6 +17076,7 @@ var __publicField = (obj, key, value) => {
17068
17076
  exports2.setComponentTypes = setComponentTypes;
17069
17077
  exports2.setComponents = setComponents;
17070
17078
  exports2.setConversation = setConversation;
17079
+ exports2.setConversations = setConversations;
17071
17080
  exports2.setCreateProjectType = setCreateProjectType;
17072
17081
  exports2.setCurrentUser = setCurrentUser;
17073
17082
  exports2.setDocumentAttachments = setDocumentAttachments;
@@ -17083,7 +17092,6 @@ var __publicField = (obj, key, value) => {
17083
17092
  exports2.setFormSubmissionAttachments = setFormSubmissionAttachments;
17084
17093
  exports2.setFormSubmissions = setFormSubmissions;
17085
17094
  exports2.setForms = setForms;
17086
- exports2.setHistory = setHistory;
17087
17095
  exports2.setIsFetchingInitialData = setIsFetchingInitialData;
17088
17096
  exports2.setIsImportingProjectFile = setIsImportingProjectFile;
17089
17097
  exports2.setIsLoading = setIsLoading;