提示词保存
This commit is contained in:
68
frontend/app/web-gold/src/api/userPrompt.js
Normal file
68
frontend/app/web-gold/src/api/userPrompt.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import http from '@/api/http'
|
||||
import { API_BASE } from '@gold/config/api'
|
||||
|
||||
// C 端使用 APP_AI,如果不存在则回退到 ADMIN_AI
|
||||
// 后端路径是 /app-api/ai/user-prompt,参考 chat API 的实现
|
||||
const SERVER_BASE_AI = API_BASE.APP_AI || API_BASE.ADMIN_AI
|
||||
|
||||
/**
|
||||
* 用户提示词 API
|
||||
*/
|
||||
export const UserPromptApi = {
|
||||
/**
|
||||
* 创建用户提示词
|
||||
* @param {Object} data - 提示词数据
|
||||
* @returns {Promise} 响应数据
|
||||
*/
|
||||
createUserPrompt: async (data) => {
|
||||
return await http.post(`${SERVER_BASE_AI}/user-prompt/create`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新用户提示词
|
||||
* @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 })
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取单个用户提示词
|
||||
* @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
|
||||
|
||||
Reference in New Issue
Block a user