refactor: Remove cache and metrics endpoints, and clean up voice design CRUD operations

This commit is contained in:
2026-02-04 19:41:08 +08:00
parent dc5fd643e7
commit 4f535b20e5
10 changed files with 4 additions and 275 deletions

View File

@@ -132,10 +132,12 @@ const VoiceDesignForm = forwardRef<VoiceDesignFormHandle>((_props, ref) => {
try {
const backend = preferences?.default_backend || 'local'
const text = watch('text')
const design = await voiceDesignApi.create({
name: saveDesignName,
instruct: instruct,
backend_type: backend
backend_type: backend,
preview_text: text || `${saveDesignName}的声音`
})
toast.success('音色设计已保存')

View File

@@ -399,13 +399,6 @@ export const voiceDesignApi = {
return response.data
},
get: async (id: number): Promise<VoiceDesign> => {
const response = await apiClient.get<VoiceDesign>(
API_ENDPOINTS.VOICE_DESIGNS.GET(id)
)
return response.data
},
create: async (data: VoiceDesignCreate): Promise<VoiceDesign> => {
const response = await apiClient.post<VoiceDesign>(
API_ENDPOINTS.VOICE_DESIGNS.CREATE,
@@ -414,18 +407,6 @@ export const voiceDesignApi = {
return response.data
},
update: async (id: number, name: string): Promise<VoiceDesign> => {
const response = await apiClient.patch<VoiceDesign>(
API_ENDPOINTS.VOICE_DESIGNS.UPDATE(id),
{ name }
)
return response.data
},
delete: async (id: number): Promise<void> => {
await apiClient.delete(API_ENDPOINTS.VOICE_DESIGNS.DELETE(id))
},
prepareClone: async (id: number): Promise<{ message: string; cache_id: number; ref_text: string }> => {
const response = await apiClient.post<{ message: string; cache_id: number; ref_text: string }>(
API_ENDPOINTS.VOICE_DESIGNS.PREPARE_CLONE(id)

View File

@@ -30,9 +30,6 @@ export const API_ENDPOINTS = {
VOICE_DESIGNS: {
LIST: '/voice-designs',
CREATE: '/voice-designs',
GET: (id: number) => `/voice-designs/${id}`,
UPDATE: (id: number) => `/voice-designs/${id}`,
DELETE: (id: number) => `/voice-designs/${id}`,
PREPARE_CLONE: (id: number) => `/voice-designs/${id}/prepare-clone`,
},
} as const