Overview
- Skill Key
- hexiaochun/cdn-url-transfer
- Author
- hexiaochun
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/hexiaochun/cdn-url-transfer
- Latest Commit SHA
- 9d3e5d6f70f70923301e845e5743dcca732b3a61
将模型配置中的外部示例 URL(fal.media、googleapis 等)转存到速推 CDN(cdn-video.51sux.com),并更新代码和校验 API 返回。当用户提到"转存 CDN"、"替换示例链接"、"转存链接"、"CDN 地址"、"示例 URL 替换"时使用此 skill。
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 cdn-url-transfer 技能。 若已安装,则直接安装 cdn-url-transfer 技能。
# 模型示例 URL 转存 CDN
将模型配置中的外部文件链接(fal.media、googleapis 等)转存到速推 CDN,确保示例资源稳定可访问。
## 需替换的 URL 位置
每个模型最多有 **3 处** URL 需要替换,全部在 `model_registry.py` 中:
| 位置 | 字段 | 说明 |
|------|------|------|
| 1 | `parameters[].examples` | 输入参数的示例值(图片/视频 URL) |
| 2 | `output_example` | 输出结果示例中的媒体 URL |
| 3 | executor 的 `get_params_schema()` | 执行器中的参数 schema(与位置 1 保持同步) |
**关键文件:**
- **主数据源**(docs API 读取):`translate_api/app/api/v3/transports/mcp/model_registry.py`
- **执行器**(运行时使用):`translate_api/app/api/v3/executors/` 下对应的 executor 文件
## 操作流程
### Step 1: 扫描目标模型的外部 URL
用 Grep 在 `model_registry.py` 中搜索目标模型相关的外部域名:
```
搜索模式: fal\.media|googleapis\.com|其他外部域名
范围: model_registry.py 中目标模型的注册块
```
同时搜索对应 executor 文件中的 `examples` 字段。
### Step 2: 上传文件到 CDN
#### 方案 A:MCP `upload_image` 工具(仅限小图片 base64)
> **已知问题**:`upload_image` 的 `image_url` 参数(URL 转存模式)**经常失败**,返回空错误。
> 仅 `image_data`(base64 模式)可靠,但受工具参数大小限制,仅适合 **< 100KB** 的小图片。
```
upload_image(
image_data="<base64字符串>",
file_name="模型名_用途.png",
folder="模型名-examples"
)
```
#### 方案 B:curl 下载 + TOS Python SDK 直传(推荐)
这是最可靠的方案,支持**任意文件类型和大小**(图片、音频、视频)。
**第一步:用 curl 下载到本地**(curl 不走 Python 代理,更稳定)
```bash
curl -sL -o /tmp/文件名.png "原始外部URL"
curl -sL -o /tmp/文件名.mp3 "原始外部URL"
```
**第二步:用 TOS SDK 上传到 CDN**
```python
import tos
TOS_CONFIG = {
'access_key': 'AKLTZTBhMDdlYTdlODdlNGFlNGFjNTliOGEwOWFkNzk0Mjk',
'secret_key': 'TnpVMk9EUmtNREkzWmpjNU5EazVNVGxsTkRnMk9XUXlZMk15WldRNVpqUQ==',
'endpoint': 'tos-cn-guangzhou.volces.com',
'region': 'cn-guangzhou',
'bucket_name': 'fal-task',
'public_domain': 'https://cdn-video.51sux.com'
}
client = tos.Tos...
human-pages-ai
Search and hire real humans for tasks — photography, delivery, research, and more
zseven-w
Reusable skill templates for OpenClaw AI agents. Templates for API integration, data processing, web scraping, CLI tools, and file processing.
capt-marbles
Attio CRM integration for managing companies, people, deals, notes, tasks, and custom objects. Use when working with Attio CRM data, searching contacts, managing sales pipelines, adding notes to records, creating tasks, or syncing prospect information.
capt-marbles
Web scraping and crawling with Firecrawl API. Fetch webpage content as markdown, take screenshots, extract structured data, search the web, and crawl documentation sites. Use when the user needs to scrape a URL, get current web info, capture a screenshot, extract specific data from pages, or crawl docs for a framework/library.
caqlayan
Tweet Processor Skill
carlosarturoleon
Connect to Windsor.ai MCP for natural language access to 325+ data sources including Facebook Ads, GA4, HubSpot, Shopify, and more.