89 lines
2.3 KiB
JavaScript
89 lines
2.3 KiB
JavaScript
import http from '@/api/http'
|
||
import { API_BASE } from '@gold/config/api'
|
||
|
||
// C 端使用 APP_AI
|
||
// 后端路径是 /app-api/ai/user-prompt,参考 chat API 的实现
|
||
const SERVER_BASE_AI = API_BASE.APP_AI
|
||
|
||
/**
|
||
* 用户提示词 API
|
||
*/
|
||
export const UserPromptApi = {
|
||
/**
|
||
* 获取用户可用提示词列表(自建 + 收藏的智能体)
|
||
* @returns {Promise} 响应数据
|
||
*/
|
||
getMyPromptList: async () => {
|
||
return await http.get(`${SERVER_BASE_AI}/user-prompt/my-list`)
|
||
},
|
||
|
||
/**
|
||
* 创建用户提示词
|
||
* @param {Object} data - 提示词数据
|
||
* @returns {Promise} 响应数据
|
||
*/
|
||
createUserPrompt: async (data) => {
|
||
return await http.post(`${SERVER_BASE_AI}/user-prompt/create`, data, {
|
||
headers: {
|
||
'Content-Type': 'application/json'
|
||
}
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 更新用户提示词
|
||
* @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 })
|
||
},
|
||
|
||
/**
|
||
* 获取用户提示词列表(简化版,不分页)
|
||
* @returns {Promise} 响应数据
|
||
*/
|
||
getUserPromptList: async () => {
|
||
return await http.get(`${SERVER_BASE_AI}/user-prompt/list`)
|
||
},
|
||
|
||
/**
|
||
* 获取单个用户提示词
|
||
* @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
|
||
|