// @ts-ignore
/* eslint-disable */
import request from '@repo/api-client'

/** 创建智能体 POST /api/ai/agent/create */
export async function postAiAgentCreate(
  body: {
    name: string
    description: string
    avatar: string
    mode: string
    config: {
      basic_config: { system_prompt: string }
      model_config: {
        model_id: string
        rerank_model_id: string
        temperature: number
        max_completion_tokens: number
        thinking: boolean
      }
      setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
      kb_config: {
        kb_selection_mode: string
        knowledge_bases: string[]
        retrieve_kb_only_when_mentioned: boolean
        supported_file_types: string[]
      }
      img_vlm_config: {
        image_upload_enabled: boolean
        vlm_model_id: string
        image_storage_provider: string
      }
      faq_config: {
        faq_priority_enabled: boolean
        faq_direct_answer_threshold: number
        faq_score_boost: number
      }
      web_search_config: {
        web_search_enabled: boolean
        web_search_max_results: number
        web_search_provider_id: string
        web_fetch_enabled: boolean
        web_fetch_top_n: number
      }
      multiple_config: { multi_turn_enabled: boolean; history_turns: number }
      search_config: {
        embedding_top_k: number
        keyword_threshold: number
        vector_threshold: number
        rerank_top_k: number
        rerank_threshold: number
      }
      advanced_config: {
        enable_query_expansion: boolean
        enable_rewrite: boolean
        rewrite_prompt_system: string
        rewrite_prompt_user: string
        fallback_strategy: string
        fallback_response: string
        fallback_prompt: string
      }
    }
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/agent/create',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 删除智能体 POST /api/ai/agent/delete */
export async function postAiAgentOpenApiDelete(
  body: {
    id: string
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/agent/delete',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 获取智能体可以使用的分组工具列表 POST /api/ai/agent/group-tools */
export async function postAiAgentGroupTools(body: {}, options?: { [key: string]: any }) {
  return request<{
    isSuccess: boolean
    code: number
    result: { name: string; tools: { description: string; label: string; name: string }[] }[]
    isAuthorized: boolean
  }>('/api/ai/agent/group-tools', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 详情 POST /api/ai/agent/info */
export async function postAiAgentInfo(
  body: {
    id: string
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      avatar: string
      config: {
        advanced_config: {
          enable_query_expansion: boolean
          enable_rewrite: boolean
          fallback_prompt: string
          fallback_response: string
          fallback_strategy: string
          rewrite_prompt_system: string
          rewrite_prompt_user: string
        }
        basic_config: {
          agent_mode: string
          agent_type: string
          context_template: string
          suggested_prompts: string[]
          system_prompt: string
        }
        faq_config: {
          faq_direct_answer_threshold: number
          faq_priority_enabled: boolean
          faq_score_boost: number
        }
        img_vlm_config: {
          image_storage_provider: string
          image_upload_enabled: boolean
          vlm_model_id: string
        }
        kb_config: {
          kb_selection_mode: string
          knowledge_bases: string[]
          retrieve_kb_only_when_mentioned: boolean
          supported_file_types: string[]
        }
        model_config: {
          max_completion_tokens: number
          model_id: string
          rerank_model_id: string
          temperature: number
          thinking: boolean
        }
        multiple_config: { history_turns: number; multi_turn_enabled: boolean }
        search_config: {
          embedding_top_k: number
          keyword_threshold: number
          rerank_threshold: number
          rerank_top_k: number
          vector_threshold: number
        }
        setting_config: {
          allowed_tools: string[]
          max_iterations: number
          mcp_selection_mode: string
          mcp_services: string[]
          selected_skills: string[]
          skills_selection_mode: string
        }
        web_search_config: {
          web_fetch_enabled: boolean
          web_fetch_top_n: number
          web_search_enabled: boolean
          web_search_max_results: number
        }
      }
      creationTime: string
      creatorUserId: string
      description: string
      id: string
      isDeleted: boolean
      is_builtin: boolean
      mode: string
      name: string
      type: string
      updateTime: string
    }
    isAuthorized: boolean
  }>('/api/ai/agent/info', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取分页列表 POST /api/ai/agent/pageList */
export async function postAiAgentPageList(
  body: {
    keyword: string
    mode: string
    type: string
    pageIndex: number
    pageSize: number
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      currentPage: number
      hasNextPage: boolean
      hasPreviousPage: boolean
      model: {
        avatar?: string
        config: {
          advanced_config: {
            enable_query_expansion: boolean
            enable_rewrite: boolean
            fallback_prompt: string
            fallback_response: string
            fallback_strategy: string
            rewrite_prompt_system: string
            rewrite_prompt_user: string
          }
          basic_config: {
            agent_mode: string
            agent_type: string
            context_template: string
            suggested_prompts: string[]
            system_prompt: string
          }
          faq_config: {
            faq_direct_answer_threshold: number
            faq_priority_enabled: boolean
            faq_score_boost: number
          }
          img_vlm_config: {
            image_storage_provider: string
            image_upload_enabled: boolean
            vlm_model_id: string
          }
          kb_config: {
            kb_selection_mode: string
            knowledge_bases: string[]
            retrieve_kb_only_when_mentioned: boolean
            supported_file_types: string[]
          }
          model_config: {
            max_completion_tokens: number
            model_id: string
            rerank_model_id: string
            temperature: number
            thinking: boolean
          }
          multiple_config: { history_turns: number; multi_turn_enabled: boolean }
          search_config: {
            embedding_top_k: number
            keyword_threshold: number
            rerank_threshold: number
            rerank_top_k: number
            vector_threshold: number
          }
          setting_config: {
            allowed_tools: string[]
            max_iterations: number
            mcp_selection_mode: string
            mcp_services: string[]
            selected_skills: string[]
            skills_selection_mode: string
          }
          web_search_config: {
            web_fetch_enabled: boolean
            web_fetch_top_n: number
            web_search_enabled: boolean
            web_search_max_results: number
          }
        }
        creationTime?: string
        creatorUserId?: string
        description?: string
        id?: string
        isDeleted?: boolean
        is_builtin?: boolean
        mode?: string
        name?: string
        type?: string
        updateTime?: string
      }[]
      pageSize: number
      totalCount: number
      totalPages: number
    }
    isAuthorized: boolean
  }>('/api/ai/agent/pageList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取智能体建议提问列表 POST /api/ai/agent/suggested-questions */
export async function postAiAgentSuggestedQuestions(
  body: {
    id: string
    limit: number
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: { knowledge_base_id: string; question: string; source: string }[]
    isAuthorized: boolean
  }>('/api/ai/agent/suggested-questions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取智能体可以使用的工具列表 POST /api/ai/agent/tools */
export async function postAiAgentTools(body: {}, options?: { [key: string]: any }) {
  return request<{
    isSuccess: boolean
    code: number
    result: { description: string; label: string; name: string }[]
    isAuthorized: boolean
  }>('/api/ai/agent/tools', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 修改智能体 POST /api/ai/agent/update */
export async function postAiAgentUpdate(
  body: {
    id: string
    name: string
    description: string
    avatar: string
    mode: string
    config: {
      basic_config: { system_prompt: string }
      model_config: {
        model_id: string
        rerank_model_id: string
        temperature: number
        max_completion_tokens: number
        thinking: boolean
      }
      setting_config: { max_iterations: number; mcp_selection_mode: string; mcp_services: string[] }
      kb_config: {
        kb_selection_mode: string
        knowledge_bases: string[]
        retrieve_kb_only_when_mentioned: boolean
        supported_file_types: string[]
      }
      img_vlm_config: {
        image_upload_enabled: boolean
        vlm_model_id: string
        image_storage_provider: string
      }
      faq_config: {
        faq_priority_enabled: boolean
        faq_direct_answer_threshold: number
        faq_score_boost: number
      }
      web_search_config: {
        web_search_enabled: boolean
        web_search_max_results: number
        web_search_provider_id: string
        web_fetch_enabled: boolean
        web_fetch_top_n: number
      }
      multiple_config: { multi_turn_enabled: boolean; history_turns: number }
      search_config: {
        embedding_top_k: number
        keyword_threshold: number
        vector_threshold: number
        rerank_top_k: number
        rerank_threshold: number
      }
      advanced_config: {
        enable_query_expansion: boolean
        enable_rewrite: boolean
        rewrite_prompt_system: string
        rewrite_prompt_user: string
        fallback_strategy: string
        fallback_response: string
        fallback_prompt: string
      }
    }
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/agent/update',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}
