tool author (#5665)

* tool author

* doc

* doc
This commit is contained in:
Archer
2025-09-17 17:06:18 +08:00
committed by GitHub
parent 4333eb9caa
commit 235b50c07f
6 changed files with 43 additions and 11 deletions

View File

@@ -50,6 +50,8 @@ import type { LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
import { workflowStartNodeId } from '@/web/core/app/constants';
import ConfigToolModal from './ConfigToolModal';
import CostTooltip from '@/components/core/app/plugin/CostTooltip';
import { useSafeTranslation } from '@fastgpt/web/hooks/useSafeTranslation';
import { useSystemStore } from '@/web/common/system/useSystemStore';
type Props = {
selectedTools: FlowNodeTemplateType[];
@@ -222,8 +224,10 @@ const RenderList = React.memo(function RenderList({
type: TemplateTypeEnum;
setParentId: (parentId: ParentIdType) => any;
}) {
const { t, i18n } = useTranslation();
const lang = i18n.language as localeType;
const { i18n } = useTranslation();
const { t } = useSafeTranslation();
const { feConfigs } = useSystemStore();
const [configTool, setConfigTool] = useState<FlowNodeTemplateType>();
const onCloseConfigTool = useCallback(() => setConfigTool(undefined), []);
const { toast } = useToast();
@@ -424,7 +428,7 @@ const RenderList = React.memo(function RenderList({
key={template.id}
placement={'right'}
label={
<Box py={2}>
<Box py={2} minW={['auto', '250px']}>
<Flex alignItems={'center'}>
<MyAvatar
src={template.avatar}
@@ -432,9 +436,12 @@ const RenderList = React.memo(function RenderList({
objectFit={'contain'}
borderRadius={'sm'}
/>
<Box fontWeight={'bold'} ml={3} color={'myGray.900'}>
<Box fontWeight={'bold'} ml={3} color={'myGray.900'} flex={'1'}>
{t(template.name as any)}
</Box>
<Box color={'myGray.500'}>
By {template.author || feConfigs?.systemTitle}
</Box>
</Flex>
<Box mt={2} color={'myGray.500'} maxH={'100px'} overflow={'hidden'}>
{t(template.intro as any) || t('common:core.workflow.Not intro')}

View File

@@ -46,6 +46,8 @@ import { nodeTemplate2FlowNode } from '@/web/core/workflow/utils';
import { WorkflowEventContext } from '../../../context/workflowEventContext';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { parseI18nString } from '@fastgpt/global/common/i18n/utils';
import { useSafeTranslation } from '@fastgpt/web/hooks/useSafeTranslation';
import { useSystemStore } from '@/web/common/system/useSystemStore';
export type TemplateListProps = {
onAddNode: ({ newNodes }: { newNodes: Node<FlowNodeItemType>[] }) => void;
@@ -70,7 +72,9 @@ const NodeTemplateListItem = ({
isPopover?: boolean;
onUpdateParentId: (parentId: string) => void;
}) => {
const { t } = useTranslation();
const { t } = useSafeTranslation();
const { feConfigs } = useSystemStore();
const { screenToFlowPosition } = useReactFlow();
const handleParams = useContextSelector(WorkflowEventContext, (v) => v.handleParams);
const isToolHandle = handleParams?.handleId === 'selectedTools';
@@ -79,7 +83,7 @@ const NodeTemplateListItem = ({
<MyTooltip
placement={'right'}
label={
<Box py={2}>
<Box py={2} minW={['auto', '250px']}>
<Flex alignItems={'center'}>
<MyAvatar
src={template.avatar}
@@ -87,9 +91,10 @@ const NodeTemplateListItem = ({
objectFit={'contain'}
borderRadius={'sm'}
/>
<Box fontWeight={'bold'} ml={3} color={'myGray.900'}>
<Box fontWeight={'bold'} ml={3} color={'myGray.900'} flex={'1'}>
{template.name}
</Box>
<Box color={'myGray.500'}>By {template.author || feConfigs?.systemTitle}</Box>
</Flex>
<Box mt={2} color={'myGray.500'} maxH={'100px'} overflow={'hidden'}>
{template.intro || t('common:core.workflow.Not intro')}