Files
sionrui/frontend/app/web-gold/src/api/userPrompt.js

89 lines
2.3 KiB
JavaScript
Raw Normal View History

2025-11-13 01:06:28 +08:00
import http from '@/api/http'
import { API_BASE } from '@gold/config/api'
2025-11-22 16:50:42 +08:00
// C 端使用 APP_AI
2025-11-13 01:06:28 +08:00
// 后端路径是 /app-api/ai/user-prompt参考 chat API 的实现
2025-11-22 16:50:42 +08:00
const SERVER_BASE_AI = API_BASE.APP_AI
2025-11-13 01:06:28 +08:00
/**
* 用户提示词 API
*/
export const UserPromptApi = {
2026-03-15 15:36:29 +08:00
/**
* 获取用户可用提示词列表自建 + 收藏的智能体
* @returns {Promise} 响应数据
*/
getMyPromptList: async () => {
return await http.get(`${SERVER_BASE_AI}/user-prompt/my-list`)
},
2025-11-13 01:06:28 +08:00
/**
* 创建用户提示词
* @param {Object} data - 提示词数据
* @returns {Promise} 响应数据
*/
createUserPrompt: async (data) => {
2025-11-19 01:39:56 +08:00
return await http.post(`${SERVER_BASE_AI}/user-prompt/create`, data, {
headers: {
'Content-Type': 'application/json'
}
})
2025-11-13 01:06:28 +08:00
},
/**
* 更新用户提示词
* @param {Object} data - 提示词数据
* @returns {Promise} 响应数据
*/
updateUserPrompt: async (data) => {
return await http.put(`${SERVER_BASE_AI}/user-prompt/update`, data)
},
/**
* 分页查询用户提示词
* @param {Object} params - 查询参数
* @returns {Promise} 响应数据
*/
getUserPromptPage: async (params) => {
return await http.get(`${SERVER_BASE_AI}/user-prompt/page`, { params })
},
2026-03-11 00:42:46 +08:00
/**
* 获取用户提示词列表简化版不分页
* @returns {Promise} 响应数据
*/
getUserPromptList: async () => {
return await http.get(`${SERVER_BASE_AI}/user-prompt/list`)
},
2025-11-13 01:06:28 +08:00
/**
* 获取单个用户提示词
* @param {Number} id - 提示词ID
* @returns {Promise} 响应数据
*/
getUserPrompt: async (id) => {
return await http.get(`${SERVER_BASE_AI}/user-prompt/get`, { params: { id } })
},
/**
* 删除用户提示词
* @param {Number} id - 提示词ID
* @returns {Promise} 响应数据
*/
deleteUserPrompt: async (id) => {
return await http.delete(`${SERVER_BASE_AI}/user-prompt/delete`, { params: { id } })
},
/**
* 批量删除用户提示词
* @param {Array<Number>} ids - 提示词ID列表
* @returns {Promise} 响应数据
*/
deleteUserPromptList: async (ids) => {
return await http.delete(`${SERVER_BASE_AI}/user-prompt/delete-list`, { params: { ids } })
},
}
export default UserPromptApi