Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const SessionDetailAndContainerLogOpenerLegacy = React.lazy(
const ChatPage = React.lazy(() => import('./pages/ChatPage'));

const AIAgentPage = React.lazy(() => import('./pages/AIAgentPage'));
const AIAgentIFramePage = React.lazy(() => import('./pages/AIAgentIFramePage'));

interface CustomHandle {
title?: string;
Expand Down Expand Up @@ -514,6 +515,15 @@ const router = createBrowserRouter([
);
},
},
{
path: '/ai-agent/external',
handle: { labelKey: 'webui.menu.AIAgents' },
Component: () => (
<Suspense fallback={<Skeleton active />}>
<AIAgentIFramePage />
</Suspense>
),
},
],
},
]);
Expand Down
3 changes: 2 additions & 1 deletion react/src/hooks/useAIAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface AIAgentMeta {
}

export interface AIAgentConfig {
system_prompt: string;
system_prompt?: string;
[key: string]: any; // for additionalProperties: true
}

Expand All @@ -26,6 +26,7 @@ export interface AIAgentParams {
}

export interface AIAgent {
type: string;
id: string;
endpoint: string;
endpoint_id: string;
Expand Down
31 changes: 31 additions & 0 deletions react/src/pages/AIAgentIFramePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Skeleton, theme } from 'antd';
import React, { Suspense } from 'react';
import { StringParam, useQueryParams } from 'use-query-params';

const AIAgentIFramePage: React.FC = () => {
const { token } = theme.useToken();
const [{ url }] = useQueryParams({
url: StringParam,
});

return (
<Suspense
fallback={<Skeleton active style={{ padding: token.paddingMD }} />}
>
{url && (
<iframe
src={url}
title="AI Agent Content"
style={{
width: '100%',
height: '100vh',
border: 'none',
borderRadius: token.borderRadius,
}}
/>
)}
</Suspense>
);
};

