self-media-james/scripts/upload_qiniu_003.py
邓文兵 76c9a60379 feat(article): 添加 GPT-5.4 深度解析文章及配套图表
- 新增 GPT-5.4 深度解析文章,涵盖六大核心能力详解
- 添加 SVG 格式的 GPT-5.4 能力全景图
- 添加 Mermaid 格式的模型家族关系图
- 添加 GPT-5.4 六大能力思维导图
- 添加 Computer Use 工作流程图
- 添加 OSWorld 桌面操作基准测试图表
- 添加 上下文窗口演进对比图
- 添加 上下文压缩原理图
- 添加 Tool Search 机制对比图
- 添加 可配置推理深度图
- 添加 GDPval 对比图表
- 添加 三方模型对比图
- 添加 API 定价对比图
- 添加 Mermaid 配置文件和样式文件
- 添加模型选择指南 SVG 图片
2026-03-16 16:28:42 +08:00

54 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""上传文章 003 的所有图片到七牛云 OSS"""
import os
import glob
from qiniu import Auth, put_file
ACCESS_KEY = 't1PIPGcvBY9lJVXFZFb48maTQsGGhvLsR5QQlNq0'
SECRET_KEY = 'KGooFdF5eCLdCIMCOD6x5ofMzu4vYE17T5Mvp9qC'
BUCKET_NAME = 'union-saas'
CDN_DOMAIN = 'https://cdn.union.jxyunge.com'
UPLOAD_PREFIX = 'self-media/003/'
def upload_file(local_path, key):
"""上传单个文件到七牛"""
q = Auth(ACCESS_KEY, SECRET_KEY)
token = q.upload_token(BUCKET_NAME, key, 3600)
ret, info = put_file(token, key, local_path, version='v2')
if info.status_code == 200:
url = f'{CDN_DOMAIN}/{key}'
print(f' OK {os.path.basename(local_path)} -> {url}')
return url
else:
print(f' FAIL {os.path.basename(local_path)}: {info}')
return None
def main():
img_dir = os.path.join(os.path.dirname(__file__), '..', 'articles', '003')
# 收集所有图片文件PNG + SVG
files = sorted(
glob.glob(os.path.join(img_dir, '*.png'))
+ glob.glob(os.path.join(img_dir, '*.svg'))
)
results = {}
for f in files:
name = os.path.basename(f)
key = UPLOAD_PREFIX + name
url = upload_file(f, key)
if url:
results[name] = url
print(f'\n===== 上传完成: {len(results)}/{len(files)} =====')
for name, url in results.items():
print(f'{name}: {url}')
return results
if __name__ == '__main__':
main()