QuestionEmbedding.data.ts 2.3 KB
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { listKnowledge } from '@/views/super/airag/questionembedding/QuestionEmbedding.api';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    align: 'center',
    dataIndex: 'index',
    key: 'rowIndex',
    width: 60,
    // 这里只需简单的序号,实际计算在组件内完成
    customRender: ({ index }) => index + 1,
  },
  {
    title: 'ID',
    align: 'center',
    dataIndex: 'id',
    width: 200,
  },
  {
    title: '知识库',
    align: 'center',
    dataIndex: 'knowledgeName',
    width: 150,
  },
  {
    title: '问题',
    align: 'center',
    dataIndex: 'question',
    width: 250,
  },
  {
    title: '回答',
    align: 'center',
    dataIndex: 'answer',
    width: 300,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'knowledgeId',
    label: '知识库',
    component: 'ApiSelect',
    componentProps: {
      api: listKnowledge,
      labelField: 'name',
      valueField: 'id',
    },
    colProps: { span: 8 },
  },
  {
    field: 'question',
    label: '问题',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'answer',
    label: '回答',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'ID',
    component: 'Input',
    show: false,
  },
  {
    field: 'knowledgeId',
    label: '知识库',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      api: listKnowledge,
      labelField: 'name',
      valueField: 'id',
      showSearch: true,
    },
  },
  {
    field: 'question',
    label: '问题',
    component: 'Input',
    required: true,
    colProps: { span: 24 },
  },
  {
    field: 'answer',
    label: '回答',
    component: 'InputTextArea',
    required: true,
    componentProps: {
      allowClear: true,
      showCount: true,
      autoSize: {
        minRows: 5,
        maxRows: 10,
      },
    },
  },
];

export const superQuerySchema = {
  knowledgeId: { title: '知识库', order: 0, view: 'text', type: 'string' },
  question: { title: '问题', order: 1, view: 'text', type: 'string' },
  answer: { title: '回答', order: 2, view: 'text', type: 'string' },
};

export function getBpmFormSchema(_formData): FormSchema[] {
  return formSchema;
}