mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 10:03:54 +08:00
update:调整文件夹
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export * from './types'
|
||||
export * from './voiceprint'
|
||||
@@ -0,0 +1,29 @@
|
||||
// 声纹信息响应类型
|
||||
export interface VoicePrint {
|
||||
id: string
|
||||
audioId: string
|
||||
sourceName: string
|
||||
introduce: string
|
||||
createDate: string
|
||||
}
|
||||
|
||||
// 语音对话记录类型
|
||||
export interface ChatHistory {
|
||||
content: string
|
||||
audioId: string
|
||||
}
|
||||
|
||||
// 创建说话人数据类型
|
||||
export interface CreateSpeakerData {
|
||||
agentId: string
|
||||
audioId: string
|
||||
sourceName: string
|
||||
introduce: string
|
||||
}
|
||||
|
||||
// 通用响应类型
|
||||
export interface ApiResponse<T = any> {
|
||||
code: number
|
||||
msg: string
|
||||
data: T
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user