diff --git a/__pycache__/llm_loader.cpython-312.pyc b/__pycache__/llm_loader.cpython-312.pyc index 44156fe..ae81a9b 100644 Binary files a/__pycache__/llm_loader.cpython-312.pyc and b/__pycache__/llm_loader.cpython-312.pyc differ diff --git a/__pycache__/openai_compatible_loader.cpython-312.pyc b/__pycache__/openai_compatible_loader.cpython-312.pyc index 7030a3d..06d32a5 100644 Binary files a/__pycache__/openai_compatible_loader.cpython-312.pyc and b/__pycache__/openai_compatible_loader.cpython-312.pyc differ diff --git a/llm_loader.py b/llm_loader.py index 08843fe..3292eff 100644 --- a/llm_loader.py +++ b/llm_loader.py @@ -84,7 +84,7 @@ class LLM_Loader: "DeepSeek/深度求索": "https://api.deepseek.com/v1", "DouBao/豆包": "https://ark.cn-beijing.volces.com/api/v3", "Spark/星火": "https://spark-api-open.xf-yun.com/v1", - "GLM/智谱清言": "https://open.bigmodel.cn/api/paas/v4", + "GLM/智谱清言": "https://open.bigmodel.cn/api/paas/v4/", "Moonshot/月之暗面": "https://api.moonshot.cn/v1", "Baichuan/百川": "https://api.baichuan-ai.com/v1", "MiniMax/MiniMax": "https://api.minimax.chat/v1", diff --git a/openai_compatible_loader.py b/openai_compatible_loader.py index e4e7a7a..d9bec59 100644 --- a/openai_compatible_loader.py +++ b/openai_compatible_loader.py @@ -6,6 +6,7 @@ import json import asyncio from aiohttp import ClientSession, ClientError from typing import Optional, List, Dict +import time # 添加时间模块 class OpenAICompatibleLoader: @@ -103,6 +104,8 @@ class OpenAICompatibleLoader: print(f"[DEBUG] Generated Payload: {json.dumps(payload, indent=2)}") # 调试日志 try: + # 添加延迟以避免触发速率限制 + time.sleep(1) # 每次请求前等待 1 秒 return asyncio.run(self.async_generate(payload, actual_base_url, api_key)) except Exception as e: raise Exception(f"请求失败: {str(e)}")