|
@@ -280,17 +280,18 @@ class LangAreaView(TemplateView):
|
|
# 控制采样随机性的浮点数,值较低时模型更具确定性,值较高时模型更具创造性。"0"表示贪婪取样。默认为0.6。
|
|
# 控制采样随机性的浮点数,值较低时模型更具确定性,值较高时模型更具创造性。"0"表示贪婪取样。默认为0.6。
|
|
"temperature": 0.6
|
|
"temperature": 0.6
|
|
}
|
|
}
|
|
|
|
+ content = ''
|
|
# 延迟请求
|
|
# 延迟请求
|
|
time.sleep(1.1)
|
|
time.sleep(1.1)
|
|
- response = requests.post(url, headers=headers, data=json.dumps(data), verify=False, timeout=10)
|
|
|
|
- text = json.loads(response.text)
|
|
|
|
- choices = text.get('choices')
|
|
|
|
- content = ''
|
|
|
|
- if choices is None:
|
|
|
|
- print(text)
|
|
|
|
- else:
|
|
|
|
- content = choices[0]['message']['content']
|
|
|
|
- return content
|
|
|
|
|
|
+ try:
|
|
|
|
+ response = requests.post(url, headers=headers, data=json.dumps(data), verify=False, timeout=60)
|
|
|
|
+ text = json.loads(response.text)
|
|
|
|
+ choices = text.get('choices')
|
|
|
|
+ if choices is not None:
|
|
|
|
+ content = choices[0]['message']['content']
|
|
|
|
+ return content
|
|
|
|
+ except Exception as e:
|
|
|
|
+ return content
|
|
|
|
|
|
def do_download_avss(self, id):
|
|
def do_download_avss(self, id):
|
|
content = ''
|
|
content = ''
|