Compare commits
No commits in common. "a1754feaf3bda1bfc62abe2709a903ff45e6812b" and "f6e8f569ed818f27c64233e8fc29adef0d7e48b9" have entirely different histories.
a1754feaf3
...
f6e8f569ed
@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
name: static-hosting
|
|
||||||
description: Serve static HTML/CSS/JS/images from robot project directories via the built-in FastAPI static file server. Use when generating web pages, reports, or interactive content for a bot.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Static Hosting
|
|
||||||
|
|
||||||
Host static files (HTML, CSS, JS, images, fonts, etc.) under the bot's project directory and get public URLs.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Write files to `/app/projects/robot/{ASSISTANT_ID}/`, then run the script to get the public URL:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 {SKILL_DIR}/scripts/get_url.py <absolute_path>
|
|
||||||
```
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 {SKILL_DIR}/scripts/get_url.py /app/projects/robot/{ASSISTANT_ID}/index.html
|
|
||||||
# => https://engine.aitravelmaster.com/robots/[bot-id]/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- Inside HTML, use **relative paths** to reference other assets (e.g. `href="css/style.css"`)
|
|
||||||
- `index.html` is auto-served at the directory URL
|
|
||||||
- All files under `/robots/` are publicly accessible, no authentication
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
FASTAPI_URL = os.getenv("FASTAPI_URL", "https://engine.aitravelmaster.com")
|
|
||||||
ASSISTANT_ID = os.getenv("ASSISTANT_ID", "")
|
|
||||||
|
|
||||||
if not ASSISTANT_ID:
|
|
||||||
print("Error: ASSISTANT_ID environment variable is not set")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print(f"Usage: python3 {sys.argv[0]} <file_path>")
|
|
||||||
print(f"Example: python3 {sys.argv[0]} /app/projects/robot/{ASSISTANT_ID}/index.html")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
file_path = os.path.abspath(sys.argv[1])
|
|
||||||
|
|
||||||
workspace_root = f"/app/projects/robot/{ASSISTANT_ID}"
|
|
||||||
if not file_path.startswith(workspace_root):
|
|
||||||
print(f"Error: path must be under {workspace_root}, got: {file_path}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
relative_path = file_path[len(workspace_root):] # e.g. "/css/style.css"
|
|
||||||
base_url = f"{FASTAPI_URL.rstrip('/')}/robots/{ASSISTANT_ID}"
|
|
||||||
print(f"{base_url}{relative_path}")
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
name: static-hosting
|
|
||||||
description: Serve static HTML/CSS/JS/images from robot project directories via the built-in FastAPI static file server. Use when generating web pages, reports, or interactive content for a bot.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Static Hosting
|
|
||||||
|
|
||||||
Host static files (HTML, CSS, JS, images, fonts, etc.) under `/workspace/` and get public URLs.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Write files to `/workspace/`, then run the script to get the public URL:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 {SKILL_DIR}/scripts/get_url.py <absolute_path>
|
|
||||||
```
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 {SKILL_DIR}/scripts/get_url.py /workspace/index.html
|
|
||||||
# => https://api-dev.gptbase.ai/robot-assets/[bot-id]/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- Inside HTML, use **relative paths** to reference other assets (e.g. `href="css/style.css"`)
|
|
||||||
- `/workspace/index.html` is auto-served at the directory URL
|
|
||||||
- All files under `/robot-assets/` are publicly accessible, no authentication
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
BACKEND_HOST = os.getenv("BACKEND_HOST", "https://api-dev.gptbase.ai")
|
|
||||||
ASSISTANT_ID = os.getenv("ASSISTANT_ID", "")
|
|
||||||
|
|
||||||
if not ASSISTANT_ID:
|
|
||||||
print("Error: ASSISTANT_ID environment variable is not set")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print(f"Usage: python3 {sys.argv[0]} <file_path>")
|
|
||||||
print(f"Example: python3 {sys.argv[0]} /workspace/index.html")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
file_path = os.path.abspath(sys.argv[1])
|
|
||||||
|
|
||||||
workspace_root = "/workspace"
|
|
||||||
if not file_path.startswith(workspace_root):
|
|
||||||
print(f"Error: path must be under {workspace_root}, got: {file_path}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
relative_path = file_path[len(workspace_root):] # e.g. "/css/style.css"
|
|
||||||
base_url = f"{BACKEND_HOST.rstrip('/')}/robot-assets/{ASSISTANT_ID}"
|
|
||||||
print(f"{base_url}{relative_path}")
|
|
||||||
Loading…
Reference in New Issue
Block a user