feat: can show schema tooltip

This commit is contained in:
Joel
2025-06-10 14:13:38 +08:00
parent 83c9ebbacc
commit 1c44fb77af
3 changed files with 21 additions and 6 deletions

View File

@ -80,7 +80,6 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
})()
const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey)
console.log(canChooseMCPTool)
return <div className='my-2'>
<Field
required

View File

@ -10,6 +10,8 @@ import { useLanguage } from '@/app/components/header/account-setting/model-provi
import Button from '@/app/components/base/button'
import Tooltip from '@/app/components/base/tooltip'
import FormInputItem from '@/app/components/workflow/nodes/_base/components/form-input-item'
import { useBoolean } from 'ahooks'
import SchemaModal from '@/app/components/plugins/plugin-detail-panel/tool-selector/schema-modal'
type Props = {
readOnly: boolean
@ -27,10 +29,13 @@ const ToolFormItem: FC<Props> = ({
onChange,
}) => {
const language = useLanguage()
const { label, type, required, tooltip } = schema
const { name, label, type, required, tooltip, input_schema } = schema
const showSchemaButton = type === FormTypeEnum.object || type === FormTypeEnum.array
const showDescription = type === FormTypeEnum.textInput || type === FormTypeEnum.secretInput
const [isShowSchema, {
setTrue: showSchema,
setFalse: hideSchema,
}] = useBoolean(false)
return (
<div className='space-y-0.5 py-1'>
<div>
@ -54,9 +59,7 @@ const ToolFormItem: FC<Props> = ({
<Button
variant='ghost'
size='small'
onClick={() => {
// onOpen?.(index)
}}
onClick={showSchema}
className='system-xs-regular px-1 text-text-tertiary'
>
<RiBracesLine className='mr-1 size-3.5' />
@ -76,6 +79,15 @@ const ToolFormItem: FC<Props> = ({
value={value}
onChange={onChange}
/>
{isShowSchema && (
<SchemaModal
isShow
onClose={hideSchema}
rootName={name}
schema={input_schema!}
/>
)}
</div>
)
}