forked from ag2ai/ag2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from harishmohanraj/add-home-and-blog-pages
Add home and blog pages
- Loading branch information
Showing
21 changed files
with
1,751 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Examples | ||
--- | ||
title: Examples by Category | ||
--- | ||
|
||
## Automated Multi Agent Chat | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: "Home" | ||
mode: "wide" | ||
--- | ||
|
||
import { PopularResources } from '/snippets/components/PopularResources.mdx'; | ||
import { KeyFeatures } from '/snippets/components/KeyFeatures.mdx'; | ||
import { ExploreContent } from '/snippets/components/ExploreContent.mdx'; | ||
|
||
<div class="homepage-hero-section"> | ||
<div class="hero-content"> | ||
<img class="hero-logo" noZoom src="/static/img/ag2.svg" width="400em" /> | ||
<h2 class="hero-title">AG2</h2> | ||
<p class="hero-subtitle">The Open Source Agent OS</p> | ||
<a class="hero-btn" href="/docs/Getting-Started">Getting Started - 3min ⏱️</a> | ||
</div> | ||
</div> | ||
|
||
### Popular resources | ||
<PopularResources /> | ||
|
||
### Key Features | ||
<KeyFeatures /> | ||
|
||
### Explore content | ||
<ExploreContent /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: Notebooks | ||
mode: "wide" | ||
--- | ||
|
||
import { GalleryPage } from '/snippets/components/GalleryPage.mdx'; | ||
import { ClientSideComponent } from "/snippets/components/ClientSideComponent.mdx"; | ||
import { notebooksMetadata } from "/snippets/data/NotebooksMetadata.mdx"; | ||
|
||
This page contains a collection of notebooks that demonstrate how to use | ||
AutoGen. The notebooks are tagged with the topics they cover. | ||
For example, a notebook that demonstrates how to use function calling will | ||
be tagged with `tool/function`. | ||
|
||
<ClientSideComponent Component={GalleryPage} componentProps={{galleryItems: notebooksMetadata, target: "_self", allowDefaultImage: false}} /> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Load jQuery if not present | ||
if (typeof jQuery === "undefined") { | ||
const jqueryScript = document.createElement("script"); | ||
jqueryScript.src = | ||
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"; | ||
document.head.appendChild(jqueryScript); | ||
|
||
jqueryScript.onload = function () { | ||
// Load Chosen after jQuery | ||
const chosenScript = document.createElement("script"); | ||
chosenScript.src = | ||
"https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.min.js"; | ||
document.head.appendChild(chosenScript); | ||
|
||
// Add Chosen CSS | ||
const chosenStyles = document.createElement("link"); | ||
chosenStyles.rel = "stylesheet"; | ||
chosenStyles.href = | ||
"https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.min.css"; | ||
document.head.appendChild(chosenStyles); | ||
|
||
// Initialize Chosen when everything is loaded | ||
chosenScript.onload = function () { | ||
initializeGallerySelect(); | ||
}; | ||
}; | ||
} | ||
|
||
function getTagsFromURL() { | ||
const searchParams = new URLSearchParams(window.location.search); | ||
const tags = searchParams.get("tags"); | ||
return tags ? tags.split(",") : []; | ||
} | ||
|
||
// Function to initialize Chosen on gallery select | ||
function initializeGallerySelect() { | ||
// Add flag to check if already initialized | ||
const selectElement = $(".examples-gallery-container .tag-filter"); | ||
if (selectElement.length && !selectElement.data("chosen-initialized")) { | ||
selectElement | ||
.chosen({ | ||
width: "100%", | ||
placeholder_text_multiple: "Filter by tags", | ||
}) | ||
.data("chosen-initialized", true); | ||
|
||
// Get tags from URL and update chosen | ||
const urlTags = getTagsFromURL(); | ||
if (urlTags.length > 0) { | ||
selectElement.val(urlTags); | ||
selectElement.trigger("chosen:updated"); | ||
|
||
// Trigger the gallery:tagChange event with URL tags | ||
const customEvent = new CustomEvent("gallery:tagChange", { | ||
detail: urlTags, | ||
}); | ||
document.dispatchEvent(customEvent); | ||
} | ||
|
||
// Set up change handler | ||
selectElement.on("change", function (evt, params) { | ||
const selectedValues = $(this).val() || []; | ||
const customEvent = new CustomEvent("gallery:tagChange", { | ||
detail: selectedValues, | ||
}); | ||
document.dispatchEvent(customEvent); | ||
}); | ||
} | ||
} | ||
|
||
// Debounce function | ||
function debounce(func, wait) { | ||
let timeout; | ||
return function executedFunction(...args) { | ||
const later = () => { | ||
clearTimeout(timeout); | ||
func(...args); | ||
}; | ||
clearTimeout(timeout); | ||
timeout = setTimeout(later, wait); | ||
}; | ||
} | ||
|
||
// Debounced version of initialize | ||
const debouncedInitialize = debounce(initializeGallerySelect, 100); | ||
|
||
// Watch for URL changes using MutationObserver | ||
const observer = new MutationObserver((mutations) => { | ||
if (window.location.pathname.includes("/notebooks")) { | ||
debouncedInitialize(); | ||
} | ||
}); | ||
|
||
observer.observe(document.body, { | ||
childList: true, | ||
subtree: true, | ||
attributes: false, | ||
characterData: false, | ||
}); | ||
|
||
// Initialize on page load | ||
document.addEventListener("DOMContentLoaded", function () { | ||
if (window.jQuery && window.jQuery.fn.chosen) { | ||
initializeGallerySelect(); | ||
} | ||
}); |
Oops, something went wrong.