mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 23:54:14 +00:00
docs: remove templates (#25717)
- [x] check redirect works at template root - [x] check redirect works within individual template page
This commit is contained in:
parent
90439b12f6
commit
0022ae1b31
@ -39,7 +39,6 @@ install-py-deps:
|
|||||||
generate-files:
|
generate-files:
|
||||||
mkdir -p $(INTERMEDIATE_DIR)
|
mkdir -p $(INTERMEDIATE_DIR)
|
||||||
cp -r $(SOURCE_DIR)/* $(INTERMEDIATE_DIR)
|
cp -r $(SOURCE_DIR)/* $(INTERMEDIATE_DIR)
|
||||||
mkdir -p $(INTERMEDIATE_DIR)/templates
|
|
||||||
|
|
||||||
$(PYTHON) scripts/tool_feat_table.py $(INTERMEDIATE_DIR)
|
$(PYTHON) scripts/tool_feat_table.py $(INTERMEDIATE_DIR)
|
||||||
|
|
||||||
@ -47,8 +46,6 @@ generate-files:
|
|||||||
|
|
||||||
$(PYTHON) scripts/partner_pkg_table.py $(INTERMEDIATE_DIR)
|
$(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
|
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/
|
$(PYTHON) scripts/resolve_local_links.py $(INTERMEDIATE_DIR)/langserve.md https://github.com/langchain-ai/langserve/tree/main/
|
||||||
|
|
||||||
|
@ -194,11 +194,6 @@ const config = {
|
|||||||
docId: "contributing/index",
|
docId: "contributing/index",
|
||||||
label: "Contributing",
|
label: "Contributing",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: "docSidebar",
|
|
||||||
sidebarId: "templates",
|
|
||||||
label: "Templates",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "Cookbooks",
|
label: "Cookbooks",
|
||||||
href: "https://github.com/langchain-ai/langchain/blob/master/cookbook/README.md"
|
href: "https://github.com/langchain-ai/langchain/blob/master/cookbook/README.md"
|
||||||
@ -247,14 +242,6 @@ const config = {
|
|||||||
href: "https://docs.smith.langchain.com/",
|
href: "https://docs.smith.langchain.com/",
|
||||||
label: "LangSmith Docs",
|
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",
|
href: "https://smith.langchain.com/hub",
|
||||||
label: "LangChain Hub",
|
label: "LangChain Hub",
|
||||||
|
@ -8,16 +8,16 @@ if [ "$VERCEL_ENV" == "production" ] || [ "$VERCEL_GIT_COMMIT_REF" == "master" ]
|
|||||||
echo "✅ Production build - proceeding with build"
|
echo "✅ Production build - proceeding with build"
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
echo "Checking for changes in docs/ and templates/:"
|
echo "Checking for changes in docs/"
|
||||||
echo "---"
|
echo "---"
|
||||||
git log -n 50 --pretty=format:"%s" -- . ../templates | grep -v '(#'
|
git log -n 50 --pretty=format:"%s" -- . | grep -v '(#'
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "---"
|
echo "---"
|
||||||
echo "✅ Changes detected in docs/ or templates/ - proceeding with build"
|
echo "✅ Changes detected in docs/ - proceeding with build"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "---"
|
echo "---"
|
||||||
echo "🛑 No changes detected in docs/ or templates/ - ignoring build"
|
echo "🛑 No changes detected in docs/ - ignoring build"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -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)
|
|
@ -383,22 +383,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
templates: [
|
|
||||||
{
|
|
||||||
type: "category",
|
|
||||||
label: "Templates",
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
type: "autogenerated",
|
|
||||||
dirName: "templates",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
link: {
|
|
||||||
type: "doc",
|
|
||||||
id: "templates/index",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
contributing: [
|
contributing: [
|
||||||
{
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
|
@ -109,6 +109,10 @@
|
|||||||
{
|
{
|
||||||
"source": "/v0.2/docs/integrations/chat/ollama_functions/",
|
"source": "/v0.2/docs/integrations/chat/ollama_functions/",
|
||||||
"destination": "https://python.langchain.com/v0.1/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*"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user