From bf046c480825068cff102eba00faf14a74c577fe Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 18:47:31 +0000 Subject: [PATCH 1/2] Remove unwanted items from the gallery --- website/mint-style.css | 14 +- website/mint.json | 24 +- website/process_notebooks.py | 7 +- website/snippets/components/GalleryPage.mdx | 24 +- website/snippets/data/NotebooksMetadata.mdx | 526 +++++--------------- 5 files changed, 160 insertions(+), 435 deletions(-) diff --git a/website/mint-style.css b/website/mint-style.css index d0a0e363ed..7f08baf46e 100644 --- a/website/mint-style.css +++ b/website/mint-style.css @@ -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; @@ -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; diff --git a/website/mint.json b/website/mint.json index a75a9a5af6..4415bd2d2a 100644 --- a/website/mint.json +++ b/website/mint.json @@ -543,6 +543,9 @@ "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", @@ -550,6 +553,7 @@ "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", @@ -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", @@ -589,6 +595,8 @@ "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", @@ -596,6 +604,7 @@ "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", @@ -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" diff --git a/website/process_notebooks.py b/website/process_notebooks.py index e2121e9757..8a81d37bed 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -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 = [] @@ -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) diff --git a/website/snippets/components/GalleryPage.mdx b/website/snippets/components/GalleryPage.mdx index 0d3c25adc9..051cf28cbb 100644 --- a/website/snippets/components/GalleryPage.mdx +++ b/website/snippets/components/GalleryPage.mdx @@ -14,6 +14,12 @@ export const GalleryPage = ({ const defaultImageIfNoImage = allowDefaultImage ?? true; const allTags = [...new Set(galleryItems.flatMap((item) => item.tags))]; + const handleDivClick = (e, targetLink) => { + if (!e.target.closest('a')) { + window.location.href = targetLink; + } + }; + const updateURL = (tags) => { const searchParams = new URLSearchParams(window.location.search); if (tags.length > 0) { @@ -121,8 +127,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 ( - Open In Colab - Static Badge + Open In Colab + Static Badge ); } @@ -142,12 +148,14 @@ export const GalleryPage = ({ {galleryItems.map((item, index) => ( - - {imageFunc(item)} -
{item.title}
- {badges(item)} -

{item.description || item.title}

- + +
handleDivClick(e, item.link)}> + {imageFunc(item)} +
{item.title}
+ {badges(item)} +

{item.description || item.title}

+ +
))}
diff --git a/website/snippets/data/NotebooksMetadata.mdx b/website/snippets/data/NotebooksMetadata.mdx index c83589665d..7279592e2f 100644 --- a/website/snippets/data/NotebooksMetadata.mdx +++ b/website/snippets/data/NotebooksMetadata.mdx @@ -16,6 +16,40 @@ export const notebooksMetadata = [ ], "source": "/notebook/agentchat_RetrieveChat_mongodb.ipynb" }, + { + "title": "Mitigating Prompt hacking with JSON Mode in Autogen", + "link": "/notebooks/JSON_mode_example", + "description": "Use JSON mode and Agent Descriptions to mitigate prompt manipulation and control speaker transition.", + "image": null, + "tags": [ + "JSON", + "description", + "prompt hacking", + "group chat", + "orchestration" + ], + "source": "/notebook/JSON_mode_example.ipynb" + }, + { + "title": "Auto Generated Agent Chat: Using MathChat to Solve Math Problems", + "link": "/notebooks/agentchat_MathChat", + "description": "Using MathChat to Solve Math Problems", + "image": null, + "tags": [ + "math" + ], + "source": "/notebook/agentchat_MathChat.ipynb" + }, + { + "title": "Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering", + "link": "/notebooks/agentchat_RetrieveChat", + "description": "Explore the use of AutoGen's RetrieveChat for tasks like code generation from docstrings, answering complex questions with human feedback, and exploiting features like Update Context, custom prompts, and few-shot learning.", + "image": null, + "tags": [ + "RAG" + ], + "source": "/notebook/agentchat_RetrieveChat.ipynb" + }, { "title": "Using RetrieveChat Powered by PGVector for Retrieve Augmented Code Generation and Question Answering", "link": "/notebooks/agentchat_RetrieveChat_pgvector", @@ -97,6 +131,18 @@ export const notebooksMetadata = [ ], "source": "/notebook/agentchat_captainagent.ipynb" }, + { + "title": "Cross-Framework LLM Tool for CaptainAgent", + "link": "/notebooks/agentchat_captainagent_crosstool", + "description": "Cross-Framework LLM Tool for CaptainAgent", + "image": null, + "tags": [ + "tools", + "langchain", + "crewai" + ], + "source": "/notebook/agentchat_captainagent_crosstool.ipynb" + }, { "title": "Usage tracking with AutoGen", "link": "/notebooks/agentchat_cost_token_tracking", @@ -191,6 +237,27 @@ export const notebooksMetadata = [ ], "source": "/notebook/agentchat_function_call_currency_calculator.ipynb" }, + { + "title": "Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering", + "link": "/notebooks/agentchat_graph_rag_falkordb", + "description": "Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering", + "image": null, + "tags": [ + "RAG", + "FalkorDB" + ], + "source": "/notebook/agentchat_graph_rag_falkordb.ipynb" + }, + { + "title": "Using Neo4j's graph database with AG2 agents for Question & Answering", + "link": "/notebooks/agentchat_graph_rag_neo4j", + "description": "Neo4j GraphRAG utilises a knowledge graph and can be added as a capability to agents.", + "image": null, + "tags": [ + "RAG" + ], + "source": "/notebook/agentchat_graph_rag_neo4j.ipynb" + }, { "title": "Groupchat with Llamaindex agents", "link": "/notebooks/agentchat_group_chat_with_llamaindex_agents", @@ -556,7 +623,30 @@ export const notebooksMetadata = [ "source": "/notebook/agentchat_planning.ipynb" }, { - "title": "ReasoningAgent (Tree of Thoughts with Beam Search)", + "title": "RealtimeAgent in a Swarm Orchestration", + "link": "/notebooks/agentchat_realtime_swarm", + "description": "Swarm Ochestration", + "image": null, + "tags": [ + "orchestration", + "group chat", + "swarm" + ], + "source": "/notebook/agentchat_realtime_swarm.ipynb" + }, + { + "title": "RealtimeAgent with local websocket connection", + "link": "/notebooks/agentchat_realtime_websocket", + "description": "RealtimeAgent using websockets", + "image": null, + "tags": [ + "realtime", + "websockets" + ], + "source": "/notebook/agentchat_realtime_websocket.ipynb" + }, + { + "title": "ReasoningAgent - Advanced LLM Reasoning with Multiple Search Strategies", "link": "/notebooks/agentchat_reasoning_agent", "description": "Use ReasoningAgent for o1 style reasoning in Agentic workflows with LLMs using AG2", "image": null, @@ -635,6 +725,18 @@ export const notebooksMetadata = [ ], "source": "/notebook/agentchat_swarm.ipynb" }, + { + "title": "Enhanced Swarm Orchestration with AG2", + "link": "/notebooks/agentchat_swarm_enhanced", + "description": "Swarm Ochestration", + "image": null, + "tags": [ + "orchestration", + "group chat", + "swarm" + ], + "source": "/notebook/agentchat_swarm_enhanced.ipynb" + }, { "title": "Using a local Telemetry server to monitor a GraphRAG agent", "link": "/notebooks/agentchat_swarm_graphrag_telemetry_trip_planner", @@ -842,6 +944,17 @@ export const notebooksMetadata = [ ], "source": "/notebook/autogen_uniformed_api_calling.ipynb" }, + { + "title": "Config loader utility functions", + "link": "/notebooks/config_loader_utility_functions", + "description": "Config loader utility functions", + "image": null, + "tags": [ + "utility", + "config" + ], + "source": "/notebook/config_loader_utility_functions.ipynb" + }, { "title": "From Dad Jokes To Sad Jokes: Function Calling with GPTAssistantAgent", "link": "/notebooks/gpt_assistant_agent_function_call", @@ -866,144 +979,6 @@ export const notebooksMetadata = [ ], "source": "/notebook/lats_search.ipynb" }, - { - "title": "Tool Use", - "link": "/notebooks/tool-use", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/tool-use.ipynb" - }, - { - "title": "Mitigating Prompt hacking with JSON Mode in Autogen", - "link": "/notebooks/JSON_mode_example", - "description": "Use JSON mode and Agent Descriptions to mitigate prompt manipulation and control speaker transition.", - "image": null, - "tags": [ - "JSON", - "description", - "prompt hacking", - "group chat", - "orchestration" - ], - "source": "/notebook/JSON_mode_example.ipynb" - }, - { - "title": "Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering", - "link": "/notebooks/agentchat_RetrieveChat", - "description": "Explore the use of AutoGen's RetrieveChat for tasks like code generation from docstrings, answering complex questions with human feedback, and exploiting features like Update Context, custom prompts, and few-shot learning.", - "image": null, - "tags": [ - "RAG" - ], - "source": "/notebook/agentchat_RetrieveChat.ipynb" - }, - { - "title": "Anthropic Claude", - "link": "/notebooks/cloud-anthropic", - "description": "Define and load a custom model", - "image": null, - "tags": [ - "custom model" - ], - "source": "/website/docs/topics/non-openai-models/cloud-anthropic.ipynb" - }, - { - "title": "Amazon Bedrock", - "link": "/notebooks/cloud-bedrock", - "description": "Define and load a custom model", - "image": null, - "tags": [ - "custom model" - ], - "source": "/website/docs/topics/non-openai-models/cloud-bedrock.ipynb" - }, - { - "title": "ReAct", - "link": "/notebooks/react", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/prompting-and-reasoning/react.ipynb" - }, - { - "title": "Allowing Human Feedback in Agents", - "link": "/notebooks/human-in-the-loop", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/human-in-the-loop.ipynb" - }, - { - "title": "Task Decomposition", - "link": "/notebooks/task_decomposition", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/task_decomposition.ipynb" - }, - { - "title": "Using Neo4j's graph database with AG2 agents for Question & Answering", - "link": "/notebooks/agentchat_graph_rag_neo4j", - "description": "Neo4j GraphRAG utilises a knowledge graph and can be added as a capability to agents.", - "image": null, - "tags": [ - "RAG" - ], - "source": "/notebook/agentchat_graph_rag_neo4j.ipynb" - }, - { - "title": "Swarm Orchestration", - "link": "/notebooks/swarm", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/swarm.ipynb" - }, - { - "title": "LiteLLM with WatsonX", - "link": "/notebooks/cloud-litellm-watsonx", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-litellm-watsonx.ipynb" - }, - { - "title": "Introduction to AutoGen", - "link": "/notebooks/introduction", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/introduction.ipynb" - }, - { - "title": "Conversation Patterns", - "link": "/notebooks/conversation-patterns", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/conversation-patterns.ipynb" - }, - { - "title": "Enhanced Swarm Orchestration with AG2", - "link": "/notebooks/agentchat_swarm_enhanced", - "description": "Swarm Ochestration", - "image": null, - "tags": [ - "orchestration", - "group chat", - "swarm" - ], - "source": "/notebook/agentchat_swarm_enhanced.ipynb" - }, - { - "title": "Cerebras", - "link": "/notebooks/cloud-cerebras", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-cerebras.ipynb" - }, { "title": "Cross-Framework LLM Tool Integration with AG2", "link": "/notebooks/tools_interoperability", @@ -1016,278 +991,5 @@ export const notebooksMetadata = [ "pydanticai" ], "source": "/notebook/tools_interoperability.ipynb" - }, - { - "title": "RealtimeAgent in a Swarm Orchestration", - "link": "/notebooks/agentchat_realtime_swarm", - "description": "Swarm Ochestration", - "image": null, - "tags": [ - "orchestration", - "group chat", - "swarm" - ], - "source": "/notebook/agentchat_realtime_swarm.ipynb" - }, - { - "title": "RealtimeAgent using websockets", - "link": "/notebooks/agentchat_realtime_websocket", - "description": "Realtime agent using websockets", - "image": null, - "tags": [ - "realtime", - "websockets" - ], - "source": "/notebook/agentchat_realtime_websocket.ipynb" - }, - { - "title": "ReasoningAgent - Advanced LLM Reasoning with Multiple Search Strategies", - "link": "/notebooks/agentchat_reasoning_agent", - "description": "Use ReasoningAgent for o1 style reasoning in Agentic workflows with LLMs using AG2", - "image": null, - "tags": [ - "reasoning agent", - "tree of thoughts" - ], - "source": "/notebook/agentchat_reasoning_agent.ipynb" - }, - { - "title": "LLM Configuration", - "link": "/notebooks/llm_configuration", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/llm_configuration.ipynb" - }, - { - "title": "Command Line Code Executor", - "link": "/notebooks/cli-code-executor", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/code-execution/cli-code-executor.ipynb" - }, - { - "title": "Custom Code Executor", - "link": "/notebooks/custom-executor", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/code-execution/custom-executor.ipynb" - }, - { - "title": "Jupyter Code Executor", - "link": "/notebooks/jupyter-code-executor", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/code-execution/jupyter-code-executor.ipynb" - }, - { - "title": "User Defined Functions", - "link": "/notebooks/user-defined-functions", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/code-execution/user-defined-functions.ipynb" - }, - { - "title": "Customize Speaker Selection", - "link": "/notebooks/customized_speaker_selection", - "description": "Custom Speaker Selection Function", - "image": null, - "tags": [ - "orchestration", - "group chat" - ], - "source": "/website/docs/topics/groupchat/customized_speaker_selection.ipynb" - }, - { - "title": "Resuming a GroupChat", - "link": "/notebooks/resuming_groupchat", - "description": "Resume Group Chat", - "image": null, - "tags": [ - "resume", - "orchestration", - "group chat" - ], - "source": "/website/docs/topics/groupchat/resuming_groupchat.ipynb" - }, - { - "title": "Using Transform Messages during Speaker Selection", - "link": "/notebooks/transform_messages_speaker_selection", - "description": "Custom Speaker Selection Function", - "image": null, - "tags": [ - "orchestration", - "long context handling", - "group chat" - ], - "source": "/website/docs/topics/groupchat/transform_messages_speaker_selection.ipynb" - }, - { - "title": "Using Custom Model Client classes with Auto Speaker Selection", - "link": "/notebooks/using_custom_model_client_classes", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/groupchat/using_custom_model_client_classes.ipynb" - }, - { - "title": "Cohere", - "link": "/notebooks/cloud-cohere", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-cohere.ipynb" - }, - { - "title": "Using Gemini in AutoGen with Other LLMs", - "link": "/notebooks/cloud-gemini", - "description": "Using Gemini with AutoGen", - "image": null, - "tags": [ - "gemini" - ], - "source": "/website/docs/topics/non-openai-models/cloud-gemini.ipynb" - }, - { - "title": "Use AutoGen with Gemini via VertexAI", - "link": "/notebooks/cloud-gemini_vertexai", - "description": "Using Gemini with AutoGen via VertexAI", - "image": null, - "tags": [ - "gemini", - "vertexai" - ], - "source": "/website/docs/topics/non-openai-models/cloud-gemini_vertexai.ipynb" - }, - { - "title": "Groq", - "link": "/notebooks/cloud-groq", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-groq.ipynb" - }, - { - "title": "Mistral AI", - "link": "/notebooks/cloud-mistralai", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-mistralai.ipynb" - }, - { - "title": "Together.AI", - "link": "/notebooks/cloud-togetherai", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/cloud-togetherai.ipynb" - }, - { - "title": "LiteLLM with Ollama", - "link": "/notebooks/local-litellm-ollama", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/local-litellm-ollama.ipynb" - }, - { - "title": "LM Studio", - "link": "/notebooks/local-lm-studio", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/local-lm-studio.ipynb" - }, - { - "title": "Ollama", - "link": "/notebooks/local-ollama", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/non-openai-models/local-ollama.ipynb" - }, - { - "title": "LLM Reflection", - "link": "/notebooks/reflection", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/topics/prompting-and-reasoning/reflection.ipynb" - }, - { - "title": "Terminating Conversations Between Agents", - "link": "/notebooks/chat-termination", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/chat-termination.ipynb" - }, - { - "title": "Code Executors", - "link": "/notebooks/code-executors", - "description": "", - "image": null, - "tags": [], - "source": "/website/docs/tutorial/code-executors.ipynb" - }, - { - "title": "Cross-Framework LLM Tool for CaptainAgent", - "link": "/notebooks/agentchat_captainagent_crosstool", - "description": "Cross-Framework LLM Tool for CaptainAgent", - "image": null, - "tags": [ - "tools", - "langchain", - "crewai" - ], - "source": "/notebook/agentchat_captainagent_crosstool.ipynb" - }, - { - "title": "RealtimeAgent with local websocket connection", - "link": "/notebooks/agentchat_realtime_websocket", - "description": "RealtimeAgent using websockets", - "image": null, - "tags": [ - "realtime", - "websockets" - ], - "source": "/notebook/agentchat_realtime_websocket.ipynb" - }, - { - "title": "Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering", - "link": "/notebooks/agentchat_graph_rag_falkordb", - "description": "Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering", - "image": null, - "tags": [ - "RAG", - "FalkorDB" - ], - "source": "/notebook/agentchat_graph_rag_falkordb.ipynb" - }, - { - "title": "Auto Generated Agent Chat: Using MathChat to Solve Math Problems", - "link": "/notebooks/agentchat_MathChat", - "description": "Using MathChat to Solve Math Problems", - "image": null, - "tags": [ - "math" - ], - "source": "/notebook/agentchat_MathChat.ipynb" - }, - { - "title": "Config loader utility functions", - "link": "/notebooks/config_loader_utility_functions", - "description": "Config loader utility functions", - "image": null, - "tags": [ - "utility", - "config" - ], - "source": "/notebook/config_loader_utility_functions.ipynb" } ]; From b22f216af189cb49ac424636cb409f5b5d77ffa2 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 18:59:04 +0000 Subject: [PATCH 2/2] Rename click handler and update link opening behavior in GalleryPage --- website/snippets/components/GalleryPage.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/website/snippets/components/GalleryPage.mdx b/website/snippets/components/GalleryPage.mdx index 051cf28cbb..02c0e1bba6 100644 --- a/website/snippets/components/GalleryPage.mdx +++ b/website/snippets/components/GalleryPage.mdx @@ -14,9 +14,13 @@ export const GalleryPage = ({ const defaultImageIfNoImage = allowDefaultImage ?? true; const allTags = [...new Set(galleryItems.flatMap((item) => item.tags))]; - const handleDivClick = (e, targetLink) => { + const handleCardClick = (e, targetLink) => { if (!e.target.closest('a')) { - window.location.href = targetLink; + if (target === '_blank') { + window.open(targetLink, '_blank'); + } else { + window.location.href = targetLink; + } } }; @@ -149,7 +153,7 @@ export const GalleryPage = ({ {galleryItems.map((item, index) => ( -
handleDivClick(e, item.link)}> +
handleCardClick(e, item.link)}> {imageFunc(item)}
{item.title}
{badges(item)}