Skip to content

Commit

Permalink
Merge pull request ag2ai#69 from SandhyaKaliappan/main
Browse files Browse the repository at this point in the history
Remove unwanted items from the gallery
  • Loading branch information
harishmohanraj authored Jan 2, 2025
2 parents 9f0b03b + c670247 commit 06a7c3f
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 435 deletions.
14 changes: 13 additions & 1 deletion website/mint-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,18 @@ a.colab-badge > img, a.github-badge > img {
line-height: 1.5;
}
.examples-gallery-container .card {
padding: 1rem;
transition: all 0.3s ease;
border: 1px solid #e8e8e8;
border-radius: 4px;
cursor: pointer;
overflow: hidden;
display: flex;
}
.examples-gallery-container .card-container {
padding: 1rem;
flex:1;
}

.examples-gallery-container .card-description {
color: #727272;
display: -webkit-box;
Expand All @@ -358,6 +363,13 @@ a.colab-badge > img, a.github-badge > img {
}
.examples-gallery-container .card .px-6.py-5 {
padding: 0;
height: 100%;
}
.examples-gallery-container .card .px-6.py-5 > div,
.examples-gallery-container .card .px-6.py-5 > div > div,
.examples-gallery-container .card .px-6.py-5 > div > div > div.card-container
{
height: 100%;
}
.examples-gallery-container .tag {
display: inline-block;
Expand Down
24 changes: 11 additions & 13 deletions website/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,17 @@
"pages": [
"notebooks/Notebooks",
"notebooks/agentchat_RetrieveChat_mongodb",
"notebooks/JSON_mode_example",
"notebooks/agentchat_MathChat",
"notebooks/agentchat_RetrieveChat",
"notebooks/agentchat_RetrieveChat_pgvector",
"notebooks/agentchat_RetrieveChat_qdrant",
"notebooks/agentchat_agentops",
"notebooks/agentchat_agentoptimizer",
"notebooks/agentchat_auto_feedback_from_code_execution",
"notebooks/agentchat_azr_ai_search",
"notebooks/agentchat_captainagent",
"notebooks/agentchat_captainagent_crosstool",
"notebooks/agentchat_cost_token_tracking",
"notebooks/agentchat_custom_model",
"notebooks/agentchat_dalle_and_gpt4v",
Expand All @@ -558,6 +562,8 @@
"notebooks/agentchat_function_call_async",
"notebooks/agentchat_function_call_code_writing",
"notebooks/agentchat_function_call_currency_calculator",
"notebooks/agentchat_graph_rag_falkordb",
"notebooks/agentchat_graph_rag_neo4j",
"notebooks/agentchat_group_chat_with_llamaindex_agents",
"notebooks/agentchat_groupchat",
"notebooks/agentchat_groupchat_RAG",
Expand Down Expand Up @@ -589,13 +595,16 @@
"notebooks/agentchat_oai_code_interpreter",
"notebooks/agentchat_openlit",
"notebooks/agentchat_planning",
"notebooks/agentchat_realtime_swarm",
"notebooks/agentchat_realtime_websocket",
"notebooks/agentchat_reasoning_agent",
"notebooks/agentchat_society_of_mind",
"notebooks/agentchat_sql_spider",
"notebooks/agentchat_stream",
"notebooks/agentchat_structured_outputs",
"notebooks/agentchat_surfer",
"notebooks/agentchat_swarm",
"notebooks/agentchat_swarm_enhanced",
"notebooks/agentchat_swarm_graphrag_telemetry_trip_planner",
"notebooks/agentchat_swarm_graphrag_trip_planner",
"notebooks/agentchat_swarm_w_groupchat_legacy",
Expand All @@ -614,21 +623,10 @@
"notebooks/autobuild_agent_library",
"notebooks/autobuild_basic",
"notebooks/autogen_uniformed_api_calling",
"notebooks/config_loader_utility_functions",
"notebooks/gpt_assistant_agent_function_call",
"notebooks/lats_search",
"notebooks/JSON_mode_example",
"notebooks/agentchat_RetrieveChat",
"notebooks/agentchat_graph_rag_neo4j",
"notebooks/agentchat_swarm_enhanced",
"notebooks/tools_interoperability",
"notebooks/agentchat_realtime_swarm",
"notebooks/agentchat_realtime_websocket",
"notebooks/agentchat_reasoning_agent",
"notebooks/agentchat_captainagent_crosstool",
"notebooks/agentchat_realtime_websocket",
"notebooks/agentchat_graph_rag_falkordb",
"notebooks/agentchat_MathChat",
"notebooks/config_loader_utility_functions"
"notebooks/tools_interoperability"
]
},
"notebooks/Gallery"
Expand Down
7 changes: 6 additions & 1 deletion website/process_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ def get_error_info(nb: NotebookNode) -> NotebookError | None:
def add_front_matter_to_metadata_mdx(
front_matter: dict[str, str | list[str]], website_dir: Path, rendered_mdx: Path
) -> None:

source = front_matter.get("source_notebook")
if isinstance(source, str) and source.startswith("/website/docs/"):
return

metadata_mdx = website_dir / "snippets" / "data" / "NotebooksMetadata.mdx"

metadata = []
Expand All @@ -335,7 +340,7 @@ def add_front_matter_to_metadata_mdx(
"description": front_matter.get("description", ""),
"image": front_matter.get("image"),
"tags": front_matter.get("tags", []),
"source": front_matter.get("source_notebook"),
"source": source,
}
# Update metadata list
existing_entry = next((item for item in metadata if item["title"] == entry["title"]), None)
Expand Down
28 changes: 20 additions & 8 deletions website/snippets/components/GalleryPage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ export const GalleryPage = ({
const defaultImageIfNoImage = allowDefaultImage ?? true;
const allTags = [...new Set(galleryItems.flatMap((item) => item.tags))];

const handleCardClick = (e, targetLink) => {
if (!e.target.closest('a')) {
if (target === '_blank') {
window.open(targetLink, '_blank');
} else {
window.location.href = targetLink;
}
}
};

const updateURL = (tags) => {
const searchParams = new URLSearchParams(window.location.search);
if (tags.length > 0) {
Expand Down Expand Up @@ -121,8 +131,8 @@ export const GalleryPage = ({
const colab_href = `https://colab.research.google.com/github/ag2ai/ag2/blob/main/${item.source}`;
const github_href = `https://github.com/ag2ai/ag2/blob/main/${item.source}`;
return (<span class="badges">
<a style={{marginRight: '5px'}}href={colab_href} target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<a href={github_href} target="_parent"><img alt="Static Badge" src="https://img.shields.io/badge/Open%20on%20GitHub-grey?logo=github"/></a>
<a style={{marginRight: '5px'}}href={colab_href} target="_parent"><img noZoom src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
<a href={github_href} target="_parent"><img noZoom alt="Static Badge" src="https://img.shields.io/badge/Open%20on%20GitHub-grey?logo=github"/></a>
</span>
);
}
Expand All @@ -142,12 +152,14 @@ export const GalleryPage = ({
</select>
<CardGroup cols={3}>
{galleryItems.map((item, index) => (
<Card key={index} href={item.link}>
{imageFunc(item)}
<h5 className="card-title">{item.title}</h5>
{badges(item)}
<p className="card-description">{item.description || item.title}</p>
<TagsView tags={item.tags} />
<Card key={index}>
<div className="card-container" onClick={(e) => handleCardClick(e, item.link)}>
{imageFunc(item)}
<h5 className="card-title">{item.title}</h5>
{badges(item)}
<p className="card-description">{item.description || item.title}</p>
<TagsView tags={item.tags} />
</div>
</Card>
))}
</CardGroup>
Expand Down
Loading

0 comments on commit 06a7c3f

Please sign in to comment.