31 lines
908 B
Markdown
31 lines
908 B
Markdown
---
|
|
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.
|
|
category: Web Services
|
|
---
|
|
|
|
# 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
|