18586361686
2025-05-22 3cc3e04ca406d2d00052d81036ad2f7d73b19d15
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
import React, { useEffect, useState } from 'react';
import {
    ClusterOutlined,
    DeleteOutlined,
    EditOutlined,
    EllipsisOutlined,
    MenuUnfoldOutlined,
    MinusCircleOutlined,
    PlusOutlined,
    QuestionCircleOutlined,
} from '@ant-design/icons';
import {
    Avatar,
    Button,
    Card,
    Col,
    Dropdown,
    Form,
    FormProps,
    Input,
    message,
    Modal,
    Pagination,
    Radio,
    Row,
    Select, SelectProps,
    Space,
    Spin,
    Tooltip,
} from 'antd';
import {useGetManual, usePostManual} from '../../../hooks/useApis.ts';
import SearchForm from '../../../components/AntdCrud/SearchForm.tsx';
import { ColumnsConfig } from '../../../components/AntdCrud';
import { useBreadcrumbRightEl } from '../../../hooks/useBreadcrumbRightEl.tsx';
import ImageUploader from '../../../components/ImageUploader';
import TextArea from 'antd/es/input/TextArea';
import {CheckboxGroupProps} from "antd/es/checkbox";
import {useNavigate} from "react-router-dom";
import './less/plugin.less'
 
interface Category {
    id: number;
    name: string;
}
const Plugin: React.FC = () => {
    const navigate = useNavigate();
 
    // 插件分页信息
    const [pagination, setPagination] = useState({
        current: 1,
        pageSize: 10,
        total: 0,
    });
 
    // 表格列配置
    const columnsConfig: ColumnsConfig<any> = [
        {
            hidden: true,
            form: { type: 'hidden' },
            dataIndex: 'id',
            key: 'id',
        },
        {
            title: 'Icon',
            dataIndex: 'icon',
            key: 'icon',
            form: { type: 'image' },
        },
        {
            form: { type: 'input', rules: [{ required: true, message: '请输入插件名称' }] },
            dataIndex: 'pluginName',
            title: '插件名称',
            key: 'pluginName',
            supportSearch: true,
            placeholder: '请输入插件名称',
        },
        {
            form: { type: 'TextArea', rules: [{ required: true, message: '请输入插件描述' }], attrs: { rows: 3 } },
            dataIndex: 'pluginDesc',
            title: '插件描述',
            key: 'pluginDesc',
        },
        {
            hidden: true,
            form: { type: 'hidden' },
            dataIndex: 'options',
            title: '插件配置',
            key: 'options',
        },
        {
            form: { type: 'select' },
            dataIndex: 'status',
            title: '数据状态',
            key: 'status',
            dict: { name: 'dataStatus' },
        },
    ];
 
    type FieldType = {
        id?: string;
        icon?: string;
        name?: string;
        description?: string;
        baseUrl?: string;
        headers?: string;
        authData?: string;
        authType?: string;
        position?: string;
        tokenKey?: string;
        tokenValue?: string;
    };
    // 设置面包屑右侧按钮
    useBreadcrumbRightEl(
        <Button type={'primary'} onClick={() => {
            setAddPluginIsOpen(true);
            setIsSaveOrUpdate(true);
        }}>
            <PlusOutlined /> 新增插件
        </Button>
    );
    // 处理表单提交
    const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
        if (isSaveOrUpdate) {
            doPostPluginSave({
                data: {
                    icon: values.icon,
                    name: values.name,
                    description: values.description,
                    baseUrl: values.baseUrl,
                    headers: JSON.stringify(values.headers),
                    authData: values.authData,
                    authType: values.authType,
                    position: values.position,
                    tokenKey: values.tokenKey,
                    tokenValue: values.tokenValue,
                },
            }).then((r) => {
                if (r.data.errorCode === 0) {
                    message.success('插件保存成功!');
                    form.resetFields();
                    setAddPluginIsOpen(false);
                    doSearchPlugins();
                }
            });
        } else {
            doPostPluginUpdate({
                data: {
                    id: values.id,
                    icon: values.icon,
                    name: values.name,
                    description: values.description,
                    baseUrl: values.baseUrl,
                    headers: JSON.stringify(values.headers),
                    authData: values.authData,
                    authType: values.authType,
                    position: values.position,
                    tokenKey: values.tokenKey,
                },
            }).then((r) => {
                if (r.data.errorCode === 0) {
                    message.success('修改成功!');
                    doSearchPlugins();
                    setAddPluginIsOpen(false);
                } else {
                    message.error(r.data.message);
                }
            });
        }
    };
 
    const options: CheckboxGroupProps<string>['options'] = [
        { label: 'headers', value: 'headers' },
        { label: 'query', value: 'query' },
    ];
 
    const onFinishFailed: FormProps<FieldType>['onFinishFailed'] = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };
 
    // 控制新增插件模态框的显示与隐藏
    const [addPluginIsOpen, setAddPluginIsOpen] = useState(false);
 
    // 认证类型
    const [authType, setAuthType] = useState('none');
 
    // 定义是新增还是修改 【true: 新增 false: 修改】
    const [isSaveOrUpdate, setIsSaveOrUpdate] = useState(true);
 
    // 图标路径
    const [iconPath, setIconPath] = useState('');
 
    // 认证参数位置
    const [positionValue, setPositionValue] = useState('headers');
 
    // 插件列表数据
    const [plugins, setPlugins] = useState<any[]>([]);
    const [loading, setLoading] = useState<boolean>(false);
 
    // 分类相关状态
    const [categories, setCategories] = useState<{ id: number; name: string }[]>([]);
    const [selectedCategoryId, setSelectedCategoryId] = useState<number | string | null>('0');
    const [categoryModalVisible, setCategoryModalVisible] = useState(false);
    const [newCategoryName, setNewCategoryName] = useState('');
