prepare #I6GEBT [app_chatgpt]ChatGpt对接增加训练功能 置顶

This commit is contained in:
ivan deng
2023-02-20 19:31:19 +08:00
parent 86db8027dc
commit a00157ea46
3 changed files with 21979 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
{ {
'name': 'ChatGPT Robot Multi Chat and Training(Under Construction)', 'name': 'ChatGPT Robot Multi Chat and Training(Under Construction)',
'version': '16.23.02.15', 'version': '16.23.02.20',
'author': 'Sunpop.cn', 'author': 'Sunpop.cn',
'company': 'Sunpop.cn', 'company': 'Sunpop.cn',
'maintainer': 'Sunpop.cn', 'maintainer': 'Sunpop.cn',
@@ -19,6 +19,7 @@
'license': 'LGPL-3', 'license': 'LGPL-3',
'sequence': 10, 'sequence': 10,
'license': 'AGPL-3', 'license': 'AGPL-3',
'images': ['static/description/banner.png'],
'summary': ''' 'summary': '''
Multi Odoo ChatGPT Robot. Integration All ChatGpt Api. Multi Odoo ChatGPT Robot. Integration All ChatGpt Api.
Chat channel with several ChatGPT Robots. Chat channel with several ChatGPT Robots.
@@ -42,8 +43,15 @@
'data/ir_config_parameter.xml', 'data/ir_config_parameter.xml',
'views/res_config_settings_views.xml', 'views/res_config_settings_views.xml',
], ],
'assets': {
'mail.assets_messaging': [
'app_chatgpt/static/src/models/*.js',
],
'mail.assets_model_data': [
'app_chatgpt/static/src/models_data/*.js',
],
},
'external_dependencies': {'python': ['openai']}, 'external_dependencies': {'python': ['openai']},
'images': ['static/description/banner.png'],
'installable': True, 'installable': True,
'application': False, 'application': False,
'auto_install': False, 'auto_install': False,

View File

@@ -0,0 +1,48 @@
/** @odoo-module **/
import { insert } from '@mail/model/model_field_command';
import { getBundle, loadBundle } from '@web/core/assets';
import { registerPatch } from '@mail/model/model_core';
registerPatch({
name: 'EmojiRegistry',
recordMethods: {
async loadEmojiData() {
this.update({isLoading: true});
await getBundle('mail.assets_model_data').then(loadBundle);
//优化 data 文件
const {emojiCategoriesData, emojisData} = await odoo.runtimeImport("@app_chatgpt/models_data/emoji_data");
if (!this.exists()) {
return;
}
this._populateFromEmojiData(emojiCategoriesData, emojisData);
},
async _populateFromEmojiData(dataCategories, dataEmojis) {
dataCategories.map(category => {
const emojiCount = dataEmojis.reduce((acc, emoji) => emoji.category === category.name ? acc + 1 : acc, 0);
this.update({
dataCategories: insert({
name: category.name,
displayName: category.displayName,
title: category.title,
sortId: category.sortId,
emojiCount,
}),
});
});
this.models['Emoji'].insert(dataEmojis.map(emojiData => ({
codepoints: emojiData.codepoints,
shortcodes: emojiData.shortcodes,
emoticons: emojiData.emoticons,
name: emojiData.name,
keywords: emojiData.keywords,
emojiDataCategory: {name: emojiData.category},
})));
this.update({
isLoaded: true,
isLoading: false,
});
},
},
}
)

File diff suppressed because it is too large Load Diff