MCPcopy Create free account
hub / github.com/NsLearning/LangHelper / SyncForm

Function SyncForm

ChatGPT/src/view/model/SyncCustom/Form.tsx:27–126  ·  view source on GitHub ↗
({ record, type }, ref)

Source from the content-addressed store, hash-verified

25};
26
27const SyncForm: ForwardRefRenderFunction<FormProps, SyncFormProps> = ({ record, type }, ref) => {
28 const isDisabled = type === 'edit';
29 const [form] = Form.useForm();
30 useImperativeHandle(ref, () => ({ form }));
31 const [root, setRoot] = useState('');
32
33 useInit(async () => {
34 setRoot(await chatRoot());
35 });
36
37 useEffect(() => {
38 if (record) {
39 form.setFieldsValue(record);
40 }
41 }, [record]);
42
43 const pathOptions = (
44 <Form.Item noStyle name="protocol" initialValue="https">
45 <Select disabled={isDisabled}>
46 <Select.Option value="local">{root}</Select.Option>
47 <Select.Option value="http">http://</Select.Option>
48 <Select.Option value="https">https://</Select.Option>
49 </Select>
50 </Form.Item>
51 );
52 const extOptions = (
53 <Form.Item noStyle name="ext" initialValue="json">
54 <Select disabled={isDisabled}>
55 <Select.Option value="csv">.csv</Select.Option>
56 <Select.Option value="json">.json</Select.Option>
57 </Select>
58 </Form.Item>
59 );
60
61 const jsonTip = (
62 <Tooltip
63 title={
64 <pre>
65 {JSON.stringify(
66 [
67 { cmd: '', act: '', prompt: '' },
68 { cmd: '', act: '', prompt: '' },
69 ],
70 null,
71 2,
72 )}
73 </pre>
74 }
75 >
76 <a>JSON</a>
77 </Tooltip>
78 );
79
80 const csvTip = (
81 <Tooltip
82 title={
83 <pre>{`"cmd","act","prompt"
84"cmd","act","prompt"

Callers

nothing calls this directly

Calls 2

chatRootFunction · 0.90
useInitFunction · 0.85

Tested by

no test coverage detected