Some checks failed
AI Web Tester CI / test (push) Has been cancelled
主要改进: - 新增统一测试器 (universal_tester.py) 支持多种测试模式 - 优化测试报告生成器,支持汇总报告和操作截图 - 增强探索器 DFS 算法和状态指纹识别 - 新增智能测试配置 (smart_test.yaml) - 改进 AI 模型集成 (GLM/Gemini 支持) - 添加开发调试工具和文档
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
import os
|
|
import requests
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
def test_glm_auth():
|
|
api_key = os.getenv("GLM_API_KEY")
|
|
base_url = os.getenv("GLM_BASE_URL", "https://open.bigmodel.cn/api/paas/v4/chat/completions")
|
|
model = os.getenv("GLM_MODEL", "glm-4v-flash")
|
|
|
|
print(f"Testing GLM Auth with:")
|
|
print(f"URL: {base_url}")
|
|
print(f"Model: {model}")
|
|
print(f"Key: {api_key[:10]}...{api_key[-5:] if api_key else ''}")
|
|
|
|
try:
|
|
response = requests.post(
|
|
base_url,
|
|
headers={
|
|
"Authorization": f"Bearer {api_key}",
|
|
"Content-Type": "application/json"
|
|
},
|
|
json={
|
|
"model": model,
|
|
"messages": [{"role": "user", "content": "hi"}],
|
|
"max_tokens": 10
|
|
},
|
|
timeout=10
|
|
)
|
|
print(f"Status Code: {response.status_code}")
|
|
print(f"Response: {response.text}")
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
test_glm_auth()
|