mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-23 23:53:55 +08:00
73 lines
1.4 KiB
TypeScript
73 lines
1.4 KiB
TypeScript
import type {
|
|
ChatHistory,
|
|
CreateSpeakerData,
|
|
VoicePrint,
|
|
} from './types'
|
|
import { http } from '@/http/request/alova'
|
|
|
|
// 获取声纹列表
|
|
export function getVoicePrintList(agentId: string) {
|
|
return http.Get<VoicePrint[]>(`/agent/voice-print/list/${agentId}`, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: false,
|
|
},
|
|
cacheFor: {
|
|
expire: 0,
|
|
},
|
|
})
|
|
}
|
|
|
|
// 获取语音对话记录(用于选择声纹向量)
|
|
export function getChatHistory(agentId: string) {
|
|
return http.Get<ChatHistory[]>(`/agent/${agentId}/chat-history/user`, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: false,
|
|
},
|
|
cacheFor: {
|
|
expire: 0,
|
|
},
|
|
})
|
|
}
|
|
|
|
// 新增说话人
|
|
export function createVoicePrint(data: CreateSpeakerData) {
|
|
return http.Post<null>('/agent/voice-print', data, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: true,
|
|
},
|
|
})
|
|
}
|
|
|
|
// 删除声纹
|
|
export function deleteVoicePrint(id: string) {
|
|
return http.Delete<null>(`/agent/voice-print/${id}`, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: true,
|
|
},
|
|
})
|
|
}
|
|
|
|
// 更新声纹信息
|
|
export function updateVoicePrint(data: VoicePrint) {
|
|
return http.Put<null>('/agent/voice-print', data, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: true,
|
|
},
|
|
})
|
|
}
|
|
|
|
// 获取音频下载ID
|
|
export function getAudioDownloadId(audioId: string) {
|
|
return http.Post<string>(`/agent/audio/${audioId}`, {}, {
|
|
meta: {
|
|
ignoreAuth: false,
|
|
toast: false,
|
|
},
|
|
})
|
|
}
|