@overmap-ai/core 1.0.53-add-agent-conversations.8 → 1.0.53-add-agent-conversations.10
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.
package/dist/overmap-core.js
CHANGED
|
@@ -6931,18 +6931,17 @@ class MainService extends BaseApiService {
|
|
|
6931
6931
|
store.dispatch(setActiveWorkspaceId(currentWorkspaceId));
|
|
6932
6932
|
void this.client.categories.refreshStore().then(() => {
|
|
6933
6933
|
void this.client.issues.refreshStore().then(() => {
|
|
6934
|
-
void this.client.issueComments.refreshStore()
|
|
6934
|
+
void this.client.issueComments.refreshStore();
|
|
6935
6935
|
});
|
|
6936
6936
|
});
|
|
6937
|
-
void this.client.projectFiles.refreshStore()
|
|
6937
|
+
void this.client.projectFiles.refreshStore();
|
|
6938
6938
|
void this.client.componentTypes.refreshStore().then(() => {
|
|
6939
6939
|
void this.client.componentStages.refreshStore().then(() => {
|
|
6940
|
-
void this.client.components.refreshStore(overwrite)
|
|
6940
|
+
void this.client.components.refreshStore(overwrite);
|
|
6941
6941
|
});
|
|
6942
|
-
void this.client.componentStageCompletions.refreshStore().then();
|
|
6943
6942
|
});
|
|
6944
6943
|
void this.client.userForms.refreshStore().then(() => {
|
|
6945
|
-
void this.client.userFormSubmissions.refreshStore()
|
|
6944
|
+
void this.client.userFormSubmissions.refreshStore();
|
|
6946
6945
|
});
|
|
6947
6946
|
}
|
|
6948
6947
|
if (currentProjectId) {
|
|
@@ -6964,6 +6963,7 @@ class MainService extends BaseApiService {
|
|
|
6964
6963
|
void this.client.documents.refreshStore();
|
|
6965
6964
|
void this.client.issueUpdates.refreshStore();
|
|
6966
6965
|
void this.client.issueTypes.refreshStore();
|
|
6966
|
+
void this.client.agent.refreshStore();
|
|
6967
6967
|
}
|
|
6968
6968
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6969
6969
|
if (overwrite) {
|
|
@@ -8519,24 +8519,60 @@ class DocumentService extends BaseApiService {
|
|
|
8519
8519
|
}
|
|
8520
8520
|
}
|
|
8521
8521
|
class AgentService extends BaseApiService {
|
|
8522
|
+
async startConversation(prompt) {
|
|
8523
|
+
const activeProjectId = this.client.store.getState().projectReducer.activeProjectId;
|
|
8524
|
+
return this.enqueueRequest({
|
|
8525
|
+
description: "Start agent conversation",
|
|
8526
|
+
method: HttpMethod.POST,
|
|
8527
|
+
url: "/agents/start/",
|
|
8528
|
+
payload: {
|
|
8529
|
+
prompt,
|
|
8530
|
+
active_project: activeProjectId
|
|
8531
|
+
},
|
|
8532
|
+
blockers: ["prompt"],
|
|
8533
|
+
blocks: ["prompt"]
|
|
8534
|
+
}).then((response) => {
|
|
8535
|
+
if (response.conversation) {
|
|
8536
|
+
this.client.store.dispatch(addConversation(response.conversation));
|
|
8537
|
+
return response.conversation;
|
|
8538
|
+
}
|
|
8539
|
+
throw new Error("Unexpected response from agent");
|
|
8540
|
+
});
|
|
8541
|
+
}
|
|
8522
8542
|
/**
|
|
8523
8543
|
* Prompt the agent with a message.
|
|
8524
|
-
* @param
|
|
8544
|
+
* @param prompt The message to prompt the agent with.
|
|
8525
8545
|
* @param conversationId If continuing an existing message, the UUID of that conversation.
|
|
8526
8546
|
*/
|
|
8527
|
-
async prompt
|
|
8528
|
-
const
|
|
8547
|
+
async continueConversation(prompt, conversationId) {
|
|
8548
|
+
const { store } = this.client;
|
|
8549
|
+
const activeProjectId = store.getState().projectReducer.activeProjectId;
|
|
8529
8550
|
return this.enqueueRequest({
|
|
8530
8551
|
description: "Prompt agent",
|
|
8531
8552
|
method: HttpMethod.POST,
|
|
8532
8553
|
url: "/agents/prompt/",
|
|
8533
8554
|
payload: {
|
|
8534
|
-
prompt
|
|
8555
|
+
prompt,
|
|
8535
8556
|
active_project: activeProjectId
|
|
8536
8557
|
},
|
|
8537
8558
|
blockers: ["prompt"],
|
|
8538
8559
|
blocks: ["prompt"],
|
|
8539
|
-
queryParams:
|
|
8560
|
+
queryParams: { conversation_id: conversationId }
|
|
8561
|
+
}).then((response) => {
|
|
8562
|
+
if (response.response) {
|
|
8563
|
+
const conversation = store.getState().agentsReducer.conversations[conversationId];
|
|
8564
|
+
if (!conversation) {
|
|
8565
|
+
throw new Error("Conversation not found");
|
|
8566
|
+
}
|
|
8567
|
+
store.dispatch(
|
|
8568
|
+
updateConversation({
|
|
8569
|
+
offline_id: conversationId,
|
|
8570
|
+
tiptap_content: [...conversation.tiptap_content || [], response.response]
|
|
8571
|
+
})
|
|
8572
|
+
);
|
|
8573
|
+
return response.response;
|
|
8574
|
+
}
|
|
8575
|
+
throw new Error("Unexpected response from agent");
|
|
8540
8576
|
});
|
|
8541
8577
|
}
|
|
8542
8578
|
async get(conversationId) {
|
|
@@ -8546,6 +8582,9 @@ class AgentService extends BaseApiService {
|
|
|
8546
8582
|
url: `/agents/conversations/${conversationId}/`,
|
|
8547
8583
|
blockers: ["conversation"],
|
|
8548
8584
|
blocks: ["conversation"]
|
|
8585
|
+
}).then((response) => {
|
|
8586
|
+
this.client.store.dispatch(setConversation(response));
|
|
8587
|
+
return response;
|
|
8549
8588
|
});
|
|
8550
8589
|
}
|
|
8551
8590
|
async rate(responseId, rating) {
|