This commit is contained in:
2025-08-18 15:58:31 +08:00
parent 7e95ccc0d0
commit 12bafdde8a
3 changed files with 28 additions and 47 deletions

View File

@@ -3,7 +3,7 @@ import requests
from Config.Config import GPTNB_API_KEY
class ModelInteractor:
def __init__(self, api_key=GPTNB_API_KEY, api_url="https://goapi.gptnb.ai/v1/chat/completions"):
def __init__(self, api_key=GPTNB_API_KEY, api_url="https://goapi.gptnb.ai/v1/chat/completions"): # 修复URL
self.api_key = api_key
self.api_url = api_url
self.headers = {
@@ -45,7 +45,7 @@ class ModelInteractor:
response = requests.post(
self.api_url,
headers=self.headers,
data=json.dumps(payload),
data=json.dumps(payload), # 确保变量名一致
stream=True,
timeout=30
)