69 lines
1.5 KiB
TypeScript
69 lines
1.5 KiB
TypeScript
|
|
import http from "../http";
|
||
|
|
|
||
|
|
export interface PromptTemplateVO {
|
||
|
|
id: number;
|
||
|
|
tenantId: number;
|
||
|
|
creatorId: number;
|
||
|
|
templateName: string;
|
||
|
|
category: string;
|
||
|
|
isSystem: number;
|
||
|
|
tags?: string[];
|
||
|
|
usageCount: number;
|
||
|
|
promptContent: string;
|
||
|
|
status: number;
|
||
|
|
remark?: string;
|
||
|
|
createdAt: string;
|
||
|
|
updatedAt: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface PromptTemplateDTO {
|
||
|
|
id?: number;
|
||
|
|
templateName: string;
|
||
|
|
category: string;
|
||
|
|
isSystem: number;
|
||
|
|
tags?: string[];
|
||
|
|
promptContent: string;
|
||
|
|
status: number;
|
||
|
|
remark?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getPromptPage = (params: {
|
||
|
|
current: number;
|
||
|
|
size: number;
|
||
|
|
name?: string;
|
||
|
|
category?: string;
|
||
|
|
}) => {
|
||
|
|
return http.get<any, { code: string; data: { records: PromptTemplateVO[]; total: number }; msg: string }>(
|
||
|
|
"/api/biz/prompt/page",
|
||
|
|
{ params }
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export const savePromptTemplate = (data: PromptTemplateDTO) => {
|
||
|
|
return http.post<any, { code: string; data: PromptTemplateVO; msg: string }>(
|
||
|
|
"/api/biz/prompt",
|
||
|
|
data
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export const updatePromptTemplate = (data: PromptTemplateDTO) => {
|
||
|
|
return http.put<any, { code: string; data: PromptTemplateVO; msg: string }>(
|
||
|
|
"/api/biz/prompt",
|
||
|
|
data
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export const deletePromptTemplate = (id: number) => {
|
||
|
|
return http.delete<any, { code: string; data: boolean; msg: string }>(
|
||
|
|
`/api/biz/prompt/${id}`
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export const updatePromptStatus = (id: number, status: number) => {
|
||
|
|
return http.put<any, { code: string; data: boolean; msg: string }>(
|
||
|
|
`/api/biz/prompt/${id}/status`,
|
||
|
|
null,
|
||
|
|
{ params: { status } }
|
||
|
|
);
|
||
|
|
};
|