import { request } from "umi";

/**
 * 获取会话列表
 * @param app_name 应用名称
 * @param page_index 页码
 */
export const GetSessionList = (params: {
  app_name: string;
  page_index: number;
}) =>
  request("/api/ai/chat-session/list", {
    method: "get",
    params,
  });

/**
 * 获取会话消息列表
 * @param app_name 应用名称
 * @param session_id 会话id
 * @param page_index 页码
 */
export const GetSessionMessageList = (params: {
  app_name: string;
  session_id: string;
  page_index: number;
}) =>
  request("/api/ai/chat-message/list", {
    method: "get",
    params,
  });


/**
 * 修改会话名称
 * @param app_name 应用名称
 * @param session_id 会话id
 * @param page_index 页码
 */
export const ChangeSessionName = (data: {
  app_name: string;
  session_id: string;
  new_name: string;
}) =>
  request("/api/ai/chat-session/rename", {
    method: "post",
    data,
  });

  /**
 * 删除会话
 * @param app_name 应用名称
 * @param session_id 会话id
 */
export const DeleteSession = (data: {
  app_name: string;
  session_id: string;
}) =>
  request("/api/ai/chat-session/delete", {
    method: "post",
    data,
  });
