/*
 * Copyright (c) 2024 LangChat. TyCoding All Rights Reserved.
 *
 * Licensed under the GNU Affero General Public License, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.gnu.org/licenses/agpl-3.0.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import request from '@/config/axios'

// AI 文档 VO
export interface DocsVO {
  id: string
  // TODO: Add other fields based on your data model
}

// AI 文档 API
export const DocsApi = {
  // 获得文档分页
  async getDocsPage(params: any) {
    return await request.get({ url: '/chat/aigc/docs/page', params })
  },

  // 获得文档列表
  async getDocsList(params: any) {
    return await request.get({ url: '/chat/aigc/docs/list', params })
  },

  // 获得文档详情
  async getDocsById(id: string) {
    return await request.get({ url: `/chat/aigc/docs/${id}` })
  },

  // 创建文档
  async addDocs(data: any) {
    return await request.post({ url: '/chat/aigc/docs', data })
  },

  // 更新文档
  async updateDocs(data: any) {
    return await request.put({ url: '/chat/aigc/docs', data })
  },

  // 删除文档
  async deleteDocs(id: string) {
    return await request.delete({ url: `/chat/aigc/docs/${id}` })
  },

  // 重新向量化
  async reEmbedDocs(id: string) {
    return await request.get({ url: `/chat/aigc/embedding/re-embed/${id}` })
  }
}
