/*
 * @Author: ysh
 * @Date: 2025-06-13 10:35:45
 * @LastEditors: wrh
 * @LastEditTime: 2025-07-29 17:48:55
 */
import request from '@/utils/request'

// 查询cmc聊天附件列表
export function listDocument(query) {
  return request({
    url: '/llm/document/list',
    method: 'get',
    params: query
  })
}

// 查询cmc聊天附件详细
export function getDocument(documentId) {
  return request({
    url: '/llm/document/' + documentId,
    method: 'get'
  })
}

// 新增cmc聊天附件
export function addDocument(data) {
  return request({
    url: '/llm/document',
    method: 'post',
    data: data
  })
}

// 修改cmc聊天附件
export function updateDocument(data) {
  return request({
    url: '/llm/document',
    method: 'put',
    data: data
  })
}

// 删除cmc聊天附件
export function delDocument(documentId) {
  return request({
    url: '/llm/document/' + documentId,
    method: 'delete'
  })
}


// 上传聊天外部文件
export function uploadDocument(fileList) {
  const formData = new FormData()
  for (let f of fileList) {
    formData.append('fileList', f)
  }
  return request({
    url: '/llm/document/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}