gerson
2024-07-01 87bce04d7cdf5ca427757071e7cc3b0847b64dfc
src/api/ai/chat.ts
@@ -2,44 +2,43 @@
import { toFormData } from '/@/utils/util';
//#region ====================== knowledge ======================
export interface KnowledgeRes {
    json_ok:     boolean;
    question:    string;
    answer_type: string;
    knowledge:   KnowledgeData[];
   json_ok: boolean;
   question: string;
   answer_type: string;
   knowledge: KnowledgeData[];
}
export interface KnowledgeData {
    answer:   string;
    contexts: Context[];
   answer: string;
   contexts: Context[];
}
export interface Context {
    page_content: string;
    metadata:     Metadata;
   page_content: string;
   metadata: Metadata;
}
export interface Metadata {
    Title?: string;
   Title?: string;
}
//#endregion
//#region ====================== RecordSet ======================
export interface RecordSetRes {
    json_ok:     boolean;
    question:    string;
    answer_type: string;
    values:      RecordSetValues;
   json_ok: boolean;
   question: string;
   answer_type: string;
   values: RecordSetValues;
}
export interface RecordSetValues {
    names:  string[];
    values: Array<Array<any>>;
    type:   string;
    title:  string;
   names: string[];
   values: Array<Array<any>>;
   type: string;
   title: string;
}
//#endregion
@@ -104,22 +103,49 @@
   });
};
/**
 * @summary  获取主场景
 */
export const getSectionList = async (req: any = request) => {
   return req({
      url: '/section/get_section_a_list',
      method: 'POST',
   });
};
/**
 * @summary  获取单个次场景
 */
export const getSectionByIdList = async (params, req: any = request) => {
   return req({
      url: '/section/get_section_b_list',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
/**
 * @summary  获取全部次场景
 */
export const getSectionByAllList = async (req: any = request) => {
   return req({
      url: '/section/get_section_list',
      method: 'POST',
   });
};
/**
 * @summary description
 */
export const CreateHistoryGroup = async (params, req:any = request) => {
  return req({
   url: "/history/create_history_group",
   method: "POST",
   data: params,
   headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
   },
  });
export const CreateHistoryGroup = async (params, req: any = request) => {
   return req({
      url: '/history/create_history_group',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
@@ -132,8 +158,22 @@
        'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
  };
};
export const DeleteHistoryGroups = async (params, req:any = request) => {
   return req({
     url: "/history/delete_history_group",
     method: "POST",
     data: params,
     headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
};
  
@@ -147,3 +187,39 @@
     },
   });
  };
  // 获取AI对话测试例子列表
export const getSelectSample = async (params, req: any = request) => {
   return req({
      url: '/section/get_section_sample',
      method: 'POST',
      data: params,
      headers: {
         'Content-Type': 'application/x-www-form-urlencoded',
      },
   });
};
export const GetHistoryAnswer= async (params, req:any = request) => {
   return req({
     url: "/history/get_history_answer",
     method: "POST",
     data: params,
     headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
  };
  export const QueryHistoryDetail = async (params, req:any = request) => {
   return req({
     url: "/history/query_history_detail",
     method: "POST",
     data: params,
     headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
  };