This commit is contained in:
Chill
2023-07-31 17:19:54 +08:00
60 changed files with 29332 additions and 1322 deletions

4
app_ai_bard/__init__.py Normal file
View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# from . import controllers
from . import models

View File

@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
# Created on 2023-02-016
# author: 欧度智能https://www.odooai.cn
# email: 300883@qq.com
# resource of odooai
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Google Bard Ai for odoo ai center, 谷歌Ai支持',
'version': '16.23.07.29',
'author': 'odooai.cn',
'company': 'odooai.cn',
'maintainer': 'odooai.cn',
'category': 'Website/Website',
'website': 'https://www.odooai.cn',
'live_test_url': 'https://demo.odooapp.cn',
'license': 'LGPL-3',
'sequence': 10,
'images': ['static/description/banner.gif'],
'summary': '''
Google Bard Ai for Odoo AI Center. Ai Aigc Center including Google Bard Ai, Azure Ai, Baidu Ai.
Support chatgpt 4 image. DALLE, Integration All ChatGpt Api and Azure OpenAI Service.
Easy Chat channel with several ChatGPT Robots and train.
''',
'description': '''
Chat with google bard ai with odoo.
Allows the application to leverage the capabilities of the GPT language model to generate human-like responses,
providing a more natural and intuitive user experience.
odoo bard connector.
1. Multi ChatGpt openAI robot Connector. Chat and train.
2. Multi Ai support including Google Bard Ai, Azure Ai, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
3. Bind ChatGpt Api to user. So we can chat to robot user or use ChatGpt Channel for Group Chat.
4. White and black List for ChatGpt.
5. Setup Demo Chat time for every new user.
6. Easy Start and Stop ChatGpt.
7. Evaluation the ai robot to make better response. This training.
8. Add api support Connect the Microsoft Azure OpenAI Service.
9. Can set Synchronous or Asynchronous mode for Ai response.
10.Filter Sensitive Words Setup.
11. Multi-language Support. Multi-Company Support.
12. Support Odoo 16,15,14,13,12, Enterprise and Community and odoo.sh Edition.
13. Full Open Source.
''',
'depends': [
'app_chatgpt',
],
'data': [
'data/ai_robot_data.xml',
'data/user_partner_data.xml',
],
'assets': {
},
'external_dependencies': {'python': ['bardapi']},
'installable': True,
'application': True,
'auto_install': False,
}

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import main

View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo import http
class ChatgptController(http.Controller):
@http.route(['/chatgpt_form'], type='http', auth="public", csrf=False,
website=True)
def question_submit(self):
return http.request.render('app_chatgpt.connector')

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="robot_google_bard" model="ai.robot">
<field name="name">Google Bard</field>
<field name="provider">google</field>
<field name="ai_model">google-bard</field>
<field name="api_version" eval="False"/>
<field name="endpoint">https://api.bard.ai/v1/text/generate</field>
<field name="sequence">9</field>
</record>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="partner_google_bard" model="res.partner">
<field name="name">Google Bard</field>
<field name="image_1920" type="base64" file="app_ai_bard/static/src/img/bard.gif"/>
</record>
<record id="user_google_bard" model="res.users">
<field name="login">ai_bard@example.com</field>
<field name="email">ai_bard@example.com</field>
<field name="partner_id" ref="partner_google_bard"/>
<field name="gpt_id" ref="robot_google_bard"/>
<field name="company_id" ref="base.main_company"/>
<field name="company_ids" eval="[Command.link(ref('base.main_company'))]"/>
<field name="groups_id" eval="[Command.link(ref('base.group_user'))]"/>
</record> </data>
</odoo>

27481
app_ai_bard/i18n/zh_CN.po Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import ai_robot

View File

