Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/app/agent_files/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"ai/integrations/skills.md",
}

LLMS_TXT_INTRO = """\
# Reflex Documentation

> Reflex is a Python framework for building full-stack web apps. Use this index to find agent-readable Markdown docs, or see [llms-full.txt]({llms_full_txt_url}) for the complete docs in one file.

## Docs
"""

LLMS_FULL_INTRO = """\
# Reflex Documentation
Source: {docs_home_url}
Expand Down Expand Up @@ -242,7 +250,12 @@ def generate_llms_txt(
continue
sections.setdefault(markdown_file.section, []).append(markdown_file)

lines = ["# Reflex", "", "## Docs", ""]
lines = [
LLMS_TXT_INTRO.format(
llms_full_txt_url=_llms_url_for_path(Path("llms-full.txt")),
).strip(),
"",
]
for section in _ordered_sections(sections):
entries = _ordered_entries(section, sections[section])
lines.extend([f"### {section}", ""])
Expand Down
14 changes: 14 additions & 0 deletions docs/app/reflex_docs/templates/docpage/docpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ def _copy_page_menu_item(


DOCS_PROD_BASE = "https://reflex.dev/docs"
LLMS_TXT_PATH = "/llms.txt"
LLMS_FULL_TXT_PATH = "/llms-full.txt"
Comment thread
Alek99 marked this conversation as resolved.


def _build_prefill_url(base_url: str, path: str, action: str) -> str:
Expand Down Expand Up @@ -524,6 +526,12 @@ def _copy_page_button(doc_content: str, path: str = "") -> rx.Component:
description="Copy page as Markdown for LLMs",
on_click=copy_action,
),
_copy_page_menu_item(
icon=ui.icon("DocumentValidationIcon", size=16),
title="llms-full.txt",
description="View all docs as Markdown for LLMs",
href=LLMS_FULL_TXT_PATH,
),
rx.el.div(class_name="h-px bg-secondary-4"),
_copy_page_menu_item(
icon=ui.icon("MessageProgrammingIcon", size=16),
Expand Down Expand Up @@ -759,6 +767,12 @@ def wrapper(*args, **kwargs) -> rx.Component:
return rx.box(
docs_navbar(),
rx.el.main(
rx.el.blockquote(
rx.el.span("For the complete documentation index, see "),
rx.el.a("llms.txt", href=LLMS_TXT_PATH),
rx.el.span("."),
class_name="sr-only",
),
rx.box(
sidebar,
class_name=(
Expand Down
9 changes: 8 additions & 1 deletion docs/app/tests/test_agent_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ def test_generate_llms_txt_groups_docs_at_public_root(monkeypatch):
])

assert path == Path("llms.txt")
assert content.startswith("# Reflex\n\n## Docs\n\n")
assert content.startswith(
"# Reflex Documentation\n\n"
"> Reflex is a Python framework for building full-stack web apps. "
"Use this index to find agent-readable Markdown docs, or see "
"[llms-full.txt](https://reflex.dev/docs/llms-full.txt) for the "
"complete docs in one file.\n\n"
"## Docs\n\n"
)
assert "### Components\n\n" in content
assert "- [Props](https://reflex.dev/docs/components/props.md)" in content
assert (
Expand Down
Loading