docs: remove templates (#25717)

- [x] check redirect works at template root
- [x] check redirect works within individual template page
This commit is contained in:
Erick Friis 2024-08-23 15:51:12 -07:00 committed by GitHub
parent 90439b12f6
commit 0022ae1b31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 82 deletions

View File

@ -39,7 +39,6 @@ install-py-deps:
generate-files:
mkdir -p $(INTERMEDIATE_DIR)
cp -r $(SOURCE_DIR)/* $(INTERMEDIATE_DIR)
mkdir -p $(INTERMEDIATE_DIR)/templates
$(PYTHON) scripts/tool_feat_table.py $(INTERMEDIATE_DIR)
@ -47,8 +46,6 @@ generate-files:
$(PYTHON) scripts/partner_pkg_table.py $(INTERMEDIATE_DIR)
$(PYTHON) scripts/copy_templates.py $(INTERMEDIATE_DIR)
wget -q https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O $(INTERMEDIATE_DIR)/langserve.md
$(PYTHON) scripts/resolve_local_links.py $(INTERMEDIATE_DIR)/langserve.md https://github.com/langchain-ai/langserve/tree/main/

View File

@ -194,11 +194,6 @@ const config = {
docId: "contributing/index",
label: "Contributing",
},
{
type: "docSidebar",
sidebarId: "templates",
label: "Templates",
},
{
label: "Cookbooks",
href: "https://github.com/langchain-ai/langchain/blob/master/cookbook/README.md"
@ -247,14 +242,6 @@ const config = {
href: "https://docs.smith.langchain.com/",
label: "LangSmith Docs",
},
{
href: "https://github.com/langchain-ai/langchain/tree/master/templates",
label: "Templates GitHub",
},
{
label: "Templates Hub",
href: "https://templates.langchain.com",
},
{
href: "https://smith.langchain.com/hub",
label: "LangChain Hub",

View File

@ -8,16 +8,16 @@ if [ "$VERCEL_ENV" == "production" ] || [ "$VERCEL_GIT_COMMIT_REF" == "master" ]
echo "✅ Production build - proceeding with build"
exit 1;
else
echo "Checking for changes in docs/ and templates/:"
echo "Checking for changes in docs/"
echo "---"
git log -n 50 --pretty=format:"%s" -- . ../templates | grep -v '(#'
git log -n 50 --pretty=format:"%s" -- . | grep -v '(#'
if [ $? -eq 0 ]; then
echo "---"
echo "✅ Changes detected in docs/ or templates/ - proceeding with build"
echo "✅ Changes detected in docs/ - proceeding with build"
exit 1
else
echo "---"
echo "🛑 No changes detected in docs/ or templates/ - ignoring build"
echo "🛑 No changes detected in docs/ - ignoring build"
exit 0
fi
fi

View File

@ -1,46 +0,0 @@
import glob
import os
import re
import shutil
import sys
from pathlib import Path
if __name__ == "__main__":
intermediate_dir = Path(sys.argv[1])
templates_source_dir = Path(os.path.abspath(__file__)).parents[2] / "templates"
templates_intermediate_dir = intermediate_dir / "templates"
readmes = list(glob.glob(str(templates_source_dir) + "/*/README.md"))
destinations = [
readme[len(str(templates_source_dir)) + 1 : -10] + ".md" for readme in readmes
]
for source, destination in zip(readmes, destinations):
full_destination = templates_intermediate_dir / destination
shutil.copyfile(source, full_destination)
with open(full_destination, "r") as f:
content = f.read()
# remove images
content = re.sub(r"\!\[.*?\]\((.*?)\)", "", content)
with open(full_destination, "w") as f:
f.write(content)
sidebar_hidden = """---
sidebar_class_name: hidden
custom_edit_url:
---
"""
# handle index file
templates_index_source = templates_source_dir / "docs" / "INDEX.md"
templates_index_intermediate = templates_intermediate_dir / "index.md"
with open(templates_index_source, "r") as f:
content = f.read()
# replace relative links
content = re.sub(r"\]\(\.\.\/", "](/docs/templates/", content)
with open(templates_index_intermediate, "w") as f:
f.write(sidebar_hidden + content)

View File

@ -383,22 +383,6 @@ module.exports = {
},
},
],
templates: [
{
type: "category",
label: "Templates",
items: [
{
type: "autogenerated",
dirName: "templates",
},
],
link: {
type: "doc",
id: "templates/index",
},
},
],
contributing: [
{
type: "category",

View File

@ -109,6 +109,10 @@
{
"source": "/v0.2/docs/integrations/chat/ollama_functions/",
"destination": "https://python.langchain.com/v0.1/docs/integrations/chat/ollama_functions/"
},
{
"source": "/v0.2/docs/templates/:path(.*/?)*",
"destination": "https://github.com/langchain-ai/langchain/tree/master/templates/:path*"
}
]
}