Skip to content

Commit 8db1843

Browse files
committed
feat(rag): feedback optimizer
1 parent 632dd57 commit 8db1843

File tree

1 file changed

+102
-9
lines changed
  • packages/vmind/__tests__/experiment/src/pages/ChartDialogueQA

1 file changed

+102
-9
lines changed

packages/vmind/__tests__/experiment/src/pages/ChartDialogueQA/qaPairRag.tsx

Lines changed: 102 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { isArray } from '@visactor/vutils';
1919
import { VChartSpec } from '../../../../../src';
2020

2121
const { Option } = Select;
22+
const TextArea = Input.TextArea;
2223
const FormItem = Form.Item;
2324
const globalVariables = (import.meta as any).env;
2425
const url = globalVariables.VITE_VCHART_EDITOR_URL || 'http://localhost/';
@@ -60,6 +61,89 @@ const baseSpec = {
6061
position: 'start'
6162
}
6263
};
64+
const topKeys = [
65+
'type',
66+
'series',
67+
'axes',
68+
'crosshair',
69+
'data',
70+
'width',
71+
'height',
72+
'autoFit',
73+
'color',
74+
'seriesStyle',
75+
'animationThreshold',
76+
'hover',
77+
'select',
78+
'region',
79+
'title',
80+
'layout',
81+
'legends',
82+
'tooltip',
83+
'player',
84+
'dataZoom',
85+
'scrollBar',
86+
'brush',
87+
'scales',
88+
'customMark',
89+
'theme',
90+
'background',
91+
'stackInverse',
92+
'stackSort',
93+
'media',
94+
'autoBandSize',
95+
'direction',
96+
'markLine',
97+
'markArea',
98+
'markPoint',
99+
'padding',
100+
'percent',
101+
'name',
102+
'id',
103+
'animation',
104+
'stack',
105+
'animationEnter',
106+
'animationUpdate',
107+
'animationExit',
108+
'dataIndex',
109+
'sampling',
110+
'animationState',
111+
'large',
112+
'largeThreshold',
113+
'progressiveStep',
114+
'progressiveThreshold',
115+
'support3d',
116+
'regionIndex',
117+
'regionId',
118+
'totalLabel',
119+
'animationAppear',
120+
'animationDisappear',
121+
'animationNormal',
122+
'xField',
123+
'yField',
124+
'label',
125+
'bar',
126+
'barBackground',
127+
'barWidth',
128+
'barMinWidth',
129+
'barMaxWidth',
130+
'barGapInGroup',
131+
'barMinHeight',
132+
'stackCornerRadius',
133+
'x2Field',
134+
'y2Field',
135+
'zField',
136+
'sortDataByAxis',
137+
'dataId',
138+
'dataKey',
139+
'seriesField',
140+
'stackOffsetSilhouette',
141+
'invalidType',
142+
'extensionMark',
143+
'interactions',
144+
'activePoint',
145+
'samplingFactor'
146+
];
63147
const vchartSpecAtom = new VChartSpec({ spec: baseSpec }, {});
64148
export function QARag() {
65149
const vchartInstance = React.useRef<any>(null);
@@ -290,6 +374,9 @@ export function QARag() {
290374
onOk={handleDownFeedback}
291375
confirmLoading={confirmLoading}
292376
onCancel={() => setFeedbackVisible(false)}
377+
style={{
378+
width: 650
379+
}}
293380
>
294381
<Form
295382
{...{
@@ -302,20 +389,26 @@ export function QARag() {
302389
}}
303390
form={form}
304391
labelCol={{
305-
style: { flexBasis: 150 }
392+
style: { flexBasis: 220 }
306393
}}
307394
wrapperCol={{
308-
style: { flexBasis: 'calc(100% - 160px)' }
395+
style: { flexBasis: 'calc(100% - 230px)' }
309396
}}
310397
>
311-
<FormItem label="Type" required field="wrongType" rules={[{ required: true }]}>
312-
<Select options={['DSL', 'VChart Render', 'Not sure']} />
398+
<FormItem label="哪里错了" required field="wrongType" rules={[{ required: true }]}>
399+
<Select
400+
options={[
401+
{ label: 'Only DSL', value: 'DSL' },
402+
{ label: 'Only VChart Render', value: 'VChart' },
403+
{ label: 'Not sure/Both', value: 'Not sure' }
404+
]}
405+
/>
313406
</FormItem>
314-
<FormItem label="TopKeyPath" field="topKeyAnswer" rules={[{ required: true }]}>
315-
<Input placeholder="" />
407+
<FormItem label="正确答案对应的topKey是什么" field="topKeyAnswer" rules={[{ required: true }]}>
408+
<Select options={topKeys} showSearch />
316409
</FormItem>
317-
<FormItem label="Answer DSL" field="keyPathAnswer">
318-
<Input placeholder="" />
410+
<FormItem label="正确的DSL是啥" field="keyPathAnswer">
411+
<TextArea placeholder={`{"label": {"visible": true}}`} />
319412
</FormItem>
320413
</Form>
321414
</Modal>
@@ -377,7 +470,7 @@ export function QARag() {
377470
</div>
378471
<div className="qa-div">
379472
<div className="title">Answer:</div>
380-
<span>{item.answer}</span>
473+
<span>{JSON.stringify(item.answer)}</span>
381474
</div>
382475
</Card>
383476
))}

0 commit comments

Comments
 (0)