chore: add icon for agent

This commit is contained in:
AkaraChen 2024-12-25 14:13:20 +08:00
parent 057da6c31b
commit e1d0c29711
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import type { ReactNode } from 'react'
import React from 'react' import React from 'react'
import { Variable02 } from '../icons/src/vender/solid/development' import { Variable02 } from '../icons/src/vender/solid/development'
import VerticalLine from './vertical-line' import VerticalLine from './vertical-line'
@ -5,19 +6,21 @@ import HorizontalLine from './horizontal-line'
type ListEmptyProps = { type ListEmptyProps = {
title?: string title?: string
description?: React.ReactNode description?: ReactNode
icon?: ReactNode
} }
const ListEmpty = ({ const ListEmpty = ({
title, title,
description, description,
icon,
}: ListEmptyProps) => { }: ListEmptyProps) => {
return ( return (
<div className='flex w-[320px] p-4 flex-col items-start gap-2 rounded-[10px] bg-workflow-process-bg'> <div className='flex w-[320px] p-4 flex-col items-start gap-2 rounded-[10px] bg-workflow-process-bg'>
<div className='flex w-10 h-10 justify-center items-center gap-2 rounded-[10px]'> <div className='flex w-10 h-10 justify-center items-center gap-2 rounded-[10px]'>
<div className='flex relative p-1 justify-center items-center gap-2 grow self-stretch rounded-[10px] <div className='flex relative p-1 justify-center items-center gap-2 grow self-stretch rounded-[10px]
border-[0.5px] border-components-card-border bg-components-card-bg shadow-lg'> border-[0.5px] border-components-card-border bg-components-card-bg shadow-lg'>
<Variable02 className='w-5 h-5 shrink-0 text-text-accent' /> {icon || <Variable02 className='w-5 h-5 shrink-0 text-text-accent' />}
<VerticalLine className='absolute -right-[1px] top-1/2 -translate-y-1/4'/> <VerticalLine className='absolute -right-[1px] top-1/2 -translate-y-1/4'/>
<VerticalLine className='absolute -left-[1px] top-1/2 -translate-y-1/4'/> <VerticalLine className='absolute -left-[1px] top-1/2 -translate-y-1/4'/>
<HorizontalLine className='absolute top-0 left-3/4 -translate-x-1/4 -translate-y-1/2'/> <HorizontalLine className='absolute top-0 left-3/4 -translate-x-1/4 -translate-y-1/2'/>

View File

@ -2,6 +2,7 @@ import type { FC } from 'react'
import { memo } from 'react' import { memo } from 'react'
import { BlockEnum } from './types' import { BlockEnum } from './types'
import { import {
Agent,
Answer, Answer,
Assigner, Assigner,
Code, Code,
@ -53,8 +54,7 @@ const getIcon = (type: BlockEnum, className: string) => {
[BlockEnum.ParameterExtractor]: <ParameterExtractor className={className} />, [BlockEnum.ParameterExtractor]: <ParameterExtractor className={className} />,
[BlockEnum.DocExtractor]: <DocsExtractor className={className} />, [BlockEnum.DocExtractor]: <DocsExtractor className={className} />,
[BlockEnum.ListFilter]: <ListFilter className={className} />, [BlockEnum.ListFilter]: <ListFilter className={className} />,
// TODO: add icon for Agent [BlockEnum.Agent]: <Agent className={className} />,
[BlockEnum.Agent]: <VariableX className={className} />,
}[type] }[type]
} }
const ICON_CONTAINER_BG_COLOR_MAP: Record<string, string> = { const ICON_CONTAINER_BG_COLOR_MAP: Record<string, string> = {

View File

@ -5,6 +5,7 @@ import { AgentStrategySelector } from './agent-strategy-selector'
import Link from 'next/link' import Link from 'next/link'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
import { Agent } from '@/app/components/base/icons/src/vender/workflow'
export type Strategy = { export type Strategy = {
agent_strategy_provider_name: string agent_strategy_provider_name: string
@ -39,8 +40,8 @@ export const AgentStrategy = (props: AgentStrategyProps) => {
fieldLabelClassName='uppercase' fieldLabelClassName='uppercase'
/> />
</div> </div>
// TODO: list empty need a icon
: <ListEmpty : <ListEmpty
icon={<Agent className='w-5 h-5 shrink-0 text-text-accent' />}
title={t('workflow.nodes.agent.strategy.configureTip')} title={t('workflow.nodes.agent.strategy.configureTip')}
description={<div className='text-text-tertiary text-xs'> description={<div className='text-text-tertiary text-xs'>
{t('workflow.nodes.agent.strategy.configureTipDesc')} <br /> {t('workflow.nodes.agent.strategy.configureTipDesc')} <br />