Merge branch 'feat/plugins' into dev/plugin-deploy

This commit is contained in:
zxhlyh 2024-12-12 17:29:55 +08:00
commit 7727ec822a
10 changed files with 30 additions and 2 deletions

View File

@ -25,8 +25,8 @@ const PluginsNav = ({
rounded-xl system-sm-medium-uppercase ${activated rounded-xl system-sm-medium-uppercase ${activated
? 'border border-components-main-nav-nav-button-border bg-components-main-nav-nav-button-bg-active shadow-md text-components-main-nav-nav-button-text' ? 'border border-components-main-nav-nav-button-border bg-components-main-nav-nav-button-bg-active shadow-md text-components-main-nav-nav-button-text'
: 'text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'}`}> : 'text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary'}`}>
<div className='flex w-4 h-4 justify-center items-center'> <div className='flex mr-0.5 w-5 h-5 justify-center items-center'>
<Group /> <Group className='w-4 h-4' />
</div> </div>
<span className='px-0.5'>{t('common.menus.plugins')}</span> <span className='px-0.5'>{t('common.menus.plugins')}</span>
</div> </div>

View File

@ -20,6 +20,7 @@ export const tagKeys = [
export const categoryKeys = [ export const categoryKeys = [
'model', 'model',
'tool', 'tool',
'agent',
'extension', 'extension',
'bundle', 'bundle',
] ]

View File

@ -42,6 +42,12 @@ export const useCategories = (translateFromOut?: TFunction) => {
const t = translateFromOut || translation const t = translateFromOut || translation
const categories = categoryKeys.map((category) => { const categories = categoryKeys.map((category) => {
if (category === 'agent') {
return {
name: 'agent-strategy',
label: t(`plugin.category.${category}s`),
}
}
return { return {
name: category, name: category,
label: t(`plugin.category.${category}s`), label: t(`plugin.category.${category}s`),

View File

@ -28,6 +28,10 @@ const Description = async ({
<span className='relative z-[2] lowercase'>{t('category.tools')}</span> <span className='relative z-[2] lowercase'>{t('category.tools')}</span>
</span> </span>
, ,
<span className="relative ml-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected z-[1]">
<span className='relative z-[2] lowercase'>{t('category.agents')}</span>
</span>
,
<span className="relative ml-1 mr-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected z-[1]"> <span className="relative ml-1 mr-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected z-[1]">
<span className='relative z-[2] lowercase'>{t('category.extensions')}</span> <span className='relative z-[2] lowercase'>{t('category.extensions')}</span>
</span> </span>

View File

@ -4,6 +4,7 @@ import {
RiBrain2Line, RiBrain2Line,
RiHammerLine, RiHammerLine,
RiPuzzle2Line, RiPuzzle2Line,
RiUmbrellaLine,
} from '@remixicon/react' } from '@remixicon/react'
import { PluginType } from '../types' import { PluginType } from '../types'
import { useMarketplaceContext } from './context' import { useMarketplaceContext } from './context'
@ -14,6 +15,7 @@ export const PLUGIN_TYPE_SEARCH_MAP = {
all: 'all', all: 'all',
model: PluginType.model, model: PluginType.model,
tool: PluginType.tool, tool: PluginType.tool,
agent: PluginType.agent,
extension: PluginType.extension, extension: PluginType.extension,
bundle: 'bundle', bundle: 'bundle',
} }
@ -45,6 +47,11 @@ const PluginTypeSwitch = ({
text: t('plugin.category.tools'), text: t('plugin.category.tools'),
icon: <RiHammerLine className='mr-1.5 w-4 h-4' />, icon: <RiHammerLine className='mr-1.5 w-4 h-4' />,
}, },
{
value: PLUGIN_TYPE_SEARCH_MAP.agent,
text: t('plugin.category.agents'),
icon: <RiUmbrellaLine className='mr-1.5 w-4 h-4' />,
},
{ {
value: PLUGIN_TYPE_SEARCH_MAP.extension, value: PLUGIN_TYPE_SEARCH_MAP.extension,
text: t('plugin.category.extensions'), text: t('plugin.category.extensions'),

View File

@ -101,6 +101,9 @@ export const getMarketplaceListCondition = (pluginType: string) => {
if (pluginType === PluginType.tool) if (pluginType === PluginType.tool)
return 'category=tool' return 'category=tool'
if (pluginType === PluginType.agent)
return 'category=agent-strategy'
if (pluginType === PluginType.model) if (pluginType === PluginType.model)
return 'category=model' return 'category=model'

View File

@ -6,6 +6,7 @@ export enum PluginType {
tool = 'tool', tool = 'tool',
model = 'model', model = 'model',
extension = 'extension', extension = 'extension',
agent = 'agent-strategy',
} }
export enum PluginSource { export enum PluginSource {

View File

@ -70,6 +70,10 @@ const Marketplace = ({
{t('plugin.category.tools')} {t('plugin.category.tools')}
</span> </span>
, ,
<span className="relative ml-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected">
{t('plugin.category.agents')}
</span>
,
<span className="relative ml-1 mr-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected"> <span className="relative ml-1 mr-1 body-md-medium text-text-secondary after:content-[''] after:absolute after:left-0 after:bottom-[1.5px] after:w-full after:h-2 after:bg-text-text-selected">
{t('plugin.category.extensions')} {t('plugin.category.extensions')}
</span> </span>

View File

@ -3,6 +3,7 @@ const translation = {
all: 'All', all: 'All',
models: 'Models', models: 'Models',
tools: 'Tools', tools: 'Tools',
agents: 'Agent Strategy',
extensions: 'Extensions', extensions: 'Extensions',
bundles: 'Bundles', bundles: 'Bundles',
}, },

View File

@ -3,6 +3,7 @@ const translation = {
all: '全部', all: '全部',
models: '模型', models: '模型',
tools: '工具', tools: '工具',
agents: 'Agent Strategy',
extensions: '扩展', extensions: '扩展',
bundles: '插件集', bundles: '插件集',
}, },