|
1 | 1 | import React, { useEffect } from "react";
|
2 |
| -import { Card, Flex, Button, Box, Table, Modal, TextInput, Text, Highlight, LoadingOverlay, Select, Textarea, Code, Loader, Badge } from '@mantine/core'; |
| 2 | +import { Group, Card, Flex, Button, Box, Table, Modal, TextInput, Text, Highlight, LoadingOverlay, Select, Textarea, Code, Loader, Badge, Radio } from '@mantine/core'; |
3 | 3 | import { useForm } from '@mantine/form';
|
4 | 4 | import { modals } from '@mantine/modals';
|
5 | 5 | import { notifications } from '@mantine/notifications';
|
@@ -78,12 +78,28 @@ function AddOrUpdate() {
|
78 | 78 | data={functionList}
|
79 | 79 | {...form.getInputProps('name')}
|
80 | 80 | />
|
81 |
| - <TextInput label="名称" placeholder="工具名" {...form.getInputProps('alias')} /> |
82 |
| - <Textarea withAsterisk label="描述" placeholder="输入工具描述" {...form.getInputProps('description')} description={<div><span >参考示例:</span><CopyToClipboard value={"文生图是一个AI绘画(图像生成)服务,输入文本描述,返回根据文本作画得到的图片的URL"} content={"文生图是一个AI绘画(图像生成)服务,输入文本描述,返回根据文本作画得到的图片的URL"} position={"none"} /> </div>} /> |
83 |
| - <Textarea withAsterisk label="输入参数" placeholder="输入参数" {...form.getInputProps('input_schema')} description={<div><span >参考示例:</span><CopyToClipboard value={"[ { 'name': 'prompt', 'description': '英文关键词,描述了希望图像具有什么内容', 'required': True, 'schema': {'type': 'string'}, } ]"} content={"[ { 'name': 'prompt', 'description': '英文关键词,描述了希望图像具有什么内容', 'required': True, 'schema': {'type': 'string'}, } ]"} position={"none"} /> </div>} /> |
84 |
| - <Textarea label="输出参数" placeholder="输入参数" {...form.getInputProps('output_schema')} /> |
85 |
| - |
86 |
| - <TextInput label="作者" placeholder="请输入作者" {...form.getInputProps('author')} /> |
| 81 | + <TextInput mt={4} label="名称" placeholder="工具名" {...form.getInputProps('alias')} /> |
| 82 | + <Textarea mt={4} withAsterisk label="描述" placeholder="输入工具描述" {...form.getInputProps('description')} description={<div><span >参考示例:</span><CopyToClipboard value={"文生图是一个AI绘画(图像生成)服务,输入文本描述,返回根据文本作画得到的图片的URL"} content={"文生图是一个AI绘画(图像生成)服务,输入文本描述,返回根据文本作画得到的图片的URL"} position={"none"} /> </div>} /> |
| 83 | + <Textarea mt={4} withAsterisk label="输入参数" placeholder="输入参数" {...form.getInputProps('input_schema')} description={<div><span >参考示例:</span><CopyToClipboard value={"[ { 'name': 'prompt', 'description': '英文关键词,描述了希望图像具有什么内容', 'required': True, 'schema': {'type': 'string'}, } ]"} content={"[ { 'name': 'prompt', 'description': '英文关键词,描述了希望图像具有什么内容', 'required': True, 'schema': {'type': 'string'}, } ]"} position={"none"} /> </div>} /> |
| 84 | + <Textarea mt={4} label="输出参数" placeholder="输入参数" {...form.getInputProps('output_schema')} /> |
| 85 | + <Radio.Group |
| 86 | + mt={4} |
| 87 | + withAsterisk |
| 88 | + name="need_llm_call" |
| 89 | + value={form.getInputProps('need_llm_call') ?.value as any} |
| 90 | + label="工具执行结果反馈与否" |
| 91 | + description="如果选择否,智能体调用完工具会直接返回" |
| 92 | + onChange={(value:any) => { |
| 93 | + const _value = parseInt(value, 10); |
| 94 | + form.setFieldValue('need_llm_call', _value); |
| 95 | + }} |
| 96 | + > |
| 97 | + <Group mt={4}> |
| 98 | + <Radio value={1} label="是" /> |
| 99 | + <Radio value={2} label="否" /> |
| 100 | + </Group> |
| 101 | + </Radio.Group> |
| 102 | + <TextInput mt={8} label="作者" placeholder="请输入作者" {...form.getInputProps('author')} /> |
87 | 103 | </Box>
|
88 | 104 | <Box mx="auto" pt={12} style={{ textAlign: 'right' }}>
|
89 | 105 | <Button onClick={async () => {
|
@@ -153,6 +169,7 @@ export function ChooseModal() {
|
153 | 169 | output_schema: '',
|
154 | 170 | author: '',
|
155 | 171 | proxy_url: '',
|
| 172 | + need_llm_call: 1, |
156 | 173 | });
|
157 | 174 | if (data) {
|
158 | 175 | await getToolList();
|
|
0 commit comments