// @ts-ignore
/* eslint-disable */
import request from '@repo/api-client'

/** 批量检查模型是否可用 POST /api/ai/ollama/checkModels */
export async function postAiOllamaCheckModels(
  body: {
    models: string[]
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: { available?: boolean; name?: string }[]
    isAuthorized: boolean
  }>('/api/ai/ollama/checkModels', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 下载模型 POST /api/ai/ollama/downloadModel */
export async function postAiOllamaDownloadModel(
  body: {
    model: string
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: { modelName: string; progress: number; status: string; taskId: string }
    isAuthorized: boolean
  }>('/api/ai/ollama/downloadModel', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取下载进度 POST /api/ai/ollama/downloadProcess */
export async function postAiOllamaDownloadProcess(
  body: {
    taskId: string
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      id: string
      message: string
      modelName: string
      progress: number
      startTime: string
      status: string
    }
    isAuthorized: boolean
  }>('/api/ai/ollama/downloadProcess', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取所有下载任务列表 POST /api/ai/ollama/downloadTasks */
export async function postAiOllamaDownloadTasks(body: {}, options?: { [key: string]: any }) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      id?: string
      message?: string
      modelName?: string
      progress?: number
      startTime?: string
      status?: string
    }[]
    isAuthorized: boolean
  }>('/api/ai/ollama/downloadTasks', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取模型列表 POST /api/ai/ollama/models */
export async function postAiOllamaModels(body: {}, options?: { [key: string]: any }) {
  return request<{
    isSuccess: boolean
    code: number
    result: { digest?: string; modified_at?: string; name?: string; size?: number }[]
    isAuthorized: boolean
  }>('/api/ai/ollama/models', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 检查Ollama状态 POST /api/ai/ollama/status */
export async function postAiOllamaStatus(body: {}, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/ai/ollama/status', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}
