feat(agent): add new API methods for agent management

- Implemented `getDownloadUrl` to retrieve download links for chat history.
- Added `searchAgent` for searching agents by keyword and type.
- Introduced `getAgentTags` to fetch tags associated with an agent.
- Created `saveAgentTags` to update tags for a specific agent.
This commit is contained in:
lapy 2026-06-13 14:00:53 +01:00
parent f4a33c80cc
commit 8b5835820c

View file

@ -396,4 +396,61 @@ export default {
});
}).send();
},
getDownloadUrl(agentId, sessionId, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/chat-history/getDownloadUrl/${agentId}/${sessionId}`)
.method('POST')
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.getDownloadUrl(agentId, sessionId, callback);
});
}).send();
},
searchAgent(keyword, searchType, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/list?keyword=${encodeURIComponent(keyword)}&searchType=${searchType}`)
.method('GET')
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.searchAgent(keyword, searchType, callback);
});
}).send();
},
getAgentTags(agentId, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/${agentId}/tags`)
.method('GET')
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.getAgentTags(agentId, callback);
});
}).send();
},
saveAgentTags(agentId, tags, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/agent/${agentId}/tags`)
.method('PUT')
.data(tags)
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.networkFail(() => {
RequestService.reAjaxFun(() => {
this.saveAgentTags(agentId, tags, callback);
});
}).send();
},
}