feat(plugin): allow open source to display non-SaaS plugins

This commit is contained in:
zengxiaohui
2025-10-16 15:10:09 +08:00
committed by junwen-lee
parent bf130b88eb
commit 8de62dbb78
5 changed files with 18 additions and 13 deletions

View File

@ -18,10 +18,10 @@
* Node source
*/
import { type FlowNodeEntity } from '@flowgram-adapter/free-layout-editor';
import { I18n } from '@coze-arch/i18n';
import { IconCozStore, IconCozTray } from '@coze-arch/coze-design/icons';
import { IconButton, Tooltip } from '@coze-arch/coze-design';
import { type FlowNodeEntity } from '@flowgram-adapter/free-layout-editor';
import { useNodeOrigin } from './use-node-origin';
@ -32,9 +32,9 @@ interface ReferenceNodeOriginProps {
export const ReferenceNodeOrigin: React.FC<ReferenceNodeOriginProps> = ({
node,
}) => {
const { isFromStore, isFromLibrary } = useNodeOrigin(node);
const { isFromStore, isFromLibrary, isFromCozeCnStore } = useNodeOrigin(node);
if (isFromStore) {
if (isFromStore || isFromCozeCnStore) {
return (
<Tooltip content={I18n.t('workflow_node_from_store')}>
<IconButton icon={<IconCozStore />} size="mini" color="secondary" />

View File

@ -50,11 +50,9 @@ export const useNodeOrigin = (node: FlowNodeEntity) => {
* 3. There is a shelf status
*/
const apiData = nodeData.getNodeData<StandardNodeType.Api>();
const isFromStore =
isApi &&
!isFromProject &&
(!!apiData.pluginProductStatus ||
apiData.plugin_from === PluginFrom.FromSaas);
const isFromStore = isApi && !isFromProject && !!apiData.pluginProductStatus;
const isFromCozeCnStore =
isApi && !isFromProject && apiData.plugin_from === PluginFrom.FromSaas;
/**
* Is it from the resource library?
@ -67,5 +65,6 @@ export const useNodeOrigin = (node: FlowNodeEntity) => {
isApi,
isFromStore,
isFromLibrary,
isFromCozeCnStore,
};
};

View File

@ -68,11 +68,6 @@ export const PluginLink = ({
return null;
}
// Open source plugins only display plugins from the SaaS platform
if (IS_OPEN_SOURCE && plugin_from !== PluginFrom.FromSaas) {
return null;
}
if (isLoading) {
return <IconCozLoading className="animate-spin text-xs coz-fg-dim" />;
}

View File

@ -25,6 +25,7 @@ import {
type WorkflowNodeJSON,
type WorkflowNodeRegistry,
} from '@coze-workflow/base';
import { PluginFrom } from '@coze-arch/bot-api/playground_api';
import { type WorkflowPlaygroundContext } from '@/workflow-playground-context';
import { type NodeTestMeta } from '@/test-run-kit';
@ -95,6 +96,14 @@ export const PLUGIN_NODE_REGISTRY: WorkflowNodeRegistry<NodeTestMeta> = {
getHeaderExtraOperation: (formValues: ApiNodeFormData) => {
const identifier = getApiNodeIdentifier(formValues?.inputs?.apiParam ?? []);
if (
IS_OPEN_SOURCE &&
formValues?.inputs?.pluginFrom !== PluginFrom.FromSaas
) {
return null;
}
return createPluginLink(identifier);
},

View File

@ -24,6 +24,7 @@ import {
type BatchDTO,
type ValueExpression,
} from '@coze-workflow/base';
import { type PluginFrom } from '@coze-arch/bot-api/playground_api';
import type { NodeMeta, SettingOnErrorDTO, SettingOnErrorVO } from '@/typing';
@ -39,6 +40,7 @@ export interface ApiNodeFormData {
inputParameters?: InputParametersMap;
batch?: BatchVO;
batchMode?: string;
pluginFrom?: PluginFrom;
settingOnError?: SettingOnErrorDTO;
};
outputs: ViewVariableMeta[];