mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
feat: update tooltips for better clarity
This commit is contained in:
@ -6,7 +6,9 @@ import { useUnmount } from 'ahooks'
|
||||
import * as React from 'react'
|
||||
import { useCallback, useMemo, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import Divider from '@/app/components/base/divider'
|
||||
import { useFeatures } from '@/app/components/base/features/hooks'
|
||||
import { JSON_SCHEMA_MAX_DEPTH } from '@/config'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import { ArrayType, Type } from '../../../../types'
|
||||
@ -61,6 +63,10 @@ const MAXIMUM_DEPTH_TYPE_OPTIONS = [
|
||||
{ value: ArrayType.file, text: 'array[file]' },
|
||||
]
|
||||
|
||||
const FILE_TYPES: Set<Type | ArrayType> = new Set([Type.file, ArrayType.file])
|
||||
|
||||
const filterFileTypes = (options: TypeItem[]) => options.filter(o => !FILE_TYPES.has(o.value))
|
||||
|
||||
const EditCard: FC<EditCardProps> = ({
|
||||
fields,
|
||||
depth,
|
||||
@ -77,11 +83,20 @@ const EditCard: FC<EditCardProps> = ({
|
||||
const { emit, useSubscribe } = useMittContext()
|
||||
const blurWithActions = useRef(false)
|
||||
|
||||
const isSandboxRuntime = useAppStore(s => s.appDetail?.runtime_type === 'sandboxed')
|
||||
const features = useFeatures(s => s.features)
|
||||
const isSupportSandbox = isSandboxRuntime || features.sandbox?.enabled === true
|
||||
|
||||
const maximumDepthReached = depth === JSON_SCHEMA_MAX_DEPTH
|
||||
const disableAddBtn = maximumDepthReached || (currentFields.type !== Type.object && currentFields.type !== ArrayType.object)
|
||||
const hasAdvancedOptions = currentFields.type === Type.string || currentFields.type === Type.number
|
||||
const isAdvancedEditing = advancedEditing || isAddingNewField
|
||||
|
||||
const typeOptions = useMemo(() => {
|
||||
const base = maximumDepthReached ? MAXIMUM_DEPTH_TYPE_OPTIONS : TYPE_OPTIONS
|
||||
return isSupportSandbox ? base : filterFileTypes(base)
|
||||
}, [maximumDepthReached, isSupportSandbox])
|
||||
|
||||
const advancedOptions = useMemo(() => {
|
||||
let enumValue = ''
|
||||
if (currentFields.type === Type.string || currentFields.type === Type.number)
|
||||
@ -234,7 +249,7 @@ const EditCard: FC<EditCardProps> = ({
|
||||
/>
|
||||
<TypeSelector
|
||||
currentValue={currentFields.type}
|
||||
items={maximumDepthReached ? MAXIMUM_DEPTH_TYPE_OPTIONS : TYPE_OPTIONS}
|
||||
items={typeOptions}
|
||||
onSelect={handleTypeChange}
|
||||
popupClassName="z-[1000]"
|
||||
/>
|
||||
|
||||
@ -53,7 +53,7 @@ const Tools = ({
|
||||
availableNodes={[]}
|
||||
value={tools}
|
||||
label={t('nodes.llm.tools.title', { ns: 'workflow' })}
|
||||
tooltip={t('nodes.llm.tools.title', { ns: 'workflow' })}
|
||||
tooltip={t('nodes.llm.tools.tooltip', { ns: 'workflow' })}
|
||||
onChange={handleToolsChange}
|
||||
supportCollapse
|
||||
disabled={isDisabled}
|
||||
|
||||
@ -848,6 +848,7 @@
|
||||
"nodes.llm.sysQueryInUser": "sys.query in user message is required",
|
||||
"nodes.llm.tools.disabledByStructuredOutput": "Tools are disabled when Structured Output is enabled.",
|
||||
"nodes.llm.tools.title": "Tools",
|
||||
"nodes.llm.tools.tooltip": "Enable the LLM to call external tools during execution. The model autonomously decides when and which tools to invoke based on context, and may iterate multiple times to refine results.",
|
||||
"nodes.llm.variables": "variables",
|
||||
"nodes.llm.vision": "vision",
|
||||
"nodes.loop.ErrorMethod.continueOnError": "Continue on Error",
|
||||
|
||||
@ -840,6 +840,7 @@
|
||||
"nodes.llm.singleRun.variable": "变量",
|
||||
"nodes.llm.sysQueryInUser": "user message 中必须包含 sys.query",
|
||||
"nodes.llm.tools.disabledByStructuredOutput": "启用结构化输出时,将禁用工具。",
|
||||
"nodes.llm.tools.tooltip": "允许 LLM 在执行过程中调用外部工具。模型会根据上下文自主决定何时调用哪些工具,并可多次迭代以优化结果。",
|
||||
"nodes.llm.variables": "变量",
|
||||
"nodes.llm.vision": "视觉",
|
||||
"nodes.loop.ErrorMethod.continueOnError": "忽略错误并继续",
|
||||
|
||||
Reference in New Issue
Block a user