mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
[16] kimi图文支持
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'ChatGPT4, China Ali,AiGC Center.Ai服务中心,聚合全网Ai',
|
'name': 'ChatGPT4, China Ali,AiGC Center.Ai服务中心,聚合全网Ai',
|
||||||
'version': '16.0.25.02.10',
|
'version': '16.0.25.02.11',
|
||||||
'author': 'odooai.cn',
|
'author': 'odooai.cn',
|
||||||
'company': 'odooai.cn',
|
'company': 'odooai.cn',
|
||||||
'maintainer': 'odooai.cn',
|
'maintainer': 'odooai.cn',
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ GPT-3 A set of models that can understand and generate natural language
|
|||||||
# hook,都正常
|
# hook,都正常
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def get_msg_file_content(self, message):
|
||||||
|
# hook
|
||||||
|
return False
|
||||||
|
|
||||||
def get_ai(self, data, author_id=False, answer_id=False, param={}):
|
def get_ai(self, data, author_id=False, answer_id=False, param={}):
|
||||||
# 通用方法
|
# 通用方法
|
||||||
# author_id: 请求的 partner_id 对象
|
# author_id: 请求的 partner_id 对象
|
||||||
|
|||||||
@@ -320,22 +320,48 @@ class Channel(models.Model):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# 处理提示词
|
# 处理提示词
|
||||||
sys_content = channel.description + add_sys_content
|
sys_content = '%s%s' % (channel.description if channel.description else "", add_sys_content if add_sys_content else "")
|
||||||
|
if len(sys_content):
|
||||||
messages.append({"role": "system", "content": sys_content})
|
messages.append({"role": "system", "content": sys_content})
|
||||||
c_history = self.get_openai_context(channel.id, author_id, answer_id, openapi_context_timeout, chat_count)
|
c_history = self.get_openai_context(channel.id, author_id, answer_id, openapi_context_timeout, chat_count)
|
||||||
if c_history:
|
if c_history:
|
||||||
messages += c_history
|
messages += c_history
|
||||||
|
if message.attachment_ids:
|
||||||
|
attachment = message.attachment_ids[:1]
|
||||||
|
file_content = ai.get_msg_file_content(message)
|
||||||
|
if not file_content:
|
||||||
|
messages.append({"role": "user", "content": msg})
|
||||||
|
if attachment.mimetype in ['image/jpeg', 'image/png', 'image/gif', 'image/bmp', 'image/webp']:
|
||||||
|
messages.append({
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "image_url",
|
||||||
|
"image_url": {
|
||||||
|
"url": file_content,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": msg
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
messages.append({"role": "system", "content": file_content})
|
||||||
|
messages.append({"role": "user", "content": msg})
|
||||||
|
else:
|
||||||
messages.append({"role": "user", "content": msg})
|
messages.append({"role": "user", "content": msg})
|
||||||
msg_len = sum(len(str(m)) for m in messages)
|
msg_len = sum(len(str(m)) for m in messages)
|
||||||
# 接口最大接收 8430 Token
|
# 接口最大接收 8430 Token
|
||||||
if msg_len * 2 > ai.max_send_char:
|
# if msg_len * 2 > ai.max_send_char:
|
||||||
messages = []
|
# messages = []
|
||||||
messages.append({"role": "user", "content": msg})
|
# messages.append({"role": "user", "content": msg})
|
||||||
msg_len = sum(len(str(m)) for m in messages)
|
# msg_len = sum(len(str(m)) for m in messages)
|
||||||
if msg_len * 2 > ai.max_send_char:
|
# if msg_len * 2 > ai.max_send_char:
|
||||||
new_msg = channel.with_user(user_id).message_post(body=_('您所发送的提示词已超长。'), message_type='comment',
|
# new_msg = channel.with_user(user_id).message_post(body=_('您所发送的提示词已超长。'), message_type='comment',
|
||||||
subtype_xmlid='mail.mt_comment',
|
# subtype_xmlid='mail.mt_comment',
|
||||||
parent_id=message.id)
|
# parent_id=message.id)
|
||||||
|
|
||||||
# if msg_len * 2 >= 8000:
|
# if msg_len * 2 >= 8000:
|
||||||
# messages = [{"role": "user", "content": msg}]
|
# messages = [{"role": "user", "content": msg}]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<h2 class="oe_slogan"> Latest ChatGPT AI Center. GPT 3.5, Ali Ai, Baidu Ai, Multi Robot Support. Chat and Training </h2>
|
<h2 class="oe_slogan"> Latest ChatGPT AI Center. GPT 3.5, Ali Ai, Baidu Ai, Multi Robot Support. Chat and Training </h2>
|
||||||
<h3 class="oe_slogan"> Support GPT-4o, chatgpt 4 32k. 3.5 turbo, text-davinci, Integration All ChatGpt Api. </h3>
|
<h3 class="oe_slogan"> Support GPT-4o, chatgpt 4 32k. 3.5 turbo, text-davinci, Integration All ChatGpt Api. </h3>
|
||||||
<div class="oe_row">
|
<div class="oe_row">
|
||||||
<h3>Latest update: v16.0.25.02.10</h3>
|
<h3>Latest update: v16.0.25.02.11</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
Add Alibaba Qwen support(search 'app_ai_ali'), update chatgpt api
|
Add Alibaba Qwen support(search 'app_ai_ali'), update chatgpt api
|
||||||
|
|||||||
Reference in New Issue
Block a user