Skip to content

Commit cccfc10

Browse files
authored
Feature/revise docs ci (#5009)
1 parent a2aea59 commit cccfc10

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/release-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
make compile
5050
5151
make html
52+
python3 wrap_run_llm.py
5253
cd _build/html
5354
5455
git clone https://[email protected]/sgl-project/sgl-project.github.io.git ../sgl-project.github.io --depth 1

docs/wrap_run_llm.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import os
2+
import re
3+
4+
5+
def insert_runllm_widget(html_content):
6+
# RunLLM Widget script to be inserted
7+
widget_script = """
8+
<!-- RunLLM Widget Script -->
9+
<script type="module" id="runllm-widget-script" src="https://widget.runllm.com" crossorigin="true" version="stable" runllm-keyboard-shortcut="Mod+j" runllm-name="SGLang Chatbot" runllm-position="BOTTOM_RIGHT" runllm-assistant-id="629" async></script>
10+
"""
11+
12+
# Find the closing body tag and insert the widget script before it
13+
return re.sub(r"</body>", f"{widget_script}\n</body>", html_content)
14+
15+
16+
def main():
17+
# Get the build directory path
18+
build_dir = os.path.join(
19+
os.path.dirname(os.path.abspath(__file__)), "_build", "html"
20+
)
21+
index_file = os.path.join(build_dir, "index.html")
22+
23+
# Process only index.html
24+
if os.path.exists(index_file):
25+
# Read the HTML file
26+
with open(index_file, "r", encoding="utf-8") as f:
27+
content = f.read()
28+
29+
# Insert the RunLLM widget
30+
modified_content = insert_runllm_widget(content)
31+
32+
# Write back the modified content
33+
with open(index_file, "w", encoding="utf-8") as f:
34+
f.write(modified_content)
35+
else:
36+
print(f"Index file not found: {index_file}")
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)