feat: add agent favorite functionality with UI and API implementation
- Add `addFavorite` and `removeFavorite` API functions in agent.js - Implement favorite button UI in Agents.vue with star icons - Add login check before favorite operations using token manager - Sort agents with favorites appearing at the top of the list - Include success/error messages for user feedback - Add backend API endpoints for creating/deleting agent favorites - Update agent list response to include favorite status - Style favorite button with hover and active states
This commit is contained in:
@@ -116,3 +116,27 @@ export function getMessages(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加智能体收藏
|
||||
* @param {number} agentId - 智能体ID
|
||||
*/
|
||||
export function addFavorite(agentId) {
|
||||
return request({
|
||||
url: `${BASE_URL}/agent/favorite/create`,
|
||||
method: 'post',
|
||||
params: { agentId }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消智能体收藏
|
||||
* @param {number} agentId - 智能体ID
|
||||
*/
|
||||
export function removeFavorite(agentId) {
|
||||
return request({
|
||||
url: `${BASE_URL}/agent/favorite/delete`,
|
||||
method: 'delete',
|
||||
params: { agentId }
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user