fix: agent log
This commit is contained in:
parent
53bb1bb937
commit
98ad18ba81
@ -11,7 +11,7 @@ import Placeholder from './base/placeholder'
|
||||
import cn from '@/utils/classnames'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
import { getLanguage } from '@/i18n/language'
|
||||
import { useCategories } from '../hooks'
|
||||
import { useSingleCategories } from '../hooks'
|
||||
import { renderI18nObject } from '@/hooks/use-i18n'
|
||||
|
||||
export type Props = {
|
||||
@ -43,7 +43,7 @@ const Card = ({
|
||||
}: Props) => {
|
||||
const defaultLocale = useGetLanguage()
|
||||
const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale
|
||||
const { categoriesMap } = useCategories()
|
||||
const { categoriesMap } = useSingleCategories()
|
||||
const { category, type, name, org, label, brief, icon, verified } = payload
|
||||
const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent_strategy'].includes(type)
|
||||
const cornerMark = isBundle ? categoriesMap.bundle?.label : categoriesMap[category]?.label
|
||||
|
@ -64,3 +64,31 @@ export const useCategories = (translateFromOut?: TFunction) => {
|
||||
categoriesMap,
|
||||
}
|
||||
}
|
||||
|
||||
export const useSingleCategories = (translateFromOut?: TFunction) => {
|
||||
const { t: translation } = useTranslation()
|
||||
const t = translateFromOut || translation
|
||||
|
||||
const categories = categoryKeys.map((category) => {
|
||||
if (category === 'agent') {
|
||||
return {
|
||||
name: 'agent_strategy',
|
||||
label: t(`plugin.categorySingle.${category}`),
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: category,
|
||||
label: t(`plugin.categorySingle.${category}`),
|
||||
}
|
||||
})
|
||||
|
||||
const categoriesMap = categories.reduce((acc, category) => {
|
||||
acc[category.name] = category
|
||||
return acc
|
||||
}, {} as Record<string, Category>)
|
||||
|
||||
return {
|
||||
categories,
|
||||
categoriesMap,
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import cn from '@/utils/classnames'
|
||||
import { API_PREFIX, MARKETPLACE_URL_PREFIX } from '@/config'
|
||||
import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
|
||||
import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders } from '@/service/use-tools'
|
||||
import { useCategories } from '../hooks'
|
||||
import { useSingleCategories } from '../hooks'
|
||||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { useRenderI18nObject } from '@/hooks/use-i18n'
|
||||
|
||||
@ -36,7 +36,7 @@ const PluginItem: FC<Props> = ({
|
||||
plugin,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { categoriesMap } = useCategories()
|
||||
const { categoriesMap } = useSingleCategories()
|
||||
const currentPluginID = usePluginPageContext(v => v.currentPluginID)
|
||||
const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID)
|
||||
const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
|
||||
|
@ -30,26 +30,26 @@ const AgentLogItem = ({
|
||||
<div className='border-[0.5px] border-components-panel-border rounded-[10px]'>
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center pl-1.5 pt-2 pr-3 pb-2',
|
||||
'flex items-center pl-1.5 pt-2 pr-3 pb-2 cursor-pointer',
|
||||
expanded && 'pb-1',
|
||||
)}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
>
|
||||
{
|
||||
expanded
|
||||
? <RiArrowRightSLine className='shrink-0 w-4 h-4 rotate-90' />
|
||||
: <RiArrowRightSLine className='shrink-0 w-4 h-4' />
|
||||
? <RiArrowRightSLine className='shrink-0 w-4 h-4 rotate-90 text-text-quaternary' />
|
||||
: <RiArrowRightSLine className='shrink-0 w-4 h-4 text-text-quaternary' />
|
||||
}
|
||||
<div className='shrink-0 mr-1.5 w-5 h-5'></div>
|
||||
<div className='grow system-sm-semibold-uppercase text-text-secondary truncate'>{label}</div>
|
||||
<div className='shrink-0 mr-2 system-xs-regular text-text-tertiary'>0.02s</div>
|
||||
{/* <div className='shrink-0 mr-2 system-xs-regular text-text-tertiary'>0.02s</div> */}
|
||||
<NodeStatusIcon status={status} />
|
||||
</div>
|
||||
{
|
||||
expanded && (
|
||||
<div className='p-1 pt-0'>
|
||||
{
|
||||
!!children.length && (
|
||||
!!children?.length && (
|
||||
<Button
|
||||
className='flex items-center justify-between mb-1 w-full'
|
||||
variant='tertiary'
|
||||
|
@ -19,7 +19,9 @@ const AgentLogNav = ({
|
||||
className='shrink-0 px-[5px]'
|
||||
size='small'
|
||||
variant='ghost-accent'
|
||||
onClick={() => onShowAgentOrToolLog()}
|
||||
onClick={() => {
|
||||
onShowAgentOrToolLog()
|
||||
}}
|
||||
>
|
||||
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
||||
Agent
|
||||
@ -31,7 +33,6 @@ const AgentLogNav = ({
|
||||
variant='ghost-accent'
|
||||
onClick={() => {}}
|
||||
>
|
||||
<RiArrowLeftLine className='mr-1 w-3.5 h-3.5' />
|
||||
Agent strategy
|
||||
</Button>
|
||||
{
|
||||
|
@ -24,7 +24,9 @@ const AgentLogTrigger = ({
|
||||
<div className='grow mx-0.5 px-1 system-xs-medium text-text-secondary'></div>
|
||||
<div
|
||||
className='shrink-0 flex items-center px-[1px] system-xs-regular-uppercase text-text-tertiary cursor-pointer'
|
||||
onClick={() => onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)}
|
||||
onClick={() => {
|
||||
onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)
|
||||
}}
|
||||
>
|
||||
Detail
|
||||
<RiArrowRightLine className='ml-0.5 w-3.5 h-3.5' />
|
||||
|
@ -36,7 +36,10 @@ const SpecialResultPanel = ({
|
||||
handleShowAgentOrToolLog,
|
||||
}: SpecialResultPanelProps) => {
|
||||
return (
|
||||
<>
|
||||
<div onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.nativeEvent.stopImmediatePropagation()
|
||||
}}>
|
||||
{
|
||||
!!showRetryDetail && !!retryResultList?.length && setShowRetryDetailFalse && (
|
||||
<RetryResultPanel
|
||||
@ -63,7 +66,7 @@ const SpecialResultPanel = ({
|
||||
/>
|
||||
)
|
||||
}
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,13 @@ const TracingPanel: FC<TracingPanelProps> = ({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cn(className || 'bg-components-panel-bg', 'py-2')}>
|
||||
<div
|
||||
className={cn(className || 'bg-components-panel-bg', 'py-2')}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.nativeEvent.stopImmediatePropagation()
|
||||
}}
|
||||
>
|
||||
{treeNodes.map(renderNode)}
|
||||
</div>
|
||||
)
|
||||
|
@ -3,10 +3,17 @@ const translation = {
|
||||
all: 'All',
|
||||
models: 'Models',
|
||||
tools: 'Tools',
|
||||
agents: 'Agent Strategy',
|
||||
agents: 'Agent Strategies',
|
||||
extensions: 'Extensions',
|
||||
bundles: 'Bundles',
|
||||
},
|
||||
categorySingle: {
|
||||
model: 'Model',
|
||||
tool: 'Tool',
|
||||
agent: 'Agent Strategy',
|
||||
extension: 'Extension',
|
||||
bundle: 'Bundle',
|
||||
},
|
||||
search: 'Search',
|
||||
allCategories: 'All Categories',
|
||||
searchCategories: 'Search Categories',
|
||||
|
@ -7,6 +7,13 @@ const translation = {
|
||||
extensions: '扩展',
|
||||
bundles: '插件集',
|
||||
},
|
||||
categorySingle: {
|
||||
model: '模型',
|
||||
tool: '工具',
|
||||
agent: 'Agent 策略',
|
||||
extension: '扩展',
|
||||
bundle: '插件集',
|
||||
},
|
||||
search: '搜索',
|
||||
allCategories: '所有类别',
|
||||
searchCategories: '搜索类别',
|
||||
|
@ -365,7 +365,7 @@ export const usePluginTaskList = () => {
|
||||
queryKey: usePluginTaskListKey,
|
||||
queryFn: async () => {
|
||||
const currentData = await get<{ tasks: PluginTask[] }>('/workspaces/current/plugin/tasks?page=1&page_size=100')
|
||||
const taskDone = currentData.tasks.every(task => task.status === TaskStatus.success)
|
||||
const taskDone = currentData.tasks.every(task => task.status === TaskStatus.success || task.status === TaskStatus.failed)
|
||||
|
||||
if (taskDone)
|
||||
setEnabled(false)
|
||||
|
Loading…
Reference in New Issue
Block a user