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