mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-19 10:56:06 +00:00
feat(ui): list plugins
This commit is contained in:
@@ -43,15 +43,20 @@ const PluginInstalledComponent = forwardRef<PluginInstalledComponentRef>(
|
||||
setPluginList(
|
||||
value.plugins.map((plugin) => {
|
||||
return new PluginCardVO({
|
||||
author: plugin.author,
|
||||
description: i18nObj(plugin.description),
|
||||
author: plugin.manifest.manifest.metadata.author ?? '',
|
||||
description: i18nObj(
|
||||
plugin.manifest.manifest.metadata.description ?? {
|
||||
en_US: '',
|
||||
zh_Hans: '',
|
||||
},
|
||||
),
|
||||
enabled: plugin.enabled,
|
||||
name: plugin.name,
|
||||
version: plugin.version,
|
||||
name: plugin.manifest.manifest.metadata.name,
|
||||
version: plugin.manifest.manifest.metadata.version ?? '',
|
||||
status: plugin.status,
|
||||
tools: plugin.tools,
|
||||
event_handlers: plugin.event_handlers,
|
||||
repository: plugin.repository,
|
||||
tools: [],
|
||||
event_handlers: {},
|
||||
repository: plugin.manifest.manifest.metadata.repository ?? '',
|
||||
priority: plugin.priority,
|
||||
});
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { ApiRespPluginConfig, Plugin } from '@/app/infra/entities/api';
|
||||
import { ApiRespPluginConfig } from '@/app/infra/entities/api';
|
||||
import { Plugin } from '@/app/infra/entities/plugin';
|
||||
import { httpClient } from '@/app/infra/http/HttpClient';
|
||||
import DynamicFormComponent from '@/app/home/components/dynamic-form/DynamicFormComponent';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -183,13 +184,22 @@ export default function PluginForm({
|
||||
</Dialog>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="text-lg font-medium">{pluginInfo.name}</div>
|
||||
<div className="text-sm text-gray-500 pb-2">
|
||||
{i18nObj(pluginInfo.description)}
|
||||
<div className="text-lg font-medium">
|
||||
{i18nObj(pluginInfo.manifest.manifest.metadata.label)}
|
||||
</div>
|
||||
{pluginInfo.config_schema.length > 0 && (
|
||||
<div className="text-sm text-gray-500 pb-2">
|
||||
{i18nObj(
|
||||
pluginInfo.manifest.manifest.metadata.description ?? {
|
||||
en_US: '',
|
||||
zh_Hans: '',
|
||||
},
|
||||
)}
|
||||
</div>
|
||||
{/* @ts-ignore */}
|
||||
{pluginInfo.manifest.manifest.spec.config.length > 0 && (
|
||||
<DynamicFormComponent
|
||||
itemConfigList={pluginInfo.config_schema}
|
||||
// @ts-ignore
|
||||
itemConfigList={pluginInfo.manifest.manifest.spec.config}
|
||||
initialValues={pluginConfig.config as Record<string, object>}
|
||||
onSubmit={(values) => {
|
||||
let config = pluginConfig.config;
|
||||
@@ -203,7 +213,8 @@ export default function PluginForm({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{pluginInfo.config_schema.length === 0 && (
|
||||
{/* @ts-ignore */}
|
||||
{pluginInfo.manifest.manifest.spec.config.length === 0 && (
|
||||
<div className="text-sm text-gray-500">
|
||||
{t('plugins.pluginNoConfig')}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user