// 归类相关状态
    const [classifyModalVisible, setClassifyModalVisible] = useState(false);
    const [selectedPluginId, setSelectedPluginId] = useState<number | null>(null);
    // 回显选中的分类
    const [selectedCategoryForClassify, setSelectedCategoryForClassify] = useState< SelectProps['options']>([]);
 
// 更新插件分类的方法
    const { doPost: doUpdatePluginCategory } = usePostManual('/api/v1/aiPluginCategoryRelation/updateRelation');
    // 获取插件数据
    // const { doGet: doGetPage } = usePage('aiPlugin', {}, { manual: true });
    const {doGet: doGetPage} = useGetManual('/api/v1/aiPlugin/pageByCategory')
 
    // 保存插件
    const { doPost: doPostPluginSave } = usePostManual('/api/v1/aiPlugin/plugin/save');
    // 修改插件
    const { doPost: doPostPluginUpdate } = usePostManual('/api/v1/aiPlugin/plugin/update');
    const { doPost: doRemove } = usePostManual('/api/v1/aiPlugin/plugin/remove');
 
    // 获取分类数据(假设有一个分类接口)
    const { doGet: doGetCategories } = useGetManual('/api/v1/aiPluginCategories/list');
 
    const { doPost: doSaveCategories } =usePostManual('/api/v1/aiPluginCategories/save')
 
    const {doGet: doGetPluginCategory} = useGetManual('/api/v1/aiPluginCategoryRelation/getPluginCategories')
 
 
    // 初始化加载插件和分类数据
    useEffect(() => {
        doSearchPlugins();
        fetchCategories();
    }, []);
 
    const fetchCategories = () => {
        doGetCategories().then((res) => {
            if (res.data.errorCode === 0) {
                setCategories([{id: '0', name: '全部'},  ...(res.data.data)] || []);
            }
        });
    };
 
    const doSearchPlugins = (params: any = {}) => {
        setLoading(true);
        doGetPage({
            params: {
                pageNumber: pagination.current,
                pageSize: pagination.pageSize,
                category: params.categoryId | 0,
                ...params,
            },
        }).then((r) => {
            if (r.data.errorCode === 0) {
                setPlugins(r.data.data.records);
                setPagination({
                    current: r.data.data.pageNumber,
                    pageSize: r.data.data.pageSize,
                    total: r.data.data.totalRow,
                });
            }
            setLoading(false);
        });
    };
 
    const handleSearch = (values: any) => {
        doSearchPlugins({ name: values.pluginName });
    };
 
    const getIconPath = (path: string) => {
        form.setFieldsValue({ icon: path });
    };
 
    // 创建表单实例
    const [form] = Form.useForm();
 
    const handleAddPluginCancel = () => {
        form.resetFields();
        setPositionValue('headers');
        setAuthType('none');
        setAddPluginIsOpen(false);
    };
 
    const handleAddPluginOk = () => {};
 
    // 点击分类
    const handleSelectCategory = (categoryId: number) => {
        console.log('点击分类', categoryId);
        setSelectedCategoryId(categoryId);
        doSearchPlugins({ categoryId });
    };
 
    // 打开新增分类模态框
    const openAddCategoryModal = () => {
        setCategoryModalVisible(true);
    };
 
    // 提交新增分类
    const addNewCategory = () => {
        if (!newCategoryName.trim()) {
            message.warning('请输入分类名称');
            return;
        }
 
        // 假设你有新增分类的接口
        // doPostAddCategory({ data: { name: newCategoryName } }).then(...)
 
        // 模拟添加本地分类
        const newCategory = {
            id: Date.now(),
            name: newCategoryName,
        };
        setCategories([...categories, newCategory]);
        setNewCategoryName('');
        setCategoryModalVisible(false);
        doSaveCategories({data:{name:newCategoryName}}).then((res)=>{
            if (res.data.errorCode === 0){
                message.success('分类添加成功');
                fetchCategories();
            }
 
        })
    };
    const handleClassifySubmit = () => {
        // if (!selectedPluginId || selectedCategoriesForClassify.length === 0) {
        //     message.warning('请至少选择一个分类');
        //     return;
        // }
        doUpdatePluginCategory({
            data: {
                pluginId: selectedPluginId,
                categoryIds: selectedCategoryForClassify // 注意这里是数组
            }
        }).then(res => {
            if (res.data.errorCode === 0) {
                message.success('分类更新成功');
                doSearchPlugins({categoryId: selectedCategoryId}); // 刷新插件列表
            } else {
                message.error(res.data.message || '分类更新失败');
            }
        });
 
        setClassifyModalVisible(false);
    };
    return (
        <div style={{ height: 'calc(100vh - 68px)', overflowY: 'auto', display: 'flex'}}>
            {/* 左侧分类导航 */}
            <div style={{ width: 240, paddingLeft: 8, paddingRight: 8, paddingTop: 16, borderRight: '1px solid #e8e8e8', backgroundColor: '#f8f9fa'}}>
                <div style={{ backgroundColor: "white", height: '100%'}}>
 
                <Button  block icon={<PlusOutlined />} onClick={openAddCategoryModal} style={{ marginBottom: 16 }}>
                    新增分类
                </Button>
 
                    <div style={{ maxHeight: '80vh', overflowY: 'auto' }}>
                        {categories.map((cat) => (
                            <div
                                key={cat.id}
                                className={`category-item ${selectedCategoryId === cat.id ? 'selected' : ''}`}
                                onClick={() => handleSelectCategory(cat.id)}
                            >
                                {cat.name}
                            </div>
                        ))}
                    </div>
 
                </div>
            </div>
 
            {/* 右侧插件内容 */}
            <div style={{ flex: 1}}>
                <SearchForm columns={columnsConfig} colSpan={6} onSearch={handleSearch} />
 
                <Row className={"card-row"} gutter={[16, 16]}>
                    {loading ? (
                        <div style={{  height: '100vh', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
                            <Spin />
                        </div>
 
                    ) : plugins.length > 0 ? (
                        plugins.map((item: any) => (
                            <Col span={6} key={item.id}>
                                <Card
                                    actions={[
                                        <MenuUnfoldOutlined title="工具列表" onClick={() => {
                                            navigate('/ai/pluginTool', {
                                                state: {
                                                    id: item.id,
                                                    pluginTitle: item.name,
                                                }
                                            });
                                        }} />,
                                        <EditOutlined key="edit" onClick={() => {
                                            setIsSaveOrUpdate(false);
                                            form.setFieldsValue({
                                                id: item.id,
                                                icon: item.icon,
                                                name: item.name,
                                                description: item.description,
                                                baseUrl: item.baseUrl,
                                                headers: item.headers ? JSON.parse(item.headers) : [],
                                                authData: item.authData,
                                                authType: item.authType,
                                                position: item.position,
                                                tokenKey: item.tokenKey,
                                                tokenValue: item.tokenValue,
                                            });
                                            setIconPath(item.icon);
                                            setAuthType(item.authType);
                                            setAddPluginIsOpen(true);
                                        }} />,
                                        <Dropdown menu={{
                                            items: [
                                                {
                                                key: 'delete',
                                                label: '删除',
                                                icon: <DeleteOutlined />,
                                                danger: true,
                                                onClick: () => {
                                                    Modal.confirm({
                                                        title: '确定要删除吗?',
                                                        content: '此操作不可逆,请谨慎操作。',
                                                        onOk() {
                                                            doRemove({ data: { id: item.id } }).then((r) => {
                                                                if (r.data.errorCode === 0) {
                                                                    message.success("删除成功!");
                                                                    doSearchPlugins();
                                                                } else {
                                                                    message.error(r.data.message);
                                                                }
                                                            });
                                                        },
                                                    });
                                                },
                                            },
                                                {
                                                    key: 'classify',
                                                    label: '归类',
                                                    icon: <ClusterOutlined/>,
                                                    onClick: () => {
                                                        setSelectedPluginId(item.id);
                                                        // 查询当前插件的分类
                                                        doGetPluginCategory({
                                                            params: {
                                                                pluginId: item.id
                                                            }
                                                        }).then((res) => {
                                                            if (res.data.errorCode === 0) {
                                                                const options = res.data.data.map((item: Category) => ({
                                                                    value: item.id,
                                                                    label: item.name
                                                                }));
                                                                setSelectedCategoryForClassify(options)
                                                                // setSelectedCategoryForClassify(item.categoryIds || [])
                                                                setClassifyModalVisible(true);
                                                            }
                                                        });
 
                                                    }
                                                }
                                            ],
                                        }}>
 
                                            <EllipsisOutlined key="ellipsis" title="更多操作" />
                                        </Dropdown>,
                                    ]}
                                    style={{ padding: 8 }}
                                >
                                    <Card.Meta
                                        avatar={<Avatar src={item.icon || "/favicon.png"} />}
                                        title={item.name}
                                        description={
                                            <Tooltip title={item.description}>
                                                <div style={{
                                                    display: '-webkit-box',
                                                    WebkitLineClamp: 1,
                                                    WebkitBoxOrient: 'vertical',
                                                    overflow: 'hidden',
                                                    textOverflow: 'ellipsis',
                                                }}>{item.description}</div>
                                            </Tooltip>
                                        }
                                    />
                                </Card>
                            </Col>
                        ))
                    ) : (
                        <div style={{ textAlign: 'center', width: '100%' }}>暂无插件</div>
                    )}
                </Row>
 
                <Pagination
                    total={pagination.total}
                    align="end"
                    showTotal={(total) => `共 ${total} 条数据`}
                    onChange={(page, pageSize) => {
                        setPagination({ ...pagination, current: page, pageSize });
                        doSearchPlugins({ pageNumber: page, pageSize });
                    }}
                    showSizeChanger={true}
                    pageSizeOptions={[10, 20, 30, 40, 50]}
                    defaultCurrent={1}
                    defaultPageSize={10}
                />
            </div>
 
            {/* 新增插件模态框 */}
            <Modal
                title="新增插件"
                open={addPluginIsOpen}
                onOk={handleAddPluginOk}
                onCancel={handleAddPluginCancel}
                footer={null}
            >
                <Form
                    form={form}
                    layout="vertical"
                    name="basic"
                    style={{ width: '100%' }}
                    initialValues={{ authType: 'none', position: 'headers' }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    autoComplete="off"
                >
                    {/* 表单项... 和原文件一致,省略以保持简洁 */}
                    {/* 此处可以复用你原来的表单结构 */}
                    <Form.Item<FieldType> name="id" hidden></Form.Item>
                    <Form.Item<FieldType> name="icon" style={{ textAlign: 'center' }}>
                        <div style={{ display: 'flex', justifyContent: 'center' }}>
                            <Input hidden />
                            <ImageUploader onChange={getIconPath} value={iconPath} />
                        </div>
                    </Form.Item>
                    <Form.Item<FieldType>
                        label="插件名称"
                        name="name"
                        rules={[{ required: true, message: '请输入插件名称!' }]}
                    >
                        <Input maxLength={30} showCount placeholder={'请输入插件名称'} />
                    </Form.Item>
                    <Form.Item<FieldType>
                        label="插件描述"
                        name="description"
                        rules={[{ required: true, message: '请输入插件描述!' }]}
                    >
                        <TextArea showCount maxLength={500} placeholder="请输入插件描述" style={{ height: 80, resize: 'none' }} />
                    </Form.Item>
                    <Form.Item<FieldType>
                        name="baseUrl"
                        label={'插件 URL'}
                        rules={[{ required: true, message: '请输入插件URL' }]}
                    >
                        <Input placeholder="请输入插件 URL" />
                    </Form.Item>
                    <Form.Item<FieldType> name="headers" label={'Headers'}>
                        <Form.List name="headers">
                            {(fields, { add, remove }) => (
                                <>
                                    {fields.map(({ key, name, ...restField }) => (
                                        <Space key={key} style={{ display: 'flex', marginBottom: 8 }} align="baseline">
                                            <Form.Item {...restField} name={[name, 'label']} rules={[{ required: true, message: 'Missing label' }]}>
                                                <Input placeholder="Headers Name" />
                                            </Form.Item>
                                            <Form.Item {...restField} name={[name, 'value']} rules={[{ required: true, message: 'Missing value' }]}>
                                                <Input placeholder="Headers value" />
                                            </Form.Item>
                                            <MinusCircleOutlined onClick={() => remove(name)} />
                                        </Space>
                                    ))}
                                    <Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
                                        添加 headers
                                    </Button>
                                </>
                            )}
                        </Form.List>
                    </Form.Item>
                    <Form.Item<FieldType>
                        label={
                            <span>
                认证方式
                <Tooltip title="选择插件使用的授权或验证方式。目前支持如下两种类型:\n1. 无需认证\n2. Service token / API key">
                  <QuestionCircleOutlined style={{ marginLeft: 8, color: 'rgba(0,0,0,.45)' }} />
                </Tooltip>
              </span>
                        }
                        name="authType"
                        rules={[{ required: true, message: '请选择认证方式!' }]}
                    >
                        <Select
                            onChange={(value) => {
                                setAuthType(value);
                            }}
                            options={[
                                { value: 'none', label: '无需认证' },
                                { value: 'apiKey', label: 'Service token / API key' },
                            ]}
                        />
                    </Form.Item>
                    {authType === 'apiKey' && (
                        <>
                            <Form.Item<FieldType>
                                name="position"
                                label={'参数位置'}
                                rules={[{ required: true, message: '请输入认证数据' }]}
                            >
                                <Radio.Group options={options} value={positionValue} onChange={(e) => setPositionValue(e.target.value)} />
                            </Form.Item>
                            <Form.Item<FieldType>
                                label="tokenKey"
                                name="tokenKey"
                                rules={[{ required: true, message: '请输入tokenKey!' }]}
                            >
                                <Input maxLength={500} showCount />
                            </Form.Item>
                            <Form.Item<FieldType>
                                label="tokenValue"
                                name="tokenValue"
                                rules={[{ required: true, message: '请输入tokenValue' }]}
                            >
                                <Input maxLength={2000} showCount />
                            </Form.Item>
                        </>
                    )}
                    <Form.Item label={null}>
                        <Space style={{ display: 'flex', justifyContent: 'flex-end' }}>
                            <Button onClick={handleAddPluginCancel}>取消</Button>
                            <Button type="primary" htmlType="submit" style={{ marginRight: 8 }}>
                                确定
                            </Button>
                        </Space>
                    </Form.Item>
                </Form>
            </Modal>
 
            {/* 新增分类模态框 */}
            <Modal
                title="新增分类"
                open={categoryModalVisible}
                onOk={addNewCategory}
                onCancel={() => setCategoryModalVisible(false)}
            >
 
                <Input
                    placeholder="请输入分类名称"
                    value={newCategoryName}
                    onChange={(e) => setNewCategoryName(e.target.value)}
                />
            </Modal>
 
            {/* 插件归类模态框 */}
            <Modal
                title="选择分类"
                open={classifyModalVisible}
                onOk={handleClassifySubmit}
                onCancel={() => setClassifyModalVisible(false)}
                destroyOnClose
            >
                <Form layout="vertical">
                    <Form.Item label="请选择分类">
                        <Select
                            mode="tags"
                            value={selectedCategoryForClassify}
                            onChange={(values) => setSelectedCategoryForClassify(values)}
                            placeholder="请选择分类"
                            style={{ width: '100%' }}
                        >
                            {categories
                                .filter((cat) => cat.name !== '全部') // 过滤掉 name 为 '全部' 的分类
                                .map((cat) => (
                                    <Select.Option key={cat.id} value={cat.id}>
                                        {cat.name}
                                    </Select.Option>
                                ))}
                        </Select>
                    </Form.Item>
                </Form>
            </Modal>
        </div>
    );
};
 
export default {
    path: "/ai/plugin",
    element: Plugin
};