import request from '@/utils/request'

export function taskApi(data) {
    return request({
        url: '/tts/task',
        method: 'post',
        data: data
    })
}

export function taskListApi(params) {
    return request({
        url: '/tts/task/list',
        method: 'get',
        params: params
    })
}

export function getDashboardApi(params) {
    return request({
        url: '/tts/task/dashboard/stats',
        method: 'get'
    })
}

export function downloadWavApi(id) {
    return request({
        url: `/tts/task/audio/${id}`,
        method: 'get',
        responseType: 'blob'
    })
}

export function deleteTask(ids) {
    return request({
        url: `/tts/task/${ids}`,
        method: 'delete'
    })
}

export function regenerateApi(id) {
    return request({
        url: `/tts/task/regenerate/${id}`,
        method: 'post'
    })
}

export function generalizationApi(data) {
    return request({
        url: '/tts/task/llm/query',
        method: 'post',
        data: data
    })
}

export function batchTaskApi(data) {
    return request({
        url: '/tts/task/batch',
        method: 'post',
        data: data
    })
}

export function saveTaskApi(data) {
    return request({
        url: `/tts/task/save-to-corpus/${data.taskId}/${data.categoryId}`,
        method: 'post'
    })
}