-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rename AI onboarding docs to Agent Toolkit #6510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Alek99
wants to merge
3
commits into
main
Choose a base branch
from
codex/agent-toolkit-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,16 +7,18 @@ | |
| from typing import Any, Literal, Union, get_args, get_origin | ||
|
|
||
| from reflex.constants import Dirs | ||
| from reflex_base.config import get_config | ||
| from reflex_base.plugins import CommonContext, Plugin | ||
| from typing_extensions import Unpack | ||
|
|
||
| MCP_DOC_PATHS = { | ||
| "ai/integrations/mcp-installation.md", | ||
| "ai/integrations/mcp-overview.md", | ||
| } | ||
| AI_ONBOARDING_DOC_PATHS = { | ||
| "ai/integrations/ai-onboarding.md", | ||
| AGENT_TOOLKIT_DOC_PATHS = { | ||
| "ai/integrations/agent-toolkit.md", | ||
| } | ||
| LEGACY_MARKDOWN_ALIASES = { | ||
| Path("ai/integrations/ai-onboarding.md"): Path("ai/integrations/agent-toolkit.md"), | ||
| } | ||
| MCP_DOC_ORDER = { | ||
| "ai/integrations/mcp-overview.md": 0, | ||
|
|
@@ -113,6 +115,8 @@ def _extract_markdown_title(source: str) -> str | None: | |
|
|
||
| def _llms_url_for_path(url_path: Path) -> str: | ||
| """Return the public URL for a generated markdown asset.""" | ||
| from reflex_base.config import get_config | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to move it to the top if not for a specific reason. |
||
|
|
||
| config = get_config() | ||
| deploy_url = config.deploy_url.removesuffix("/") if config.deploy_url else "" | ||
| frontend_path = (config.frontend_path or "").strip("/") | ||
|
|
@@ -126,6 +130,8 @@ def _llms_url_for_path(url_path: Path) -> str: | |
|
|
||
| def _docs_home_url() -> str: | ||
| """Return the public URL for the docs home.""" | ||
| from reflex_base.config import get_config | ||
|
|
||
| config = get_config() | ||
| deploy_url = config.deploy_url.removesuffix("/") if config.deploy_url else "" | ||
| frontend_path = (config.frontend_path or "").strip("/") | ||
|
|
@@ -187,7 +193,7 @@ def _include_index_entry_in_llms_txt(markdown_file: MarkdownIndexEntry) -> bool: | |
| path = markdown_file.url_path.as_posix() | ||
| return ( | ||
| path in MCP_DOC_PATHS | ||
| or path in AI_ONBOARDING_DOC_PATHS | ||
| or path in AGENT_TOOLKIT_DOC_PATHS | ||
| or path in SKILLS_DOC_PATHS | ||
| or not path.startswith("ai/") | ||
| or path.startswith("ai/overview/") | ||
|
|
@@ -197,8 +203,8 @@ def _include_index_entry_in_llms_txt(markdown_file: MarkdownIndexEntry) -> bool: | |
| def _section_for_path(url_path: Path) -> str: | ||
| """Return the llms.txt section for a generated markdown asset.""" | ||
| path = url_path.as_posix() | ||
| if path in AI_ONBOARDING_DOC_PATHS: | ||
| return "AI Onboarding" | ||
| if path in AGENT_TOOLKIT_DOC_PATHS: | ||
| return "Agent Toolkit" | ||
| if path in MCP_DOC_PATHS: | ||
| return "MCP" | ||
| if path in SKILLS_DOC_PATHS: | ||
|
|
@@ -216,10 +222,10 @@ def _ordered_sections( | |
| if "AI Builder" in sections and "MCP" in sections: | ||
| ordered_sections.remove("MCP") | ||
| ordered_sections.insert(ordered_sections.index("AI Builder") + 1, "MCP") | ||
| if "AI Builder" in sections and "AI Onboarding" in sections: | ||
| ordered_sections.remove("AI Onboarding") | ||
| if "AI Builder" in sections and "Agent Toolkit" in sections: | ||
| ordered_sections.remove("Agent Toolkit") | ||
| ordered_sections.insert( | ||
| ordered_sections.index("AI Builder") + 1, "AI Onboarding" | ||
| ordered_sections.index("AI Builder") + 1, "Agent Toolkit" | ||
| ) | ||
| if "MCP" in sections and "Skills" in sections: | ||
| ordered_sections.remove("Skills") | ||
|
|
@@ -844,9 +850,16 @@ def generate_agent_files() -> tuple[tuple[Path, str | bytes], ...]: | |
| (entry.url_path, generate_markdown_file_content(entry)) | ||
| for entry in markdown_file_entries | ||
| ) | ||
| markdown_files_by_path = dict(markdown_files) | ||
| legacy_markdown_files = tuple( | ||
| (legacy_path, markdown_files_by_path[target_path]) | ||
| for legacy_path, target_path in LEGACY_MARKDOWN_ALIASES.items() | ||
| if target_path in markdown_files_by_path | ||
| ) | ||
|
|
||
| all_markdown_files = [ | ||
| *markdown_files, | ||
| *legacy_markdown_files, | ||
| *dynamic_api_reference_files, | ||
| ] | ||
|
|
||
|
|
@@ -879,6 +892,8 @@ class AgentFilesPlugin(Plugin): | |
| def get_static_assets( | ||
| self, **context: Unpack[CommonContext] | ||
| ) -> Sequence[tuple[Path, str | bytes]]: | ||
| from reflex_base.config import get_config | ||
|
|
||
| root = Path(Dirs.PUBLIC) | ||
| if frontend_path := get_config().frontend_path: | ||
| # Make sure the pre-rendered HTML does not get overwritten by md files. | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -667,8 +667,13 @@ def breadcrumb(path: str, nav_sidebar: rx.Component, doc_content: str | None = N | |
| docs_sidebar_drawer, | ||
| ) | ||
|
|
||
| # Split the path into segments, removing 'docs'. | ||
| # Split the path into segments, removing 'docs'. Some legacy URLs keep | ||
| # their old slugs for compatibility while using newer public labels. | ||
| segments = [segment for segment in path.split("/") if segment and segment != "docs"] | ||
| segment_labels = { | ||
| "ai": "AI", | ||
| "ai-onboarding": "Agent Toolkit", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The slug no longer exists, it redirects to agent-toolkit |
||
| } | ||
|
|
||
| # Initialize an empty list to store the breadcrumbs and their separators | ||
| breadcrumbs = [] | ||
|
|
@@ -681,7 +686,10 @@ def breadcrumb(path: str, nav_sidebar: rx.Component, doc_content: str | None = N | |
| # Add the breadcrumb item to the list | ||
| breadcrumbs.append( | ||
| rx.el.a( | ||
| to_title_case(to_snake_case(segment), sep=" "), | ||
| segment_labels.get( | ||
| segment, | ||
| to_title_case(to_snake_case(segment), sep=" "), | ||
| ), | ||
| class_name="min-h-8 flex items-center text-sm font-[525] text-m-slate-12 dark:text-m-slate-3 last:text-m-slate-7 dark:last:text-m-slate-6 hover:text-primary-10 dark:hover:text-primary-9" | ||
| + (" truncate" if i == len(segments) - 1 else ""), | ||
| underline="none", | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe wording can be improved here. Feels too listy.