chore: 清理测试文件
This commit is contained in:
parent
cf8aaecece
commit
5e7ef87712
Binary file not shown.
@ -1,47 +0,0 @@
|
|||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
url = "https://gw2.oops.asia/v1/chat/completions"
|
|
||||||
headers = {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Authorization": "Bearer sk-f5ba1acb1d61c39f754c28f19d0e6e1b7d8d9fda43ef812ce4e335b6c26eff01"
|
|
||||||
}
|
|
||||||
|
|
||||||
# 测试不同的请求格式
|
|
||||||
test_cases = [
|
|
||||||
{
|
|
||||||
"name": "标准格式",
|
|
||||||
"body": {
|
|
||||||
"model": "gpt-5.4-mini",
|
|
||||||
"messages": [{"role": "user", "content": "Say hi"}],
|
|
||||||
"max_tokens": 20
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "带 temperature",
|
|
||||||
"body": {
|
|
||||||
"model": "gpt-5.4-mini",
|
|
||||||
"messages": [{"role": "user", "content": "Say hi"}],
|
|
||||||
"max_tokens": 20,
|
|
||||||
"temperature": 0.3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "带 stream",
|
|
||||||
"body": {
|
|
||||||
"model": "gpt-5.4-mini",
|
|
||||||
"messages": [{"role": "user", "content": "Say hi"}],
|
|
||||||
"max_tokens": 20,
|
|
||||||
"stream": False
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
for test in test_cases:
|
|
||||||
print(f"\n测试: {test['name']}")
|
|
||||||
try:
|
|
||||||
response = requests.post(url, headers=headers, json=test["body"], timeout=10)
|
|
||||||
print(f" 状态码: {response.status_code}")
|
|
||||||
print(f" 响应: {response.text[:200]}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f" 错误: {e}")
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
from openai import OpenAI
|
|
||||||
|
|
||||||
client = OpenAI(
|
|
||||||
api_key="sk-f5ba1acb1d61c39f754c28f19d0e6e1b7d8d9fda43ef812ce4e335b6c26eff01",
|
|
||||||
base_url="https://gw2.oops.asia/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
models = client.models.list()
|
|
||||||
print("支持的模型列表:")
|
|
||||||
print("-" * 50)
|
|
||||||
for m in models:
|
|
||||||
print(f" {m.id}")
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
from openai import OpenAI
|
|
||||||
|
|
||||||
client = OpenAI(
|
|
||||||
api_key="sk-f5ba1acb1d61c39f754c28f19d0e6e1b7d8d9fda43ef812ce4e335b6c26eff01",
|
|
||||||
base_url="https://gw2.oops.asia/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
response = client.chat.completions.create(
|
|
||||||
model="gpt-5.4-mini",
|
|
||||||
messages=[{"role": "user", "content": "Say hi in Chinese"}],
|
|
||||||
max_tokens=20
|
|
||||||
)
|
|
||||||
print(response.choices[0].message.content)
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
from openai import OpenAI
|
|
||||||
|
|
||||||
client = OpenAI(
|
|
||||||
api_key="sk-f5ba1acb1d61c39f754c28f19d0e6e1b7d8d9fda43ef812ce4e335b6c26eff01",
|
|
||||||
base_url="https://gw2.oops.asia/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
models_to_test = ["gpt-4o-mini", "gpt-4o", "gpt-3.5-turbo", "gpt-5", "gpt-5.5", "claude-sonnet-4-20250514"]
|
|
||||||
|
|
||||||
print("测试可用模型:")
|
|
||||||
print("-" * 50)
|
|
||||||
|
|
||||||
for model in models_to_test:
|
|
||||||
try:
|
|
||||||
response = client.chat.completions.create(
|
|
||||||
model=model,
|
|
||||||
messages=[{"role": "user", "content": "Say hi"}],
|
|
||||||
max_tokens=20
|
|
||||||
)
|
|
||||||
print(f" ✅ {model} - OK")
|
|
||||||
except Exception as e:
|
|
||||||
error_msg = str(e)[:50]
|
|
||||||
print(f" ❌ {model} - {error_msg}")
|
|
||||||
Loading…
x
Reference in New Issue
Block a user