feat: no tooltip shown on custom node

This commit is contained in:
laansdole 2026-02-10 15:44:49 +07:00
parent 1dad0197cd
commit 8119391cd5
2 changed files with 51 additions and 12 deletions

View File

@ -87,7 +87,7 @@ onUnmounted(() => {
</script>
<template>
<RichTooltip :content="nodeHelpContent" placement="top">
<RichTooltip v-if="nodeHelpContent" :content="nodeHelpContent" placement="top">
<div class="workflow-node-container">
<div v-if="props.sprite" class="workflow-node-sprite">
<img :src="currentSprite" :alt="`${nodeId} sprite`" class="node-sprite-image" />
@ -123,6 +123,40 @@ onUnmounted(() => {
</div>
</div>
</RichTooltip>
<div v-else class="workflow-node-container">
<div v-if="props.sprite" class="workflow-node-sprite">
<img :src="currentSprite" :alt="`${nodeId} sprite`" class="node-sprite-image" />
</div>
<div
class="workflow-node"
:class="{ 'workflow-node-active': isActive }"
:data-type="nodeType"
:style="dynamicStyles"
@mouseenter="$emit('hover', nodeId)"
@mouseleave="$emit('leave', nodeId)"
>
<div class="workflow-node-header">
<span class="workflow-node-type">{{ nodeType }}</span>
<span class="workflow-node-id">{{ nodeId }}</span>
</div>
<div v-if="nodeDescription" class="workflow-node-description">
{{ nodeDescription }}
</div>
<Handle
id="source"
type="source"
:position="Position.Right"
class="workflow-node-handle"
/>
<Handle
id="target"
type="target"
:position="Position.Left"
class="workflow-node-handle"
/>
</div>
</div>
</template>
<style scoped>

View File

@ -34,7 +34,7 @@ export const helpContent = {
},
python: {
title: "Python Node",
description: "Executes Python code in a sandboxed environment. The code runs in the workspace directory and can access uploaded files.",
description: "Executes Python code on your local environment. The code runs in the workspace directory and can access uploaded files.",
examples: [
"Data processing and analysis",
"Running generated code",
@ -160,7 +160,7 @@ export const helpContent = {
/**
* Get help content by key path
* @param {string} key - Dot-separated path to content (e.g., 'workflowNode.agent')
* @returns {Object} Help content object or fallback
* @returns {Object|null} Help content object or null if not found
*/
export function getHelpContent(key) {
const keys = key.split('.')
@ -170,11 +170,8 @@ export function getHelpContent(key) {
if (content && typeof content === 'object' && k in content) {
content = content[k]
} else {
console.warn(`[HelpContent] Missing content for key: ${key}`)
return {
description: "Help content coming soon. Check the tutorial for more information.",
learnMoreUrl: "/tutorial"
}
// Return null for missing content instead of fallback
return null
}
}
@ -183,17 +180,25 @@ export function getHelpContent(key) {
return { description: content }
}
return content || { description: "Help content coming soon." }
return content || null
}
/**
* Get node-specific help content based on node type
* @param {string} nodeType - The type of node (agent, human, python, etc.)
* @returns {Object} Help content for that node type
* @returns {Object|null} Help content for that node type, or null for unknown types
*/
export function getNodeHelp(nodeType) {
const type = (nodeType || 'unknown').toLowerCase()
return getHelpContent(`workflowNode.${type}`)
if (!nodeType) {
return null
}
const type = nodeType.toLowerCase()
const content = getHelpContent(`workflowNode.${type}`)
// Return null for unknown types (when content lookup fails)
// This prevents showing tooltips for custom/user-defined node types
return content
}
/**