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

@ -1,3 +1,5 @@
import type { SchemaRoot } from '@/app/components/workflow/nodes/llm/types'
export type FormValue = Record<string, any>
export type TypeWithI18N<T = string> = {
@ -109,6 +111,7 @@ export type FormShowOnObject = {
}
export type CredentialFormSchemaBase = {
name: string
variable: string
label: TypeWithI18N
type: FormTypeEnum
@ -118,6 +121,7 @@ export type CredentialFormSchemaBase = {
show_on: FormShowOnObject[]
url?: string
scope?: string
input_schema?: SchemaRoot
}
export type CredentialFormSchemaTextInput = CredentialFormSchemaBase & {

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>
)
}