export default AIAgentIFramePage;
31 changes: 21 additions & 10 deletions react/src/pages/AIAgentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ const { Meta } = Card;
const AIAgentCard = ({ agent }: { agent: AIAgent }) => {
const tags = agent.meta.tags || [];
const { styles } = useStyles();
const avatar =
agent.type === 'external' ? (
<img
src={agent.meta.avatar}
alt={agent.meta.title}
height={150}
width={150}
style={{ borderRadius: '50%' }}
/>
) : (
<FluentEmojiIcon name={agent.meta.avatar} height={150} width={150} />
);

return (
<Card hoverable>
<Flex
Expand All @@ -45,13 +58,7 @@ const AIAgentCard = ({ agent }: { agent: AIAgent }) => {
>
<Meta
title={agent.meta.title}
avatar={
<FluentEmojiIcon
name={agent.meta.avatar}
height={150}
width={150}
/>
}
avatar={avatar}
description={agent.meta.descriptions}
className={styles.meta}
/>
Expand Down Expand Up @@ -113,9 +120,13 @@ const AIAgentPage: React.FC = () => {
<AIAgentCardList
agents={agents}
onClickAgent={(agent) => {
webuiNavigate(
`/chat?endpointId=${agent.endpoint_id}&agentId=${agent.id}`,
);
if (agent.type === 'external') {
webuiNavigate(`/ai-agent/external?url=${agent.config.url}`);
} else {
webuiNavigate(
`/chat?endpointId=${agent.endpoint_id}&agentId=${agent.id}`,
);
}
}}
/>
</Flex>
Expand Down
Binary file added resources/agents/3dgen_fluentstyle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/agents/key-extractor-fluentstyle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/agents/rag-fluentstyle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions resources/ai-agents.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "./ai-agents.schema.json",
"agents": [
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-97384d9a1d5b",
"meta": {
"title": "Lablup Customer Support Bot",
Expand All @@ -24,6 +25,55 @@
}
},
{
"type": "external",
"id": "d3b07384-d9a1-4d3b-9d3b-17384d9a1d5b",
"meta": {
"title": "3D Modeling Expert",
"avatar": "/resources/agents/3dgen_fluentstyle.png",
"background": "linear-gradient(135deg, #00416A 0%, #E4E5E6 100%)",
"descriptions": "Generating 3D objects from text or image input prompt.",
"tags": ["lablup", "backendai", "3d", "rendering"]
},
"endpoint": "hunyuan3d-2",
"endpoint_id": "",
"config": {
"url": "https://hunyuan3d.asia03.app.backend.ai/"
}
},
{
"type": "external",
"id": "d3b07384-d9a1-4d3b-9d3b-17384d9a1d5b",
"meta": {
"title": "Backend.AI Documentation Assistant",
"avatar": "/resources/agents/rag-fluentstyle.png",
"background": "linear-gradient(135deg, #00416A 0%, #E4E5E6 100%)",
"descriptions": "Helps users easily search and refer to Backend.AI documents using RAG.",
"tags": ["lablup", "backendai", "document", "customer-support"]
},
"endpoint": "agent_rag",
"endpoint_id": "",
"config": {
"url": "https://agent_rag.asia03.app.backend.ai/"
}
},
{
"type": "external",
"id": "d3b07384-d9a1-4d3b-9d3b-17384d9a1d5b",
"meta": {
"title": "Key Fact Extractor",
"avatar": "/resources/agents/key-extractor-fluentstyle.png",
"background": "linear-gradient(135deg, #00416A 0%, #E4E5E6 100%)",
"descriptions": "Helps summarization & key factor extraction from text input.",
"tags": ["lablup", "backendai", "extractor", "rag"]
},
"endpoint": "xaas_key",
"endpoint_id": "",
"config": {
"url": "https://xaas_key_extraction.asia03.app.backend.ai/"
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d3b",
"meta": {
"title": "General Assistant",
Expand All @@ -46,6 +96,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d4b",
"meta": {
"title": "Code Expert",
Expand All @@ -69,6 +120,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d5b",
"meta": {
"title": "Data Analyst",
Expand All @@ -91,6 +143,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d6b",
"meta": {
"title": "Creative Writer",
Expand All @@ -113,6 +166,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d7b",
"meta": {
"title": "Math Tutor",
Expand All @@ -135,6 +189,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d8b",
"meta": {
"title": "Research Assistant",
Expand All @@ -157,6 +212,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d9b",
"meta": {
"title": "Language Teacher",
Expand All @@ -179,6 +235,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d0a",
"meta": {
"title": "Business Consultant",
Expand All @@ -201,6 +258,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d1a",
"meta": {
"title": "Legal Assistant",
Expand All @@ -223,6 +281,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d2a",
"meta": {
"title": "UX Designer",
Expand All @@ -245,6 +304,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d3a",
"meta": {
"title": "Marketing Strategist",
Expand All @@ -267,6 +327,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d4a",
"meta": {
"title": "Science Educator",
Expand All @@ -289,6 +350,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d5a",
"meta": {
"title": "Project Manager",
Expand All @@ -311,6 +373,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d6a",
"meta": {
"title": "Financial Advisor",
Expand All @@ -333,6 +396,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d7a",
"meta": {
"title": "Health Coach",
Expand All @@ -355,6 +419,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d8a",
"meta": {
"title": "Technical Writer",
Expand All @@ -377,6 +442,7 @@
}
},
{
"type": "agent",
"id": "d3b07384-d9a1-4d3b-9d3b-07384d9a1d9a",
"meta": {
"title": "Career Coach",
Expand Down
12 changes: 10 additions & 2 deletions resources/ai-agents.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
"type": "array",
"items": {
"type": "object",
"required": ["config", "meta", "endpoint", "endpoint_id"],
"required": ["type", "config", "meta", "endpoint", "endpoint_id"],
"properties": {
"type": {
"type": "string",
"description": "The type of agent (e.g., 'llm', 'tool', 'external', etc.)"
},
"id": {
"type": "string",
"description": "The agent identifier"
Expand Down Expand Up @@ -55,11 +59,15 @@
},
"config": {
"type": "object",
"required": ["system_prompt"],
"required": [],
"properties": {
"system_prompt": {
"type": "string",
"description": "The system prompt for the agent"
},
"url": {
"type": "string",
"description": "The URL of the agent's API endpoint"
}
},
"additionalProperties": true
Expand Down