AiragLog.data.ts
5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { listKnowledgeName, listmodelid } from '@/views/super/airag/airaglog/AiragLog.api';
//列表数据
export const columns: BasicColumn[] = [
{
title: '序号',
align: 'center',
dataIndex: 'index', // 使用数据中的index字段
key: 'index',
width: 60,
// 移除原有的customRender
},
{
title: '问题',
align: 'center',
dataIndex: 'question',
},
{
title: '回答',
align: 'center',
dataIndex: 'answer',
width: 500,
},
{
title: '模型名称',
align: 'center',
dataIndex: 'name',
},
{
title: '提问者',
align: 'center',
dataIndex: 'createBy',
},
{
title: '提问时间',
align: 'center',
dataIndex: 'createTime',
},
{
title: '回答方式',
align: 'center',
dataIndex: 'answerType',
customRender: ({ text }) => {
const statusMap = {
1: '问题库回答',
2: '模型回答',
3: '未命中',
};
return statusMap[text];
},
},
{
title: '提问方式',
align: 'center',
dataIndex: 'codeType',
customRender: ({ text }) => {
return text === 1 ? '快捷按钮提问' : '输入框提问';
},
},
{
title: '按钮标识',
align: 'center',
dataIndex: 'code',
},
{
title: '是否存入问题库',
align: 'center',
dataIndex: 'isStorage',
customRender: ({ text }) => {
return text === 1 ? '已存入' : '未存入';
},
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '问题',
field: 'question',
component: 'Input', // 替换为文本域组件
},
// 新增知识库选择字段
{
label: '模型名称',
field: 'modelId', // 注意:这里使用knowledgeId作为字段名
component: 'ApiSelect',
componentProps: {
api: listmodelid,
labelField: 'name', // 显示知识库名称
valueField: 'id', // 提交知识库ID
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
},
{
label: '提问时间',
field: 'createTimeStr',
component: 'RangePicker', // 改用支持时间的组件
componentProps: {
showTime: true, // 启用时间选择
format: 'YYYY-MM-DD HH:mm:ss', // 日期时间格式
valueFormat: 'YYYY-MM-DD HH:mm:ss', // 绑定值格式
placeholder: ['开始时间', '结束时间'],
},
},
{
label: '回答方式',
field: 'answerType',
component: 'Select',
componentProps: {
options: [
{
label: '未命中',
value: 3,
},
{
label: '模型回答',
value: 2,
},
{
label: '问题库回答',
value: 1,
},
],
},
},
{
label: '是否存入',
field: 'isStorage',
component: 'Select',
componentProps: {
options: [
{
label: '已存入',
value: 1,
},
{
label: '未存入',
value: 0,
},
],
},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '模型名称',
field: 'name',
component: 'Input',
required: true,
componentProps: {
api: listmodelid,
labelField: 'name',
valueField: 'id',
showSearch: true,
readonly: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
},
{
label: '问题',
field: 'question',
component: 'Input',
},
{
label: '回答',
field: 'answer',
component: 'InputTextArea',
componentProps: {
autoSize: {
minRows: 1, // 最小行数
maxRows: 10, // 最大行数
},
style: { width: '100%' }, // 宽度自适应
},
},
{
label: '知识库',
field: 'knowledgeId', // 注意:这里使用knowledgeId作为字段名
component: 'ApiSelect',
required: true,
componentProps: {
api: listKnowledgeName,
labelField: 'name', // 显示知识库名称
valueField: 'id', // 提交知识库ID
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
},
},
// TODO 主键隐藏字段,目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];
// 高级查询数据
export const superQuerySchema = {
question: { title: '问题', order: 0, view: 'text', type: 'string' },
answer: { title: '回答', order: 1, view: 'text', type: 'string' },
modelId: { title: '模型ID', order: 2, view: 'text', type: 'string' },
};
/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
return formSchema;
}