mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
fix res
This commit is contained in:
@@ -18,7 +18,7 @@ class Channel(models.Model):
|
|||||||
def get_openai(self, gpt_id, provider, api_key, ai_model, data, user="Odoo"):
|
def get_openai(self, gpt_id, provider, api_key, ai_model, data, user="Odoo"):
|
||||||
if provider == 'azure':
|
if provider == 'azure':
|
||||||
res = gpt_id.get_openai(data)
|
res = gpt_id.get_openai(data)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
|
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
|
||||||
R_TIMEOUT = 30
|
R_TIMEOUT = 30
|
||||||
@@ -77,10 +77,7 @@ class Channel(models.Model):
|
|||||||
if 'choices' in res:
|
if 'choices' in res:
|
||||||
res = '\n'.join([x['text'] for x in res['choices']])
|
res = '\n'.join([x['text'] for x in res['choices']])
|
||||||
return res
|
return res
|
||||||
elif provider == 'azure':
|
|
||||||
res = gpt_id.get_openai(data)
|
|
||||||
return res
|
|
||||||
|
|
||||||
return "获取结果超时,请重新跟我聊聊。"
|
return "获取结果超时,请重新跟我聊聊。"
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
|||||||
Reference in New Issue
Block a user