From 04e9fc7315d2aab898f8cf6e8a8871729b3aade5 Mon Sep 17 00:00:00 2001 From: scarqin Date: Mon, 23 Dec 2024 14:09:53 +0800 Subject: [PATCH] feat: block --- .../core/src/pages/playground/index.tsx | 105 ++++++++++++------ 1 file changed, 73 insertions(+), 32 deletions(-) diff --git a/frontend/packages/core/src/pages/playground/index.tsx b/frontend/packages/core/src/pages/playground/index.tsx index 1fe7cc70..8542cbaf 100644 --- a/frontend/packages/core/src/pages/playground/index.tsx +++ b/frontend/packages/core/src/pages/playground/index.tsx @@ -15,11 +15,11 @@ interface ModelCardProps { } const ModelCard: React.FC = ({ title, status, defaultModel, onSettingClick }) => ( -
-
+
+
- {title} + {title}
= ({ title, status, defaultModel, onSe />
-
{defaultModel}
+
{defaultModel}
) @@ -43,15 +43,17 @@ interface KeyStatusCardProps { } const KeyStatusCard: React.FC = ({ keys, title }) => ( -
-
- {title} -
+
+
{title}
{keys.map((status, index) => (
))} @@ -60,10 +62,10 @@ const KeyStatusCard: React.FC = ({ keys, title }) => ( ) const ServiceCard: React.FC = () => ( -
-
+
+
- AI Service + AI Service
) @@ -71,67 +73,106 @@ const ServiceCard: React.FC = () => ( const initialNodes: Node[] = [ { id: 'service', - type: 'custom', + type: 'default', position: { x: 50, y: 100 }, - data: { component: } + data: { label: } }, { id: 'openai', - type: 'custom', + type: 'default', position: { x: 400, y: 50 }, data: { - component: + label: } }, { id: 'anthropic', - type: 'custom', + type: 'default', position: { x: 400, y: 200 }, data: { - component: + label: } }, { id: 'gemini', - type: 'custom', + type: 'default', position: { x: 400, y: 350 }, data: { - component: + label: } }, { id: 'openai-keys', - type: 'custom', + type: 'default', position: { x: 750, y: 50 }, data: { - component: + label: } }, { id: 'anthropic-keys', - type: 'custom', + type: 'default', position: { x: 750, y: 200 }, data: { - component: + label: } }, { id: 'gemini-keys', - type: 'custom', + type: 'default', position: { x: 750, y: 350 }, data: { - component: + label: } } ] const initialEdges: Edge[] = [ - { id: 'service-openai', source: 'service', target: 'openai', animated: true, label: 'Connected' }, - { id: 'service-anthropic', source: 'service', target: 'anthropic', animated: true, label: 'Connected' }, - { id: 'service-gemini', source: 'service', target: 'gemini', animated: true, label: 'Disconnected' }, - { id: 'openai-keys', source: 'openai', target: 'openai-keys', animated: true }, - { id: 'anthropic-keys', source: 'anthropic', target: 'anthropic-keys', animated: true }, - { id: 'gemini-keys', source: 'gemini', target: 'gemini-keys', animated: true } + { + id: 'service-openai', + source: 'service', + target: 'openai', + animated: true, + label: 'Connected', + style: { stroke: '#3d46f2' } + }, + { + id: 'service-anthropic', + source: 'service', + target: 'anthropic', + animated: true, + label: 'Connected', + style: { stroke: '#3d46f2' } + }, + { + id: 'service-gemini', + source: 'service', + target: 'gemini', + animated: true, + label: 'Disconnected', + style: { stroke: '#3d46f2' } + }, + { + id: 'openai-keys', + source: 'openai', + target: 'openai-keys', + animated: true, + style: { stroke: '#3d46f2' } + }, + { + id: 'anthropic-keys', + source: 'anthropic', + target: 'anthropic-keys', + animated: true, + style: { stroke: '#3d46f2' } + }, + { + id: 'gemini-keys', + source: 'gemini', + target: 'gemini-keys', + animated: true, + style: { stroke: '#3d46f2' } + } ] const Playground: React.FC = () => {