import HttpAxios from '@/utils/axios'

const base = import.meta.env.VITE_API_HOST
const baseUrl = `${base}/main_new_version.php`

/**
 * Prompt Configuration数据
 */
export const getPromptConfiguration = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot',
      ...params
    },
    config
  )
}
/**
 * 保存Prompt Configuration数据
 */
export const SavePromptConfiguration = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot',
      operate: 'save',
      ...params
    },
    config
  )
}
/**
 * 编辑返回prompt数据
 */
export const EditPrompt = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot',
      operate: 'preview_propmpt_witout_save',
      ...params
    },
    config
  )
}
/**
 * AI测试问题
 */
export const PromptAITest = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot',
      operate: 'test_with_ds_claude',
      ...params
    },
    config
  )
}

/**
 * 获取prompt提示器
 */
export const getPrompt = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat',
      operate: 'ai_chat_prompt',
      ...params
    },
    config
  )
}

/**
 * ai聊天
 */
export const aiChat = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat',
      operate: 'ai_chat',
      ...params
    },
    config
  )
}

/**
 * 暂停ai聊天
 */
export const pauseAiChat = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat',
      operate: 'ai_chat_stop',
      ...params
    },
    config
  )
}

/**
 * 评价ai聊天
 */
export const feedbackAiChat = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat',
      operate: 'ai_chat_answer_mark',
      ...params
    },
    config
  )
}

/**
 * AI Robot预设问题显示
 */
export const AIRobotInit = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat',
      operate: 'ai_chat_fixed_init',
      ...params
    },
    config
  )
}

/**
 * 获取chat log 表格列
 */
export const getChatLogTableColumn = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat_log',
      ...params
    },
    config
  )
}

/**
 * 根据筛选项获取chat log 表格数据
 */
export const getChatLogTableData = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat_log',
      operate: 'search',
      ...params
    },
    config
  )
}

/**
 * 获取chat log 表格全部数据
 */
export const getChatLogAllTableData = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat_log',
      operate: 'excel',
      ...params
    },
    config
  )
}

/**
 * 获取ai api log 表格列
 */
export const getAIApiLogTableColumn = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_api_log',
      ...params
    },
    config
  )
}

/**
 * 根据筛选项获取ai api log表格数据
 */
export const getAIApiLogTableData = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_api_log',
      operate: 'search',
      ...params
    },
    config
  )
}

/**
 * 获取ai api log表格全部数据
 */
export const getAIApiLogAllTableData = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_api_log',
      operate: 'excel',
      ...params
    },
    config
  )
}

/**
 * 获取ai api log弹窗详情
 */
export const getAIApiLogDialog = (params: any, config: any) => {
  return HttpAxios.post(
    `${baseUrl}`,
    {
      action: 'robot_chat_log',
      operate: 'api_log',
      ...params
    },
    config
  )
}
