From c8a5540b3e210b59c1828bbaa323c7b4fab491f2 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Tue, 31 Dec 2024 06:30:14 +0000 Subject: [PATCH 01/15] Add tag filtering logic --- website/mint.json | 5 +---- website/snippets/components/GalleryPage.mdx | 11 +++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/website/mint.json b/website/mint.json index 665f3caaa4..a75a9a5af6 100644 --- a/website/mint.json +++ b/website/mint.json @@ -303,16 +303,13 @@ { "group": "agentchat.realtime_agent", "pages": [ - "docs/reference/agentchat/realtime_agent/client", "docs/reference/agentchat/realtime_agent/function_observer", "docs/reference/agentchat/realtime_agent/oai_realtime_client", "docs/reference/agentchat/realtime_agent/realtime_agent", "docs/reference/agentchat/realtime_agent/realtime_client", "docs/reference/agentchat/realtime_agent/realtime_observer", "docs/reference/agentchat/realtime_agent/twilio_audio_adapter", - "docs/reference/agentchat/realtime_agent/twilio_observer", - "docs/reference/agentchat/realtime_agent/websocket_audio_adapter", - "docs/reference/agentchat/realtime_agent/websocket_observer" + "docs/reference/agentchat/realtime_agent/websocket_audio_adapter" ] }, "docs/reference/agentchat/agent", diff --git a/website/snippets/components/GalleryPage.mdx b/website/snippets/components/GalleryPage.mdx index a4965ff4b9..0d3c25adc9 100644 --- a/website/snippets/components/GalleryPage.mdx +++ b/website/snippets/components/GalleryPage.mdx @@ -129,6 +129,17 @@ export const GalleryPage = ({ return (
+ {galleryItems.map((item, index) => ( From 1f67086ee47cb0e216de24efef8983dc5f680dfc Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 13:16:22 +0000 Subject: [PATCH 02/15] test --- .github/workflows/deploy-website-mintlify.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index b0f9a27ec7..eb755f4314 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -105,6 +105,11 @@ jobs: python ./process_notebooks.py render working-directory: website + - name: check the contents website/snippets/data/NotebooksMetadata.mdx + run: | + cat ./snippets/data/NotebooksMetadata.mdx + working-directory: website + - name: Prepare website content run: | # Create a temporary directory for filtered content @@ -113,6 +118,11 @@ jobs: # Copy files except .ipynb, node_modules, .quarto, .gitignore, and temp_website find . -type f -not -path "*/node_modules/*" -not -path "*/.quarto/*" -not -path "./temp_website/*" -not -name "*.ipynb" -not -name ".gitignore" -exec cp --parents {} temp_website/ \; + - name: check the contents temp_website/snippets/data/NotebooksMetadata.mdx + run: | + cat ./snippets/data/NotebooksMetadata.mdx + working-directory: ./website/temp_website + - name: Deploy to Mintlify uses: peaceiris/actions-gh-pages@v3 with: From cf039f743883fe570f39b2dd15653dfd5b04941d Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 13:22:30 +0000 Subject: [PATCH 03/15] test --- .github/workflows/deploy-website-mintlify.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index eb755f4314..d90fb07560 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -78,6 +78,10 @@ jobs: with: lfs: true fetch-depth: 0 + - name: check the contents website/snippets/data/NotebooksMetadata.mdx + run: | + cat ./snippets/data/NotebooksMetadata.mdx + working-directory: website - uses: actions/setup-node@v4 with: node-version: 18.x @@ -99,12 +103,14 @@ jobs: run: | python ./process_api_reference.py working-directory: website - + - name: check the contents website/snippets/data/NotebooksMetadata.mdx + run: | + cat ./snippets/data/NotebooksMetadata.mdx + working-directory: website - name: Convert Jupyter notebooks to MDX run: | python ./process_notebooks.py render working-directory: website - - name: check the contents website/snippets/data/NotebooksMetadata.mdx run: | cat ./snippets/data/NotebooksMetadata.mdx From 77834ae4236f9b15c32dec0cdfc652ee0a217c56 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 13:45:02 +0000 Subject: [PATCH 04/15] test --- website/process_notebooks.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 9175126728..219cfacabf 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -337,6 +337,11 @@ def add_front_matter_to_metadata_mdx( "tags": front_matter.get("tags", []), "source": front_matter.get("source_notebook"), } + + print(f"=============== Processing {rendered_mdx.stem} ===============", flush=True) + print(f"{front_matter=}", flush=True) + print(f"{entry=}", flush=True) + # Update metadata list existing_entry = next((item for item in metadata if item["title"] == entry["title"]), None) if existing_entry: From fbcf942fa0b3a5e623e9ee032287a9b6cc297d06 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 13:58:43 +0000 Subject: [PATCH 05/15] test --- website/process_notebooks.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 219cfacabf..1277fdb7e3 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -338,10 +338,6 @@ def add_front_matter_to_metadata_mdx( "source": front_matter.get("source_notebook"), } - print(f"=============== Processing {rendered_mdx.stem} ===============", flush=True) - print(f"{front_matter=}", flush=True) - print(f"{entry=}", flush=True) - # Update metadata list existing_entry = next((item for item in metadata if item["title"] == entry["title"]), None) if existing_entry: @@ -475,11 +471,17 @@ def post_process_mdx(rendered_mdx: Path, source_notebooks: Path, front_matter: d with open(rendered_mdx, encoding="utf-8") as f: content = f.read() + print(f"\n=== Processing {rendered_mdx.name} ===") + print(f"Initial front_matter: {json.dumps(front_matter, indent=2)}", flush=True) + # If there is front matter in the mdx file, we need to remove it if content.startswith("---"): front_matter_end = content.find("---", 3) - front_matter = yaml.safe_load(content[4:front_matter_end]) - content = content[front_matter_end + 3 :] + yaml_content = content[4:front_matter_end] + print(f"YAML content found: \n{yaml_content}", flush=True) + front_matter = yaml.safe_load(yaml_content) + print(f"After YAML load front_matter: {json.dumps(front_matter, indent=2)}", flush=True) + # Clean heading IDs using regex - matches from # to the end of ID block content = re.sub(r"(#{1,6}[^{]+){#[^}]+}", r"\1", content) From 8cdec2fa1cf1478798c858a175fd5588cfdae899 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 14:09:16 +0000 Subject: [PATCH 06/15] test --- website/process_notebooks.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 1277fdb7e3..888f8ce42d 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -477,11 +477,16 @@ def post_process_mdx(rendered_mdx: Path, source_notebooks: Path, front_matter: d # If there is front matter in the mdx file, we need to remove it if content.startswith("---"): front_matter_end = content.find("---", 3) - yaml_content = content[4:front_matter_end] - print(f"YAML content found: \n{yaml_content}", flush=True) - front_matter = yaml.safe_load(yaml_content) - print(f"After YAML load front_matter: {json.dumps(front_matter, indent=2)}", flush=True) - + print(f"\n=== Processing MDX front matter for {rendered_mdx.name} ===") + print(f"Original front_matter: {json.dumps(front_matter, indent=2)}", flush=True) + + front_matter_in_rendered_mdx = yaml.safe_load(content[4:front_matter_end]) + print(f"Front matter from rendered MDX: {json.dumps(front_matter_in_rendered_mdx, indent=2)}", flush=True) + + # Merge while preserving original values + front_matter = {**front_matter, **front_matter_in_rendered_mdx} + print(f"Merged front_matter: {json.dumps(front_matter, indent=2)}", flush=True) + content = content[front_matter_end + 3 :] # Clean heading IDs using regex - matches from # to the end of ID block content = re.sub(r"(#{1,6}[^{]+){#[^}]+}", r"\1", content) From 453eedf731c950fe14ef87349751a76ed104b2df Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 15:55:11 +0000 Subject: [PATCH 07/15] Remove debugging print messages --- .github/workflows/deploy-website-mintlify.yml | 18 +----------------- website/process_notebooks.py | 9 --------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index d90fb07560..b0f9a27ec7 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -78,10 +78,6 @@ jobs: with: lfs: true fetch-depth: 0 - - name: check the contents website/snippets/data/NotebooksMetadata.mdx - run: | - cat ./snippets/data/NotebooksMetadata.mdx - working-directory: website - uses: actions/setup-node@v4 with: node-version: 18.x @@ -103,18 +99,11 @@ jobs: run: | python ./process_api_reference.py working-directory: website - - name: check the contents website/snippets/data/NotebooksMetadata.mdx - run: | - cat ./snippets/data/NotebooksMetadata.mdx - working-directory: website + - name: Convert Jupyter notebooks to MDX run: | python ./process_notebooks.py render working-directory: website - - name: check the contents website/snippets/data/NotebooksMetadata.mdx - run: | - cat ./snippets/data/NotebooksMetadata.mdx - working-directory: website - name: Prepare website content run: | @@ -124,11 +113,6 @@ jobs: # Copy files except .ipynb, node_modules, .quarto, .gitignore, and temp_website find . -type f -not -path "*/node_modules/*" -not -path "*/.quarto/*" -not -path "./temp_website/*" -not -name "*.ipynb" -not -name ".gitignore" -exec cp --parents {} temp_website/ \; - - name: check the contents temp_website/snippets/data/NotebooksMetadata.mdx - run: | - cat ./snippets/data/NotebooksMetadata.mdx - working-directory: ./website/temp_website - - name: Deploy to Mintlify uses: peaceiris/actions-gh-pages@v3 with: diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 888f8ce42d..785cf5288f 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -471,21 +471,12 @@ def post_process_mdx(rendered_mdx: Path, source_notebooks: Path, front_matter: d with open(rendered_mdx, encoding="utf-8") as f: content = f.read() - print(f"\n=== Processing {rendered_mdx.name} ===") - print(f"Initial front_matter: {json.dumps(front_matter, indent=2)}", flush=True) - # If there is front matter in the mdx file, we need to remove it if content.startswith("---"): front_matter_end = content.find("---", 3) - print(f"\n=== Processing MDX front matter for {rendered_mdx.name} ===") - print(f"Original front_matter: {json.dumps(front_matter, indent=2)}", flush=True) - front_matter_in_rendered_mdx = yaml.safe_load(content[4:front_matter_end]) - print(f"Front matter from rendered MDX: {json.dumps(front_matter_in_rendered_mdx, indent=2)}", flush=True) - # Merge while preserving original values front_matter = {**front_matter, **front_matter_in_rendered_mdx} - print(f"Merged front_matter: {json.dumps(front_matter, indent=2)}", flush=True) content = content[front_matter_end + 3 :] # Clean heading IDs using regex - matches from # to the end of ID block From 5304b5de487bf25f98f38b44982836dcaac3102f Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 15:59:39 +0000 Subject: [PATCH 08/15] Remove debugging print messages --- website/process_notebooks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/website/process_notebooks.py b/website/process_notebooks.py index 785cf5288f..e2121e9757 100755 --- a/website/process_notebooks.py +++ b/website/process_notebooks.py @@ -337,7 +337,6 @@ def add_front_matter_to_metadata_mdx( "tags": front_matter.get("tags", []), "source": front_matter.get("source_notebook"), } - # Update metadata list existing_entry = next((item for item in metadata if item["title"] == entry["title"]), None) if existing_entry: @@ -474,9 +473,9 @@ def post_process_mdx(rendered_mdx: Path, source_notebooks: Path, front_matter: d # If there is front matter in the mdx file, we need to remove it if content.startswith("---"): front_matter_end = content.find("---", 3) - front_matter_in_rendered_mdx = yaml.safe_load(content[4:front_matter_end]) + mdx_front_matter = yaml.safe_load(content[4:front_matter_end]) # Merge while preserving original values - front_matter = {**front_matter, **front_matter_in_rendered_mdx} + front_matter = {**front_matter, **mdx_front_matter} content = content[front_matter_end + 3 :] # Clean heading IDs using regex - matches from # to the end of ID block From a7f03f6e9835b452cb17a7d9c780094ead622987 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:22:57 +0000 Subject: [PATCH 09/15] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 20 ++++--------------- scripts/docs_build.sh | 15 ++++++++++---- scripts/docs_serve.sh | 17 ++++++++++++---- website/README.md | 12 ++--------- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index b0f9a27ec7..712152284c 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -49,15 +49,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation + - name: Build documentation run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + ./scripts/docs_build.sh - name: Prepare website content run: | @@ -95,15 +89,9 @@ jobs: - name: Install quarto uses: quarto-dev/quarto-actions/setup@v2 - - name: Generate API documentation + - name: Build documentation run: | - python ./process_api_reference.py - working-directory: website - - - name: Convert Jupyter notebooks to MDX - run: | - python ./process_notebooks.py render - working-directory: website + ./scripts/docs_build.sh - name: Prepare website content run: | diff --git a/scripts/docs_build.sh b/scripts/docs_build.sh index e07029cccf..2d8ffeb5fb 100755 --- a/scripts/docs_build.sh +++ b/scripts/docs_build.sh @@ -3,7 +3,14 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn build +# Function to build documentation +docs_build() { + cd website && + python ./process_api_reference.py && + python ./process_notebooks.py render +} + +# Execute the function only if the script is run directly +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + docs_build +fi diff --git a/scripts/docs_serve.sh b/scripts/docs_serve.sh index 99239e7cd3..acc0ee0823 100755 --- a/scripts/docs_serve.sh +++ b/scripts/docs_serve.sh @@ -3,7 +3,16 @@ set -e set -x -cd website && - yarn install --frozen-lockfile --ignore-engines && - pydoc-markdown && - yarn start +# Source the docs_build.sh script from the same directory +source "$(dirname "$0")/docs_build.sh" + +# Run the docs_build function from docs_build.sh +docs_build + +# Install npm packages +echo "Running npm install..." +npm install + +# Add the command to serve the documentation +echo "Serving documentation..." +npm run mintlify:dev diff --git a/website/README.md b/website/README.md index 01bff706ef..7bdd03be4e 100644 --- a/website/README.md +++ b/website/README.md @@ -25,11 +25,7 @@ pip install pydoc-markdown pyyaml termcolor nbclient 3. Finally, run the following commands to build and serve the documentation: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` The last command starts a local development server and opens up a browser window. @@ -52,11 +48,7 @@ docker run -it -p 8081:3000 -v $(pwd):/home/autogen/ag2 ag2ai_dev_img bash Once at the CLI in Docker run the following commands: ```console -cd website -python ./process_api_reference.py -python ./process_notebooks.py render -npm install -npm run mintlify:dev +./scripts/docs_serve.sh ``` Once done you should be able to access the documentation at `http://127.0.0.1:8081` From dae2ab1ffecfba8a8a5c4399b76b93c6532a189e Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:27:06 +0000 Subject: [PATCH 10/15] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 712152284c..7952b95a50 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -51,7 +51,8 @@ jobs: - name: Build documentation run: | - ./scripts/docs_build.sh + ./docs_build.sh + working-directory: scripts - name: Prepare website content run: | @@ -91,7 +92,8 @@ jobs: - name: Build documentation run: | - ./scripts/docs_build.sh + ./docs_build.sh + working-directory: scripts - name: Prepare website content run: | From 21819849330389cedc0008e81bde3302cd27d094 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:39:46 +0000 Subject: [PATCH 11/15] Update docs build and serve scripts --- .github/workflows/deploy-website-mintlify.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 7952b95a50..ec0bdde156 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -51,8 +51,9 @@ jobs: - name: Build documentation run: | - ./docs_build.sh - working-directory: scripts + pwd + ls + ./scripts/docs_build.sh - name: Prepare website content run: | @@ -91,9 +92,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: | - ./docs_build.sh - working-directory: scripts + run: ./scripts/docs_build.sh - name: Prepare website content run: | From b09bcbf0f38e88a2775970e70d79d12d605b0653 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:43:14 +0000 Subject: [PATCH 12/15] Fix path --- .github/workflows/deploy-website-mintlify.yml | 7 ++-- website/build_website.sh | 35 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100755 website/build_website.sh diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index ec0bdde156..93946ebc40 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -50,10 +50,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: | - pwd - ls - ./scripts/docs_build.sh + run: ../scripts/docs_build.sh - name: Prepare website content run: | @@ -92,7 +89,7 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ./scripts/docs_build.sh + run: ../scripts/docs_build.sh - name: Prepare website content run: | diff --git a/website/build_website.sh b/website/build_website.sh deleted file mode 100755 index e4d6441be1..0000000000 --- a/website/build_website.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# This script generates documentation using pydoc-markdown and renders the website using Quarto. -# - -missing_deps=false - -# -# Check for missing dependencies, report them, and exit when building the -# website is likely to fail. -# -for dependency in node pydoc-markdown quarto python yarn npm -do - if ! command -v "$dependency" &> /dev/null - then - echo "Command '$dependency' not found." - missing_deps=true - fi -done - -if [ "$missing_deps" = true ] -then - echo -e "\nSome of the dependencies are missing." - echo "Please install them to build the website." - exit 1 -fi - -# Generate documentation using pydoc-markdown -pydoc-markdown - -# Process notebooks using a Python script -python ./process_notebooks.py render - -# Start the website using yarn -yarn start From 27b5b9617becfda65cd75d0a7aaec6c49d26cc64 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 16:49:47 +0000 Subject: [PATCH 13/15] Fix path --- .github/workflows/deploy-website-mintlify.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml index 93946ebc40..b630fe5474 100644 --- a/.github/workflows/deploy-website-mintlify.yml +++ b/.github/workflows/deploy-website-mintlify.yml @@ -50,7 +50,8 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ../scripts/docs_build.sh + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: | @@ -89,7 +90,8 @@ jobs: uses: quarto-dev/quarto-actions/setup@v2 - name: Build documentation - run: ../scripts/docs_build.sh + run: ./scripts/docs_build.sh + working-directory: . - name: Prepare website content run: | From bf046c480825068cff102eba00faf14a74c577fe Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Thu, 2 Jan 2025 18:47:31 +0000 Subject: [PATCH 14/15] 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 15/15] 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)}