mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
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:
parent
f4a33c80cc
commit
8b5835820c
1 changed files with 57 additions and 0 deletions
|
|
@ -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();
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue