add ui for gemini built in tools

This commit is contained in:
Henry 2025-09-15 18:56:36 +01:00
parent bdcaad34b6
commit bf65936d22
2 changed files with 50 additions and 2 deletions

View File

@ -81,7 +81,7 @@ class Agent_Agentflow implements INode {
constructor() { constructor() {
this.label = 'Agent' this.label = 'Agent'
this.name = 'agentAgentflow' this.name = 'agentAgentflow'
this.version = 2.0 this.version = 2.1
this.type = 'Agent' this.type = 'Agent'
this.category = 'Agent Flows' this.category = 'Agent Flows'
this.description = 'Dynamically choose and utilize tools during runtime, enabling multi-step reasoning' this.description = 'Dynamically choose and utilize tools during runtime, enabling multi-step reasoning'

View File

@ -24,7 +24,8 @@ import {
IconAlertCircleFilled, IconAlertCircleFilled,
IconCode, IconCode,
IconWorldWww, IconWorldWww,
IconPhoto IconPhoto,
IconBrandGoogle
} from '@tabler/icons-react' } from '@tabler/icons-react'
import StopCircleIcon from '@mui/icons-material/StopCircle' import StopCircleIcon from '@mui/icons-material/StopCircle'
import CancelIcon from '@mui/icons-material/Cancel' import CancelIcon from '@mui/icons-material/Cancel'
@ -142,6 +143,17 @@ const AgentFlowNode = ({ data }) => {
} }
} }
const getBuiltInGeminiToolIcon = (toolName) => {
switch (toolName) {
case 'urlContext':
return <IconWorldWww size={14} color={'white'} />
case 'googleSearch':
return <IconBrandGoogle size={14} color={'white'} />
default:
return null
}
}
useEffect(() => { useEffect(() => {
if (ref.current) { if (ref.current) {
setTimeout(() => { setTimeout(() => {
@ -433,6 +445,16 @@ const AgentFlowNode = ({ data }) => {
: [], : [],
toolProperty: 'builtInTool', toolProperty: 'builtInTool',
isBuiltInOpenAI: true isBuiltInOpenAI: true
},
{
tools: data.inputs?.agentToolsBuiltInGemini
? (typeof data.inputs.agentToolsBuiltInGemini === 'string'
? JSON.parse(data.inputs.agentToolsBuiltInGemini)
: data.inputs.agentToolsBuiltInGemini
).map((tool) => ({ builtInTool: tool }))
: [],
toolProperty: 'builtInTool',
isBuiltInGemini: true
} }
] ]
@ -493,6 +515,32 @@ const AgentFlowNode = ({ data }) => {
] ]
} }
// Handle built-in Gemini tools with icons
if (config.isBuiltInGemini) {
const icon = getBuiltInGeminiToolIcon(toolName)
if (!icon) return []
return [
<Box
key={`tool-${configIndex}-${toolIndex}`}
sx={{
width: 20,
height: 20,
borderRadius: '50%',
backgroundColor: customization.isDarkMode
? darken(data.color, 0.5)
: darken(data.color, 0.2),
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
padding: 0.2
}}
>
{icon}
</Box>
]
}
return [ return [
<Box <Box
key={`tool-${configIndex}-${toolIndex}`} key={`tool-${configIndex}-${toolIndex}`}