@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import requests, json
from odoo.exceptions import UserError
# todo: 暂时直接 requests
# from bardapi import Bard
import os
import logging
_logger = logging.getLogger(__name__)
class AiRobot(models.Model):
_inherit = 'ai.robot'
provider = fields.Selection(
selection_add=[('google', 'Google Ai')],
ondelete={'google': 'cascade'}
),
ai_model = fields.Selection(
selection_add=[('google-bard', 'Google Bard')],
ondelete={'google-bard': 'cascade'})
@api.onchange('provider')
def _onchange_provider(self):
if self.provider == 'google':
self.endpoint = 'https://api.bard.ai/v1/text/generate'
return super()._onchange_provider()
def get_google(self, data, author_id, answer_id, param={}):
self.ensure_one()
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {self.openapi_api_key}"}
R_TIMEOUT = self.ai_timeout or 120
o_url = self.endpoint or "https://api.bard.ai/v1/text/generate"
# todo: 更多参数如 prompt, max_length
max_tokens = param.get('max_tokens') if param.get('max_tokens') else self.max_tokens
temperature = param.get('temperature') if param.get('temperature') else self.temperature
pdata = {
"text": data,
"max_length": max_tokens,
"temperature": temperature,
}
response = requests.post(o_url, data=json.dumps(pdata), headers=headers, timeout=R_TIMEOUT)
response.raise_for_status()
try:
res = response.json()['text']
return res
except Exception as e:
_logger.warning("Get Response Json failed: %s", e)
else:
_logger.warning('=====================Openai output data: %s' % response.json())
def get_google_post(self, res, author_id=False, answer_id=False, param={}):
if self.provider == 'google':
content = res['text']
return content, False, True

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -0,0 +1,264 @@
<section class="oe_container container">
<div class="oe_row oe_spaced" >
<div class="oe_span12">
<h2 class="oe_slogan"> Google Bard Ai for odoo ai center</h2>
<h3 class="oe_slogan"> Ai center addons. all aigc in one. </h3>
<div class="oe_row">
<h3>Lastest update: v16.23.07.29</h3>
<div class="oe_span12">
<div class="row">
<img class="" src="bard.gif">
Add google bard support, update chatgpt api</div>
<img class="oe_demo oe_screenshot" src="demo02.jpg">
</div>
<h3>Lastest update: v16.23.03.16</h3>
<div class="oe_span12">
<img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.png">
</div>
<div class="oe_span12 oe_spaced">
<div class="alert alert-info" style="padding:8px;font-weight: 300; font-size: 20px;">
<i class="fa fa-hand-o-right"></i><b> Key features: </b>
<ul class="list-unstyled">
<li>
<i class="fa fa-check-square-o text-primary"></i>
1. Multi ChatGpt openAI robot Connector. Chat and train.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
2. Multi Ai support including Google Bard Ai, Azure Ai, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
3. Bind ChatGpt Api to user. So we can chat to robot user or use ChatGpt Channel for Group Chat.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
4. White and black List for ChatGpt.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
5. Setup Demo Chat time for every new user.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
6. Easy Start and Stop ChatGpt.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
7. Evaluation the ai robot to make better response. This training.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
8. Add api support Connect the Microsoft Azure OpenAI Service.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
9. Can set Synchronous or Asynchronous mode for Ai response.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
10.Filter Sensitive Words Setup.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
11. Multi-language Support. Multi-Company Support.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
12. Support Odoo 16,15,14,13,12, Enterprise and Community and odoo.sh Edition.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
13. Full Open Source.
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Add more Ai support like google bard, chatgpt 4, baidu china</h1>
<h4 class="oe_slogan"> Need to navigate to odoo app store to install addons</h4>
<div class="oe_demo oe_screenshot">
<img src="demo01.jpg"/>
</div>
<h4 class="oe_slogan">Please apply for the bard api first from google</h4>
<div class="oe_demo oe_screenshot">
<img src="demo03.jpg"/>
</div>
<h4 class="oe_slogan">Setup for your own key</h4>
<div class="oe_demo oe_screenshot">
<img src="demo04.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Easy to use Ai Robot with multi Provider. Easy chat, easy help</h1>
<h4 class="oe_slogan"> Open Ai for more smart. Microsoft Azure chatgpt for china user.</h4>
<div class="oe_demo oe_screenshot">
<img src="demob.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">1. Multi ChatGpt openAI robot Connector. Chat and train.</h1>
<h4 class="oe_slogan"> Goto Setting--> GPT Robot to setup your robot api. </h4>
<p> Input your api key, And Select the api model you need to use.</p>
<div class="oe_demo oe_screenshot">
<img src="demo1.jpg"/>
</div>
<p> You can set the Temperature higer for more creative answer.</p>
<div class="oe_demo oe_screenshot">
<img src="demo2.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">2. Multi Api support, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.</h1>
<h4 class="oe_slogan"> Choose the model you want to use</h4>
<div class="oe_demo oe_screenshot">
<img src="demo2.jpg"/>
</div>
<p> You can set the Temperature higer for more creative answer.</p>
<div class="oe_demo oe_screenshot">
<img src="demo3.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">3. Bind ChatGpt Api to user. So we can chat to robot user or use ChatGpt Channel for Group Chat.</h1>
<h4 class="oe_slogan"> Go Settings ->users, bind chatgpt to some user.</h4>
<img src="demo4.jpg"/>
</div>
<h4 class="oe_slogan"> So you can have many user, and many chatgpt robot. This provide you an Ai pool.</h4>
<div class="oe_demo oe_screenshot">
<img src="demo5.jpg"/>
</div>
<h4 class="oe_slogan"> You can set the blacklist to this chatgpt robot to limit request. Also you can setup Demo time for every normal user..</h4>
<div class="oe_demo oe_screenshot">
<img src="demo6.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">4. White and black List for ChatGpt.</h1>
<h1 class="text-danger text-center">5. Setup Demo Chat time for every new user.</h1>
<h4 class="oe_slogan"> You can set the blacklist to this chatgpt robot to limit request. Also you can setup Demo time for every normal user..</h4>
<div class="oe_demo oe_screenshot">
<img src="demo6.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">6. Easy Start and Stop ChatGpt..</h1>
<h4 class="oe_slogan"> You can easy chat with the apt robot with odoo IM</h4>
<div class="oe_demo oe_screenshot">
<img src="demo7.jpg"/>
</div>
<h4 class="oe_slogan"> You can chat with several robot in the same time</h4>
<div class="oe_demo oe_screenshot">
<img src="demo8.jpg"/>
</div>
<h4 class="oe_slogan"> If you have more than 1 robot in the group. you can @ the specify robot.</h4>
<div class="oe_demo oe_screenshot">
<img src="demo9.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">7. Evaluation the ai robot to make better response. This training.</h1>
<h4 class="oe_slogan"> You can Evaluation chatgpt's answer. Mark as good for good answer. Mark as back for bad answer.</h4>
<p> With Evaluation, you can make your ai robot more smart.
<div class="oe_demo oe_screenshot">
<img src="demo71.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">8. Add api support Connect the Microsoft Azure OpenAI Service.</h1>
<h4 class="oe_slogan"> Azure openai add. It is for china and other country which no chatgpt service.</h4>
<div class="oe_demo oe_screenshot">
<img src="demo81.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">9. Can set Synchronous or Asynchronous mode for Ai response.</h1>
<h4 class="oe_slogan"> Synchronous(default) mode can get response then ask question again. Asynchronous mode would make you do other thing when waiting for response.</h4>
<div class="oe_demo oe_screenshot">
<img src="demo91.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Multi-language Support..</h1>
<h4 class="oe_slogan"> </h4>
<div class="oe_demo oe_screenshot">
<img src="cnreadme.jpg"/>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Technical Help & Support</h2>
</div>
<div class="col-md-12 pad0">
<div class="oe_mt16">
<p><h4>
For any type of technical help & support requests, Feel free to contact us</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
<p><h4>
Via QQ: 300883 (App user would not get QQ or any other IM support. Only for odoo project customize.)</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> 300883@qq.com</a>
</div>
<div class="oe_mt16">
<p><h4>
Visit our website for more support.</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="https://www.odooai.cn" target="_blank"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-web"></i>https://www.odooai.cn</a>
</div>
</div>
</div>
<div class="oe_row oe_spaced text-center">
<h1>More Powerful addons, Make your odoo very easy to use, easy customize:
<a class="btn btn-primary mb16" href="http://www.odoo.com/apps/modules/browse?author=odooai.cn">odooai.cn Odoo Addons</a>
</h1>
</div>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="ai_robot_tree_view" model="ir.ui.view">
<field name="name">ai.robot.tree</field>
<field name="model">ai.robot</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="provider" optional="hide"/>
<field name="ai_model" optional="show"/>
<field name="openapi_api_key" password="True"/>
<field name="max_tokens" optional="show"/>
<field name="temperature"/>
<field name="max_send_char"/>
</tree>
</field>
</record>
<record id="ai_robot_form_view" model="ir.ui.view">
<field name="name">ai.robot.form</field>
<field name="model">ai.robot</field>
<field name="arch" type="xml">
<form>
<header>
<button string="Get List Model" type="object" name="get_ai_list_model"/>
<button string="Get Model Info" type="object" name="get_ai_model_info"/>
</header>
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="Robot Name" required="1"/>
</h1>
</div>
<group>
<group>
<field name="openapi_api_key" password="True" required="True"/>
<field name="temperature"/>
<field name="top_p"/>
<field name="frequency_penalty"/>
<field name="presence_penalty"/>
<field name="sys_content" placeholder="Role-playing and scene setting.Give the model instructions about how it should behave and any context it should reference when generating a response."/>
<field name="max_send_char"/>
</group>
<group>
<field name="ai_model"/>
<label class="o_form_label" for="provider">
OpenAI Document
</label>
<div>
<field name="provider"/>
<a href="https://platform.openai.com/docs/introduction" title="OpenAI Document" class="o_doc_link" target="_blank"></a>
</div>
<field name="max_tokens"/>
<field name="engine"/>
<field name="endpoint"/>
<field name="api_version"/>
<field name="ai_timeout"/>
<field name="sequence"/>
</group>
<group>
<field name="is_filtering"/>
<field name="sensitive_words" attrs="{'invisible': [('is_filtering', '=', False)]}"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_ai_robot" model="ir.actions.act_window">
<field name="name">GPT Robot</field>
<field name="res_model">ai.robot</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Let's create a GPT Robot.
</p>
</field>
</record>
<record id="model_ai_robot_action_disconnect" model="ir.actions.server">
<field name="name">Disconnect</field>
<field name="model_id" ref="app_chatgpt.model_ai_robot"/>
<field name="binding_model_id" ref="app_chatgpt.model_ai_robot"/>
<field name="binding_view_types">list,form</field>
<field name="state">code</field>
<field name="code">action = records.action_disconnect()</field>
</record>
<menuitem
id="menu_ai_robot"
name="GPT Robot"
parent="base.menu_users"
sequence="2"
action="action_ai_robot"
groups="base.group_system"/>
</odoo>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<odoo>
<record id="is_res_config_settings_view" model="ir.ui.view">
<field name="name">res.config.settings.view.form.is.chatgpt.inherit</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='integration']" position="after">
<h2>Ai Center Setup</h2>
<div class="col-xs-12 col-md-6 row o_settings_container" id="chatgpt_integration">
<div class="col-12 o_web_settings_compact_subtitle">
Support by
<a target="_blank" href="https://www.odooai.cn" style="text-decoration: underline;">odooAi.cn</a>
</div>
<div class="col-12 col-lg-12 o_setting_box" id="ai_base_setting">
<div class="o_setting_right_pane border-start-0">
<div class="content-group">
<div class="o_web_settings_compact_subtitle">
<label class="col-4" string="Timout then disconnect(s)" for="openapi_context_timeout"/>
<field name="openapi_context_timeout" title="After timeout seconds then Disconnect" style="width: 200px !important;"/>Seconds
</div>
<div class="row mt0">
<label class="col-4" for="openai_sync_config"/>
<field name="openai_sync_config" style="width: 200px !important;"/>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-12 o_setting_box" id="ai_google_integraion">
<div class="o_setting_left_pane">
<field name="module_app_ai_bard"/>
</div>
<div class="o_setting_right_pane">
<label for="module_app_ai_bard"/>
<a href="https://apps.odoo.com/apps/modules/16.0/app_ai_bard/"
title="Get Google Bard Ai from https://apps.odoo.com/apps/modules/16.0/app_ai_bard" class="o_doc_link ml8" target="_blank"></a>
</div>
</div>
<div class="col-lg-6 col-12 o_setting_box" id="ai_baidu_integraion">
<div class="o_setting_left_pane">
<field name="module_app_ai_baidu"/>
</div>
<div class="o_setting_right_pane">
<label for="module_app_ai_baidu"/>
<a href="https://apps.odoo.com/apps/modules/16.0/app_ai_baidu/"
title="Get Baidu Ai from https://apps.odoo.com/apps/modules/16.0/app_ai_baidu" class="o_doc_link ml8" target="_blank"></a>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_partner_ai_use_tree_view" model="ir.ui.view">
<field name="name">res.partner.ai.use.tree</field>
<field name="model">res.partner.ai.use</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="ai_user_id" optional="show"/>
<field name="first_ask_time" optional="show"/>
<field name="latest_ask_time" optional="show"/>
<field name="service_start_date" optional="show"/>
<field name="service_end_date" optional="show"/>
<field name="used_number" sum="Total" optional="hide"/>
<field name="max_number" sum="Total" optional="hide"/>
<field name="human_prompt_tokens" sum="Total" optional="show"/>
<field name="ai_completion_tokens" sum="Total" optional="show"/>
<field name="tokens_total" sum="Total" optional="show"/>
<field name="token_balance" sum="Total" optional="show"/>
<field name="token_allow" sum="Total" optional="show"/>
</tree>
</field>
</record>
<record id="res_partner_ai_use_form_view" model="ir.ui.view">
<field name="name">res.partner.ai.use.form</field>
<field name="model">res.partner.ai.use</field>
<field name="arch" type="xml">
<form>
<sheet>
<label for="name"/>
<h1>
<field name="name"/>
</h1>
<group>
<group>
<field name="ai_user_id"/>
<field name="first_ask_time"/>
<field name="latest_ask_time"/>
<field name="service_start_date"/>
<field name="service_end_date"/>
<field name="used_number" readonly="True"/>
<field name="max_number" readonly="True"/>
<field name="token_balance" readonly="True"/>
</group>
<group>
<field name="human_prompt_tokens" readonly="True"/>
<field name="ai_completion_tokens" readonly="True"/>
<field name="tokens_total" readonly="True"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="res_partner_ai_use_search_view" model="ir.ui.view">
<field name="name">res.partner.ai.use.search</field>
<field name="model">res.partner.ai.use</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="ai_user_id"/>
<searchpanel>
<field name="ai_user_id"/>
</searchpanel>
</search>
</field>
</record>
<record id="action_res_partner_ai_use" model="ir.actions.act_window">
<field name="name">Partner Ai Use</field>
<field name="res_model">res.partner.ai.use</field>
<field name="view_mode">tree,form</field>
<field name="context">{'create': 0, 'delete': 0}</field>
</record>
<record id="action_res_users_2_partner_ai_use" model="ir.actions.act_window">
<field name="name">Partner Ai Use</field>
<field name="res_model">res.partner.ai.use</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('ai_user_id', 'in', active_ids)]</field>
<field name="context">{'default_ai_user_id':active_id,}</field>
</record>
<menuitem
id="menu_res_partner_ai_use"
name="Partner Ai Use"
parent="base.menu_users"
sequence="3"
action="action_res_partner_ai_use"
groups="base.group_system"/>
</odoo>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="app_chatgpt_res_users_form" model="ir.ui.view">
<field name="name">app.chatgpt.res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(app_chatgpt.action_res_users_2_partner_ai_use)d" type="action" string="Partner Ai Use" icon="fa-comments">
</button>
</xpath>
<xpath expr="//page[@name='preferences']" position="after">
<page name="page_chatgpt" string="ChatGPT">
<group>
<group>
<field name="gpt_id"/>
<field name="gpt_policy"/>
<field name="gpt_wl_partners" widget="many2many_tags" attrs="{'invisible': [('gpt_policy', '=', 'all')]}"/>
<field name="gpt_demo_time"/>
</group>
</group>
</page>
</xpath>
</field>
</record>
<!-- search-->
<record id="app_view_users_search" model="ir.ui.view">
<field name="name">app.res.users.search</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='filter_no_share']" position="before">
<filter name="is_robot" string="Ai User" domain="[('gpt_id','!=',False)]"/>
<filter name="not_robot" string="Not Ai" domain="[('gpt_id','=',False)]"/>
<separator/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -9,8 +9,8 @@
# Copyright (c) 2020-Present InTechual Solutions. (<https://intechualsolutions.com/>)
{
'name': 'Latest ChatGPT4 AI Center. GPT 4 for image, Dall-E Image.Multi Robot Support. Chat and Training',
'version': '16.23.04.27',
'name': 'ChatGPT4,Google Bard, AiGC Center.Ai服务中心聚合全网Ai',
'version': '16.23.07.29',
'author': 'odooai.cn',
'company': 'odooai.cn',
'maintainer': 'odooai.cn',
@@ -19,19 +19,18 @@
'live_test_url': 'https://demo.odooapp.cn',
'license': 'LGPL-3',
'sequence': 10,
'license': 'AGPL-3',
'images': ['static/description/banner.gif'],
'summary': '''
ChatGpt Odoo AI Center. Multi Odoo ChatGPT Robot. Support chatgpt 4 image. 3.5 turbo, text-davinci, DALL·E, Integration All ChatGpt Api and Azure OpenAI Service.
ChatGpt Odoo AI Center. Multi Ai aigc support with Google Bard Ai, Azure Ai, Baidu Ai,etc..
Support chatgpt 4 32k image. DALLE, Integration All ChatGpt Api and Azure OpenAI.
Easy Chat channel with several ChatGPT Robots and train.
Whitelist and blacklist for Users or IP.
''',
'description': '''
Allows the application to leverage the capabilities of the GPT language model to generate human-like responses,
providing a more natural and intuitive user experience.
Base on is_chatgpt_integration from InTechual Solutions.
1. Multi ChatGpt openAI robot Connector. Chat and train.
2. Multi Api support, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
2. Multi Ai support including Google Bard Ai, Azure Ai, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
3. Bind ChatGpt Api to user. So we can chat to robot user or use ChatGpt Channel for Group Chat.
4. White and black List for ChatGpt.
5. Setup Demo Chat time for every new user.

View File

@@ -6,8 +6,7 @@
<field name="image_1920" type="base64" file="app_chatgpt/static/description/chatgpt.png"/>
</record>
<record id="user_chatgpt" model="res.users">
<field name="login">chatgpt@odooai.cn</field>
<field name="password">chatgpt</field>
<field name="login">chatgpt@example.com</field>
<field name="partner_id" ref="app_chatgpt.partner_chatgpt"/>
<field name="gpt_id" ref="app_chatgpt.chatgpt_robot"/>
<field name="company_id" ref="base.main_company"/>
@@ -21,9 +20,8 @@
</record>
<record id="user_chatgpt1" model="res.users">
<field name="login">chatgpt1@odooai.cn</field>
<field name="email">chatgpt1@odooai.cn</field>
<field name="password">chatgpt</field>
<field name="login">chatgpt1@example.com</field>
<field name="email">chatgpt1@example.com</field>
<field name="partner_id" ref="app_chatgpt.partner_chatgpt1"/>
<field name="gpt_id" ref="app_chatgpt.chatgpt_robot1"/>
<field name="company_id" ref="base.main_company"/>
@@ -37,9 +35,8 @@
</record>
<record id="user_chatgpt2" model="res.users">
<field name="login">chatgpt2@odooai.cn</field>
<field name="email">chatgpt2@odooai.cn</field>
<field name="password">chatgpt</field>
<field name="login">chatgpt2@example.com</field>
<field name="email">chatgpt2@example.com</field>
<field name="partner_id" ref="app_chatgpt.partner_chatgpt2"/>
<field name="gpt_id" ref="app_chatgpt.chatgpt_robot2"/>
<field name="company_id" ref="base.main_company"/>
@@ -53,9 +50,8 @@
</record>
<record id="user_chatgpt3_azure" model="res.users">
<field name="login">chatgpt3_azure@odooai.cn</field>
<field name="email">chatgpt3_azure@odooai.cn</field>
<field name="password">chatgpt</field>
<field name="login">chatgpt3_azure@example.com</field>
<field name="email">chatgpt3_azure@example.com</field>
<field name="partner_id" ref="app_chatgpt.partner_chatgpt3_azure"/>
<field name="gpt_id" ref="app_chatgpt.chatgpt3_azure"/>
<field name="company_id" ref="base.main_company"/>
@@ -68,9 +64,8 @@
</record>
<record id="user_chatgpt4_azure" model="res.users">
<field name="login">chatgpt4_azure@odooai.cn</field>
<field name="email">chatgpt4_azure@odooai.cn</field>
<field name="password">chatgpt</field>
<field name="login">chatgpt4_azure@example.com</field>
<field name="email">chatgpt4_azure@example.com</field>
<field name="partner_id" ref="app_chatgpt.partner_chatgpt4_azure"/>
<field name="gpt_id" ref="app_chatgpt.chatgpt4_azure"/>
<field name="company_id" ref="base.main_company"/>

View File

@@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e-20230424\n"
"Project-Id-Version: Odoo Server 16.0+e-20230721\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-04-25 08:32+0000\n"
"PO-Revision-Date: 2023-04-25 08:32+0000\n"
"POT-Creation-Date: 2023-07-29 10:11+0000\n"
"PO-Revision-Date: 2023-07-29 10:11+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -599,6 +599,7 @@ msgstr "Ai服务中心(Chatgpt)"
#. module: app_chatgpt
#: model:ir.model.fields,field_description:app_chatgpt.field_res_partner_ai_use__ai_user_id
#: model_terms:ir.ui.view,arch_db:app_chatgpt.app_view_users_search
msgid "Ai User"
msgstr "Ai用户"
@@ -852,6 +853,11 @@ msgstr ""
msgid "Chatgpt 4"
msgstr ""
#. module: app_chatgpt
#: model:ir.model.fields.selection,name:app_chatgpt.selection__ai_robot__ai_model__gpt-4-32k
msgid "Chatgpt 4 32k"
msgstr ""
#. module: app_chatgpt
#. odoo-javascript
#: code:addons/app_chatgpt/static/src/models_data/emoji_data.js:0
@@ -1000,7 +1006,7 @@ msgstr ""
#. module: app_chatgpt
#: model:ir.model,name:app_chatgpt.model_mail_thread
msgid "Email Thread"
msgstr "EMail线程"
msgstr "邮件会话"
#. module: app_chatgpt
#: model:ir.model.fields,field_description:app_chatgpt.field_ai_robot__endpoint
@@ -1150,7 +1156,7 @@ msgstr ""
#. module: app_chatgpt
#: model:ir.model,name:app_chatgpt.model_ai_robot
msgid "Gpt Robot"
msgstr ""
msgstr "GPT机器人"
#. module: app_chatgpt
#. odoo-javascript
@@ -1548,6 +1554,16 @@ msgstr ""
msgid "Max Number of Call"
msgstr "提问次数限制"
#. module: app_chatgpt
#: model:ir.model.fields,field_description:app_chatgpt.field_ai_robot__max_send_char
msgid "Max Send Char"
msgstr ""
#. module: app_chatgpt
#: model:ir.model.fields,help:app_chatgpt.field_ai_robot__max_send_char
msgid "Max Send Prompt Length"
msgstr ""
#. module: app_chatgpt
#: model:ir.model.fields,field_description:app_chatgpt.field_ai_robot__max_tokens
msgid "Max response"
@@ -1677,10 +1693,16 @@ msgstr ""
#. module: app_chatgpt
#. odoo-python
#: code:addons/app_chatgpt/models/ai_robot.py:0
#: code:addons/app_chatgpt/models/ai_robot.py:0
#, python-format
msgid "No robot provider found"
msgstr "没有设置Ai接口供应方"
#. module: app_chatgpt
#: model_terms:ir.ui.view,arch_db:app_chatgpt.app_view_users_search
msgid "Not Ai"
msgstr ""
#. module: app_chatgpt
#: model:ir.model.fields,field_description:app_chatgpt.field_res_partner_ai_use__used_number
msgid "Number of Used"
@@ -1870,6 +1892,7 @@ msgstr ""
#: code:addons/app_chatgpt/models/ai_robot.py:0
#: code:addons/app_chatgpt/models/ai_robot.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#, python-format
msgid "Response Timeout, please speak again."
msgstr ""
@@ -27415,6 +27438,14 @@ msgstr ""
msgid "ココ"
msgstr ""
#. module: app_chatgpt
#. odoo-python
#: code:addons/app_chatgpt/models/mail_channel.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#, python-format
msgid "您所发送的提示词已超长。"
msgstr ""
#. module: app_chatgpt
#. odoo-javascript
#: code:addons/app_chatgpt/static/src/components/message/message.xml:0
@@ -27424,6 +27455,7 @@ msgstr ""
#. module: app_chatgpt
#. odoo-python
#: code:addons/app_chatgpt/models/ai_robot.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#, python-format
msgid "此Ai暂时未开放请联系管理员。"
@@ -27438,6 +27470,7 @@ msgstr ""
#. odoo-python
#: code:addons/app_chatgpt/models/ai_robot.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#: code:addons/app_chatgpt/models/mail_channel.py:0
#, python-format
msgid "温馨提示:您发送的内容含有敏感词,请修改内容后再向我发送。"
msgstr ""

View File

@@ -18,6 +18,8 @@ class AiRobot(models.Model):
name = fields.Char(string='Name', translate=True, required=True)
provider = fields.Selection(string="AI Provider", selection=[('openai', 'OpenAI'), ('azure', 'Azure')], required=True, default='openai')
ai_model = fields.Selection(string="AI Model", selection=[
('gpt-3.5-turbo-0613', 'gpt-3.5-turbo-0613(Default and Latest)'),
('gpt-3.5-turbo-16k-0613', 'gpt-3.5-turbo-16k-0613(Big text)'),
('gpt-4', 'Chatgpt 4'),
('gpt-4-32k', 'Chatgpt 4 32k'),
('gpt-3.5-turbo', 'Chatgpt 3.5 Turbo'),
@@ -26,7 +28,7 @@ class AiRobot(models.Model):
('code-davinci-002', 'Chatgpt 2 Code Optimized'),
('text-davinci-002', 'Chatgpt 2 Davinci'),
('dall-e2', 'Dall-E Image'),
], required=True, default='gpt-3.5-turbo',
], required=True, default='gpt-3.5-turbo-0613',
help="""
GPT-4: Can understand Image, generate natural language or code.
GPT-3.5: A set of models that improve on GPT-3 and can understand as well as generate natural language or code
@@ -184,10 +186,13 @@ GPT-3 A set of models that can understand and generate natural language
usage = res['usage']
content = res['choices'][0]['message']['content']
# _logger.warning('===========Ai响应:%s' % content)
else:
elif self.provider == 'azure':
# azure 格式
usage = json.loads(json.dumps(res['usage']))
content = json.loads(json.dumps(res['choices'][0]['message']['content']))
else:
usage = False
content = res
data = content.replace(' .', '.').strip()
answer_user = answer_id.mapped('user_ids')[:1]
if usage:

View File

@@ -11,3 +11,6 @@ class ResConfigSettings(models.TransientModel):
('sync', 'Synchronous'),
('async', 'Asynchronous')
], string='Sync Config', default='sync', config_parameter="app_chatgpt.openai_sync_config")
module_app_ai_bard = fields.Boolean("Google Bard Ai")
module_app_ai_baidu = fields.Boolean("Baidu Ai China", help='百度文心一格')
module_app_ai_ali = fields.Boolean("Ali Ai China", help='阿里通义千问')

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,6 @@
"owned_by": "openai",
"permission": [
{
"id": "modelperm-ZErASyl63fhYUeMMk7QKOHAB",
"object": "model_permission",
"created": 1677691854,
"allow_create_engine": false,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -4,9 +4,17 @@
<h2 class="oe_slogan"> Latest ChatGPT AI Center. GPT 3.5, Dall-E Image.Multi Robot Support. Chat and Training </h2>
<h3 class="oe_slogan"> Support chatgpt 4 image. 3.5 turbo, text-davinci, DALL·E, Integration All ChatGpt Api. </h3>
<div class="oe_row">
<h3>Lastest update: v16.23.07.29</h3>
<div class="oe_span12">
<div class="row">
<img class="" src="bard.gif">
Add google bard support(search 'app_ai_bard'), update chatgpt api
</div>
<img class="oe_demo oe_screenshot" src="demo02.jpg">
</div>
<h3>Lastest update: v16.23.03.16</h3>
<div class="oe_span12">
<img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.gif">
<img class="oe_demo oe_screenshot" style="max-height: 100%;" src="banner.png">
</div>
<div class="oe_span12 oe_spaced">
<div class="alert alert-info" style="padding:8px;font-weight: 300; font-size: 20px;">
@@ -18,7 +26,7 @@
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
2. Multi Api support, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
2. Multi Ai support including Google Bard Ai, Azure Ai, Chatgpt 4, Chatgpt 3.5 Turbo, Chatgpt 3 Davinci, Chatgpt 2 Code Optimized, 'Dall-E Image.
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
@@ -72,6 +80,24 @@
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Add more Ai support like google bard, chatgpt 4, baidu china</h1>
<h4 class="oe_slogan"> Need to navigate to odoo app store to install addons</h4>
<div class="oe_demo oe_screenshot">
<img src="demo01.jpg"/>
</div>
<h4 class="oe_slogan">Please apply for the bard api first from google</h4>
<div class="oe_demo oe_screenshot">
<img src="demo03.jpg"/>
</div>
<h4 class="oe_slogan">Setup for your own key</h4>
<div class="oe_demo oe_screenshot">
<img src="demo04.jpg"/>
</div>
</div>
</section>
<section class="oe_container container">
<div class="oe_row oe_spaced">
<h1 class="text-danger text-center">Easy to use Ai Robot with multi Provider. Easy chat, easy help</h1>

View File

@@ -6,23 +6,46 @@
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='integration']" position="after">
<h2>Ai Center(Chatgpt)</h2>
<div class="col-xs-12 row o_settings_container" id="chatgpt_integraion">
<div class="col-xs-12 col-md-10 o_setting_box">
<h2>Ai Center Setup</h2>
<div class="col-xs-12 col-md-6 row o_settings_container" id="chatgpt_integration">
<div class="col-12 o_web_settings_compact_subtitle">
Support by
<a target="_blank" href="https://www.odooai.cn" style="text-decoration: underline;">odooAi.cn</a>
</div>
<div class="col-12 col-lg-12 o_setting_box" id="ai_base_setting">
<div class="o_setting_right_pane border-start-0">
<div class="content-group">
<div class="row mt0">
<label class="col-lg-2" string="Timout then disconnect(s)" for="openapi_context_timeout"/>
<field name="openapi_context_timeout" title="After timeout seconds then Disconnect" style="width: 10% !important;"/>Seconds
<div class="o_web_settings_compact_subtitle">
<label class="col-4" string="Timout then disconnect(s)" for="openapi_context_timeout"/>
<field name="openapi_context_timeout" title="After timeout seconds then Disconnect" style="width: 200px !important;"/>Seconds
</div>
<div class="row mt0">
<label class="col-lg-2" for="openai_sync_config"/>
<field name="openai_sync_config" style="width: 10% !important;"/>
<label class="col-4" for="openai_sync_config"/>
<field name="openai_sync_config" style="width: 200px !important;"/>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-12 o_setting_box" id="ai_google_integraion">
<div class="o_setting_left_pane">
<field name="module_app_ai_bard"/>
</div>
<div class="o_setting_right_pane">
<label for="module_app_ai_bard"/>
<a href="https://apps.odoo.com/apps/modules/16.0/app_ai_bard/"
title="Get Google Bard Ai from https://apps.odoo.com/apps/modules/16.0/app_ai_bard" class="o_doc_link ml8" target="_blank"></a>
</div>
</div>
<div class="col-lg-6 col-12 o_setting_box" id="ai_baidu_integraion">
<div class="o_setting_left_pane">
<field name="module_app_ai_baidu"/>
</div>
<div class="o_setting_right_pane">
<label for="module_app_ai_baidu"/>
<a href="https://apps.odoo.com/apps/modules/16.0/app_ai_baidu/"
title="Get Baidu Ai from https://apps.odoo.com/apps/modules/16.0/app_ai_baidu" class="o_doc_link ml8" target="_blank"></a>
</div>
</div>
</div>
</xpath>
</field>