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

/** 基于Agent的智能问答 (SSE) POST /api/ai/chat/agent-chat */
export async function postChatAgentChat(
  body: {
    session_id: string
    query: string
    knowledge_base_ids: string[]
    knowledge_ids: string[]
    agent_id: string
    summary_model_id: string
    disable_title: boolean
    enable_memory: boolean
    images: string[]
    agent_enabled: boolean
    web_search_enabled: boolean
  },
  options?: { [key: string]: any }
) {
  return request<Record<string, any>>('/api/ai/chat/agent-chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 基于知识库的问答 (SSE) POST /api/ai/chat/knowledge-chat */
export async function postChatKnowledgeChat(
  body: {
    session_id: string
    query: string
    knowledge_base_ids: string[]
    knowledge_ids: string[]
    summary_model_id: string
    disable_title: boolean
    enable_memory: boolean
  },
  options?: { [key: string]: any }
) {
  return request<Record<string, any>>('/api/ai/chat/knowledge-chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 基于模型聊天 (SSE) POST /api/ai/chat/model-chat */
export async function postChatModelChat(
  body: {
    session_id: string
    query: string
    summary_model_id: string
    disable_title: boolean
    enable_memory: boolean
  },
  options?: { [key: string]: any }
) {
  return request<Record<string, any>>('/api/ai/chat/model-chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 创建会话 POST /api/ai/session/create */
export async function postSessionCreate(
  body: {
    name: string
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; result: string; isAuthorized: boolean }>(
    '/api/ai/session/create',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

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

/** 获取分页列表 POST /api/ai/session/pageList */
export async function postSessionPageList(
  body: {
    pageIndex: number
    pageSize: number
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      currentPage: number
      hasNextPage: boolean
      hasPreviousPage: boolean
      model: {
        app: string
        creationTime: string
        entityId: string
        id: string
        isDeleted: boolean
        name: string
        sessionId: string
        updateTime: string
        userId: string
        creatorUserId: string
      }[]
      pageSize: number
      totalCount: number
      totalPages: number
    }
    isAuthorized: boolean
  }>('/api/ai/session/pageList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取消息分页列表 POST /api/ai/session/sessionMessages */
export async function postSessionSessionMessages(
  body: {
    sessionId: string
    pageIndex: number
    pageSize: number
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      currentPage: number
      hasNextPage: boolean
      hasPreviousPage: boolean
      model: {
        answer?: string
        app?: string
        creationTime?: string
        creatorUserId?: string
        entityId?: string
        id?: string
        isDeleted?: boolean
        message_files?: string
        msgId?: string
        query?: string
        sessionId?: string
        taskId?: string
        updateTime?: string
        userId?: string
      }[]
      pageSize: number
      totalCount: number
      totalPages: number
    }
    isAuthorized: boolean
  }>('/api/ai/session/sessionMessages', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 更新会话 POST /api/ai/session/update */
export async function postSessionUpdate(
  body: {
    id: string
    name: string
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/session/update',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}
