From 1196e1313de47a79c0a03cade3713bcd21410e20 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Thu, 5 Feb 2026 13:29:10 +0800 Subject: [PATCH] 'commit' --- test01.py | 31 ------------------------------- test02.py | 38 -------------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 test01.py delete mode 100644 test02.py diff --git a/test01.py b/test01.py deleted file mode 100644 index 0a85ab6..0000000 --- a/test01.py +++ /dev/null @@ -1,31 +0,0 @@ -import requests -import json - -# API配置 -url = 'https://api.lingyaai.cn/v1/images/generations' -api_key = 'sk-bSjxX2X1FAptXPcBjItcMcbRvcGFZTtRRcUf52BGQr1dscZM' # 请替换为你的实际API密钥 - -# 请求头 -headers = { - 'Authorization': f'Bearer {api_key}', - 'Content-Type': 'application/json' -} - -# 请求数据 -data = { - 'prompt': '帮我生成一张数字化校园的结构图', - 'model': 'nano-banana-pro', - 'aspect_ratio': '1:1' -} - -# 发送POST请求 -response = requests.post(url, headers=headers, json=data) - -# 打印响应 -print(f'状态码: {response.status_code}') -print(f'响应内容: {response.text}') - -# 如果需要解析JSON响应 -if response.status_code == 200: - result = response.json() - print(f'JSON响应: {json.dumps(result, indent=2, ensure_ascii=False)}') diff --git a/test02.py b/test02.py deleted file mode 100644 index f6a4aca..0000000 --- a/test02.py +++ /dev/null @@ -1,38 +0,0 @@ -import requests -import json - -# API配置 -url = 'https://api.lingyaai.cn/v1/messages' -api_key = 'sk-bSjxX2X1FAptXPcBjItcMcbRvcGFZTtRRcUf52BGQr1dscZM' # 请替换为你的实际API密钥 - -# 读取scene.txt文件内容 -with open('scene.txt', 'r', encoding='utf-8') as f: - scene_content = f.read() - -# 请求头 -headers = { - 'anthropic-version': '2023-06-01', - 'content-type': 'application/json', - 'x-api-key': api_key -} - -# 请求数据 -data = { - 'model': 'claude-sonnet-4-5-20250929', - 'max_tokens': 1024, - 'messages': [ - {'role': 'user', 'content': scene_content} - ] -} - -# 发送POST请求 -response = requests.post(url, headers=headers, json=data) - -# 打印响应 -print(f'状态码: {response.status_code}') -print(f'响应内容: {response.text}') - -# 如果需要解析JSON响应 -if response.status_code == 200: - result = response.json() - print(f'\nJSON响应: {json.dumps(result, indent=2, ensure_ascii=False)}')