/*
 * @Author: wrh
 * @Date: 2025-07-17 18:06:24
 * @LastEditors: wrh
 * @LastEditTime: 2025-09-02 16:43:25
 */
import request from '@/utils/request'

// 查询智能体列表
export function listAgent(query) {
  return request({
    url: '/llm/agent/list',
    method: 'get',
    params: query
  })
}

// 查询智能体详细
export function getAgent(agentId) {
  return request({
    url: '/llm/agent/' + agentId,
    method: 'get'
  })
}

// 新增智能体
export function addAgent(data) {
  return request({
    url: '/llm/agent',
    method: 'post',
    data: data
  })
}

// 修改智能体
export function updateAgent(data) {
  return request({
    url: '/llm/agent',
    method: 'put',
    data: data
  })
}

// 删除智能体
export function delAgent(agentId) {
  return request({
    url: '/llm/agent/' + agentId,
    method: 'delete'
  })
}

// 上传单文件
export function uploadFile(file, agentName) {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('agentName', agentName)
  return request({
    url: '/llm/agent/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 上传单文件
export function uploadModifyFile(file, agentName) {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('agentName', agentName)
  return request({
    url: '/llm/agent/modifyFile',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 上传多文件
export function uploadFileList(fileList, agentName) {
  const formData = new FormData()
  for (let f of fileList) {
    formData.append('fileList', f)
  }
  formData.append('agentName', agentName)
  return request({
    url: '/llm/agent/uploadList',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 获取上传进度
export function getProcessValue() {
  return request({
    url: '/llm/agent/getProcess',
    method: 'get'
  })
}

//获取开场白, agentName：智能体名称
export function opening(agentName) {
  return request({
    url: '/llm/agent/opening',
    method: 'get',
    params: { agentName }
  })
}
