import request from '@/utils/request'
import qs from 'qs'

/**
 * 知识库
 * */
// 知识库检索
export function searchKnowledge(params) {
  return request({
    url: '/knowledge/search',
    method: 'get',
    params
  })
}
// 知识库列表
export function knowledgeList(params) {
  return request({
    url: '/knowledge/listPage',
    method: 'get',
    params
  })
}
// 知识库详情
export function knowledgeDetail(id) {
  return request({
    url: '/knowledge/detail',
    method: 'get',
    params: {
      kId: id
    }
  })
}

// 添加知识
export function addKnowledge(params) {
  return request({
    url: '/knowledge/add',
    method: 'post',
    params
  })
}
// 修改知识
export function updateKnowledge(params) {
  return request({
    url: '/knowledge/update',
    method: 'post',
    params
  })
}
// 审核知识
export function checkKnowledge(params) {
  return request({
    url: '/knowledge/check',
    method: 'post',
    params
  })
}
// 上架知识
export function groundingKnowledge(type, ids, validPeroid) {
  return request({
    url: '/knowledge/grounding',
    method: 'post',
    params: {
      groundingStatus: type,
      ids: ids,
      validPeroid: validPeroid
    }
  })
}

// 知识库类别管理接口
// 获取知识库类别列表
export function getTypeList(params) {
  return request({
    url: '/ktype/list',
    method: 'get',
    params
  })
}

// 添加类别
export function addType(params) {
  return request({
    url: '/ktype/add',
    method: 'post',
    params
  })
}
// 修改类别
export function updateType(params) {
  return request({
    url: '/ktype/update',
    method: 'post',
    params
  })
}
// 删除类别
export function delType(id) {
  return request({
    url: '/ktype/delete',
    method: 'post',
    params: {
      id: id
    }
  })
}

