From 1daf06fb8e1a3d6425df526c9174f2b53e114d1c Mon Sep 17 00:00:00 2001 From: Gabe Hamilton Date: Fri, 19 Apr 2024 14:42:06 -0600 Subject: [PATCH 1/3] Updated paths for starring agents --- nexus/components/src/AI/Agent/AgentCard.jsx | 68 +++++++++++++++++++ .../components/src/AI/Agent/AgentDetails.jsx | 3 +- .../components/src/AI/Agent/AgentSummary.jsx | 8 +-- 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/nexus/components/src/AI/Agent/AgentCard.jsx b/nexus/components/src/AI/Agent/AgentCard.jsx index 66ce7b2..be6a97e 100644 --- a/nexus/components/src/AI/Agent/AgentCard.jsx +++ b/nexus/components/src/AI/Agent/AgentCard.jsx @@ -64,6 +64,45 @@ const Actions = styled.div` align-items: center; gap: 2px; `; +const sharedButtonStyles = ` + display: inline-flex; + align-items: center; + gap: 8px; + padding: 8px 8px; + height: 32px; + border-radius: 50px; + font-weight: 600; + font-size: 12px; + line-height: 15px; + text-align: center; + cursor: pointer; + + &:hover, + &:focus { + text-decoration: none; + outline: none; + } + + i { + color: #7E868C; + } + + .bi-16 { + font-size: 16px; + } +`; +const Button = styled.button` + ${sharedButtonStyles} + color: ${(p) => (p.primary ? "#09342E" : "#11181C")} !important; + background: ${(p) => (p.primary ? "#59E692" : "#FBFCFD")}; + border: ${(p) => "none"}; + + &:hover, + &:focus { + background: ${(p) => (p.primary ? "rgb(112 242 164)" : "#ECEDEE")}; + } +`; + const AgentCard = ({ item, editFunction }) => { const { accountId, name, displayName, prompt, logoUrl, tags } = item; const agentComponent = item.component @@ -145,6 +184,35 @@ const AgentCard = ({ item, editFunction }) => { ), }} /> + ( + + ), + }} + />{" "} { @@ -37,6 +37,7 @@ return ( tab, schemaFile, namespace, + entityType, summaryComponent, additionalTabs, returnTo, diff --git a/nexus/components/src/AI/Agent/AgentSummary.jsx b/nexus/components/src/AI/Agent/AgentSummary.jsx index c6fa4d8..de3bae4 100644 --- a/nexus/components/src/AI/Agent/AgentSummary.jsx +++ b/nexus/components/src/AI/Agent/AgentSummary.jsx @@ -4,7 +4,7 @@ if (!href) { return <>; } -const { entity, showActions } = props; +const { entity, showActions, namespace, entityType } = props; const { accountId, name, displayName, prompt, logoUrl, tags, component } = entity; @@ -229,14 +229,14 @@ return ( actionUndoName: "unstar", item: { type: "social", - path: `${accountId}/agent/${name}`, + path: `${accountId}/entities/${namespace}/${entityType}/${name}`, }, notifyAccountId: accountId, button: (starCount, starIsActive, starOnClick) => ( ), }} From b2b012cd5642c668f037c3eb399f9f7eacd17305 Mon Sep 17 00:00:00 2001 From: Gabe Hamilton Date: Fri, 19 Apr 2024 16:40:38 -0600 Subject: [PATCH 2/3] Nexus Schema values match entityTypes --- nexus/components/src/AI/Schema/Nexus.jsx | 42 ++++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/nexus/components/src/AI/Schema/Nexus.jsx b/nexus/components/src/AI/Schema/Nexus.jsx index 7d504c5..f93386a 100644 --- a/nexus/components/src/AI/Schema/Nexus.jsx +++ b/nexus/components/src/AI/Schema/Nexus.jsx @@ -21,11 +21,11 @@ const schema = { datasets: { title: "Datasets", icon: "ph ph-list-checks", - defaultValue: "alignment", + defaultValue: "alignmentDataset", items: [ { name: "Crowdsourcing", - value: "crowdsourcing", + value: "crowdsourcedDataset", content: ( ), @@ -174,7 +174,7 @@ const schema = { }, { name: "Frameworks", - value: "frameworks", + value: "agentFramework", content: ( @@ -219,11 +219,11 @@ const schema = { agentTools: { title: "Tools for Agents", icon: "ph ph-list-checks", - defaultValue: "contracts", + defaultValue: "contractTool", items: [ { name: "On-chain Contracts", - value: "contracts", + value: "contractTool", content: ( Date: Fri, 19 Apr 2024 16:41:17 -0600 Subject: [PATCH 3/3] TagCloud with global filtering --- nexus/components/src/AI/Nexus.jsx | 49 ++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/nexus/components/src/AI/Nexus.jsx b/nexus/components/src/AI/Nexus.jsx index 0509744..112beee 100644 --- a/nexus/components/src/AI/Nexus.jsx +++ b/nexus/components/src/AI/Nexus.jsx @@ -30,9 +30,12 @@ useEffect(() => { const [activeTabs, setActiveTabs] = useState( storedTabs || { - datasets: "alignment", - models: "providers", - agents: "agents", + datasets: "alignmentDataset", + models: "modelProvider", + agents: "agent", + agentTools: "contractTool", + dataSources: "dataSource", + verifications: "dataReputation", }, ); @@ -52,6 +55,8 @@ if (!paramsHandled && props.group && props.group !== activeGroup) { } } +const [globalTagFilter, setGlobalTagFilter] = useState(null); + const content = { overview: () => { return ( @@ -98,7 +103,11 @@ const renderContent = () => { case "dashboard": return content.dashboard(); default: - return content.subGroups(activeGroup, schema[activeGroup]); + return content.subGroups( + activeGroup, + schema[activeGroup], + globalTagFilter, // forces re-render, gets passed through Storage + ); } }; @@ -119,6 +128,32 @@ const sidebarItems = (schema) => { }); }; +const findEntityInSchema = (schema, entityType) => { + for (const [category, group] of Object.entries(schema)) { + if (!group.items) continue; + for (const item of group.items) { + if (item.value === entityType) { + return [category, item.value]; + } + } + } + return [null, null]; +}; + +const handleTagClick = (tag) => { + const entityType = tag.entityType ?? tag.entity_type; + const [category, subType] = findEntityInSchema(schema, entityType); + if (!category || !subType) { + console.error(`Entity type ${entityType} not found in schema`); + return; + } + Storage.set("global-tag-filter", [tag.tag]); + setGlobalTagFilter([tag.tag]); + setActiveTabs((prev) => { + return { ...prev, [category]: subType }; + }); + handleMenuClick(category); +}; return (
@@ -129,6 +164,12 @@ return ( title: "NEAR AI", activeTab: activeGroup, items: sidebarItems(schema), + additionalContent: ( + + ), }} /> {renderContent()}