Files
dsProject/dsLightRag/Liblib/T2.py
2025-09-03 15:43:10 +08:00

30 lines
1.3 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.

import json
from LiblibUtil import LiblibUtil
if __name__ == '__main__':
liblib = LiblibUtil()
print("===== 测试查询生图结果并上传OBS =====")
test_generate_uuid = "df9bd6e03a204542b1daaba2f17c42e6"
if test_generate_uuid:
# 等待任务完成
status_data = liblib.wait_for_generation_completion(test_generate_uuid)
print(f"生图状态: {json.dumps(status_data, ensure_ascii=False, indent=2)}")
# 检查生成状态是否为5完成
if status_data and status_data.get('generateStatus') == 5:
# 提取图片URL
if status_data.get('images') and len(status_data['images']) > 0:
image_url = status_data['images'][0]['imageUrl']
# 下载并上传到OBS
# 使用实例调用而非类调用
obs_path = liblib.download_and_upload_to_obs(image_url, test_generate_uuid)
if obs_path:
print(f"\n最终OBS路径: {obs_path}")
else:
print("❌ 未找到图片数据")
else:
print(f"❌ 生图未完成或失败,状态码: {status_data.get('generateStatus')}")
else:
print("请先设置有效的生图任务UUID")