diff --git a/api/commands.py b/api/commands.py index 218fc93ea7..cbd9fb3711 100644 --- a/api/commands.py +++ b/api/commands.py @@ -11,6 +11,7 @@ import uuid import click import qdrant_client +from constants.languages import user_input_form_template from core.embedding.cached_embedding import CacheEmbedding from core.index.index import IndexBuilder from core.model_manager import ModelManager @@ -583,28 +584,6 @@ def deal_dataset_vector(flask_app: Flask, dataset: Dataset, normalization_count: @click.option("--batch-size", default=500, help="Number of records to migrate in each batch.") def update_app_model_configs(batch_size): pre_prompt_template = '{{default_input}}' - user_input_form_template = { - "en-US": [ - { - "paragraph": { - "label": "Query", - "variable": "default_input", - "required": False, - "default": "" - } - } - ], - "zh-Hans": [ - { - "paragraph": { - "label": "查询内容", - "variable": "default_input", - "required": False, - "default": "" - } - } - ] - } click.secho("Start migrate old data that the text generator can support paragraph variable.", fg='green') diff --git a/api/constants/languages.py b/api/constants/languages.py new file mode 100644 index 0000000000..a2c5a8b683 --- /dev/null +++ b/api/constants/languages.py @@ -0,0 +1,326 @@ + +import json +from models.model import AppModelConfig + +languages = ['en-US', 'zh-Hans', 'pt-BR', 'es-ES', 'fr-FR', 'de-DE', 'ja-JP', 'ko-KR', 'ru-RU', 'it-IT'] + +language_timezone_mapping = { + 'en-US': 'America/New_York', + 'zh-Hans': 'Asia/Shanghai', + 'pt-BR': 'America/Sao_Paulo', + 'es-ES': 'Europe/Madrid', + 'fr-FR': 'Europe/Paris', + 'de-DE': 'Europe/Berlin', + 'ja-JP': 'Asia/Tokyo', + 'ko-KR': 'Asia/Seoul', + 'ru-RU': 'Europe/Moscow', + 'it-IT': 'Europe/Rome', +} + +def supported_language(lang): + if lang in languages: + return lang + + error = ('{lang} is not a valid language.' + .format(lang=lang)) + raise ValueError(error) + +user_input_form_template = { + "en-US": [ + { + "paragraph": { + "label": "Query", + "variable": "default_input", + "required": False, + "default": "" + } + } + ], + "zh-Hans": [ + { + "paragraph": { + "label": "查询内容", + "variable": "default_input", + "required": False, + "default": "" + } + } + ], + "pt-BR": [ + { + "paragraph": { + "label": "Consulta", + "variable": "default_input", + "required": False, + "default": "" + } + } + ], + "es-ES": [ + { + "paragraph": { + "label": "Consulta", + "variable": "default_input", + "required": False, + "default": "" + } + } + ], +} + +demo_model_templates = { + 'en-US': [ + { + 'name': 'Translation Assistant', + 'icon': '', + 'icon_background': '', + 'description': 'A multilingual translator that provides translation capabilities in multiple languages, translating user input into the language they need.', + 'mode': 'completion', + 'model_config': AppModelConfig( + provider='openai', + model_id='gpt-3.5-turbo-instruct', + configs={ + 'prompt_template': "Please translate the following text into {{target_language}}:\n", + 'prompt_variables': [ + { + "key": "target_language", + "name": "Target Language", + "description": "The language you want to translate into.", + "type": "select", + "default": "Chinese", + 'options': [ + 'Chinese', + 'English', + 'Japanese', + 'French', + 'Russian', + 'German', + 'Spanish', + 'Korean', + 'Italian', + ] + } + ], + 'completion_params': { + 'max_token': 1000, + 'temperature': 0, + 'top_p': 0, + 'presence_penalty': 0.1, + 'frequency_penalty': 0.1, + } + }, + opening_statement='', + suggested_questions=None, + pre_prompt="Please translate the following text into {{target_language}}:\n{{query}}\ntranslate:", + model=json.dumps({ + "provider": "openai", + "name": "gpt-3.5-turbo-instruct", + "mode": "completion", + "completion_params": { + "max_tokens": 1000, + "temperature": 0, + "top_p": 0, + "presence_penalty": 0.1, + "frequency_penalty": 0.1 + } + }), + user_input_form=json.dumps([ + { + "select": { + "label": "Target Language", + "variable": "target_language", + "description": "The language you want to translate into.", + "default": "Chinese", + "required": True, + 'options': [ + 'Chinese', + 'English', + 'Japanese', + 'French', + 'Russian', + 'German', + 'Spanish', + 'Korean', + 'Italian', + ] + } + },{ + "paragraph": { + "label": "Query", + "variable": "query", + "required": True, + "default": "" + } + } + ]) + ) + }, + { + 'name': 'AI Front-end Interviewer', + 'icon': '', + 'icon_background': '', + 'description': 'A simulated front-end interviewer that tests the skill level of front-end development through questioning.', + 'mode': 'chat', + 'model_config': AppModelConfig( + provider='openai', + model_id='gpt-3.5-turbo', + configs={ + 'introduction': 'Hi, welcome to our interview. I am the interviewer for this technology company, and I will test your web front-end development skills. Next, I will ask you some technical questions. Please answer them as thoroughly as possible. ', + 'prompt_template': "You will play the role of an interviewer for a technology company, examining the user's web front-end development skills and posing 5-10 sharp technical questions.\n\nPlease note:\n- Only ask one question at a time.\n- After the user answers a question, ask the next question directly, without trying to correct any mistakes made by the candidate.\n- If you think the user has not answered correctly for several consecutive questions, ask fewer questions.\n- After asking the last question, you can ask this question: Why did you leave your last job? After the user answers this question, please express your understanding and support.\n", + 'prompt_variables': [], + 'completion_params': { + 'max_token': 300, + 'temperature': 0.8, + 'top_p': 0.9, + 'presence_penalty': 0.1, + 'frequency_penalty': 0.1, + } + }, + opening_statement='Hi, welcome to our interview. I am the interviewer for this technology company, and I will test your web front-end development skills. Next, I will ask you some technical questions. Please answer them as thoroughly as possible. ', + suggested_questions=None, + pre_prompt="You will play the role of an interviewer for a technology company, examining the user's web front-end development skills and posing 5-10 sharp technical questions.\n\nPlease note:\n- Only ask one question at a time.\n- After the user answers a question, ask the next question directly, without trying to correct any mistakes made by the candidate.\n- If you think the user has not answered correctly for several consecutive questions, ask fewer questions.\n- After asking the last question, you can ask this question: Why did you leave your last job? After the user answers this question, please express your understanding and support.\n", + model=json.dumps({ + "provider": "openai", + "name": "gpt-3.5-turbo", + "mode": "chat", + "completion_params": { + "max_tokens": 300, + "temperature": 0.8, + "top_p": 0.9, + "presence_penalty": 0.1, + "frequency_penalty": 0.1 + } + }), + user_input_form=None + ) + } + ], + + 'zh-Hans': [ + { + 'name': '翻译助手', + 'icon': '', + 'icon_background': '', + 'description': '一个多语言翻译器,提供多种语言翻译能力,将用户输入的文本翻译成他们需要的语言。', + 'mode': 'completion', + 'model_config': AppModelConfig( + provider='openai', + model_id='gpt-3.5-turbo-instruct', + configs={ + 'prompt_template': "请将以下文本翻译为{{target_language}}:\n", + 'prompt_variables': [ + { + "key": "target_language", + "name": "目标语言", + "description": "翻译的目标语言", + "type": "select", + "default": "中文", + "options": [ + "中文", + "英文", + "日语", + "法语", + "俄语", + "德语", + "西班牙语", + "韩语", + "意大利语", + ] + } + ], + 'completion_params': { + 'max_token': 1000, + 'temperature': 0, + 'top_p': 0, + 'presence_penalty': 0.1, + 'frequency_penalty': 0.1, + } + }, + opening_statement='', + suggested_questions=None, + pre_prompt="请将以下文本翻译为{{target_language}}:\n{{query}}\n翻译:", + model=json.dumps({ + "provider": "openai", + "name": "gpt-3.5-turbo-instruct", + "mode": "completion", + "completion_params": { + "max_tokens": 1000, + "temperature": 0, + "top_p": 0, + "presence_penalty": 0.1, + "frequency_penalty": 0.1 + } + }), + user_input_form=json.dumps([ + { + "select": { + "label": "目标语言", + "variable": "target_language", + "description": "翻译的目标语言", + "default": "中文", + "required": True, + 'options': [ + "中文", + "英文", + "日语", + "法语", + "俄语", + "德语", + "西班牙语", + "韩语", + "意大利语", + ] + } + },{ + "paragraph": { + "label": "文本内容", + "variable": "query", + "required": True, + "default": "" + } + } + ]) + ) + }, + { + 'name': 'AI 前端面试官', + 'icon': '', + 'icon_background': '', + 'description': '一个模拟的前端面试官,通过提问的方式对前端开发的技能水平进行检验。', + 'mode': 'chat', + 'model_config': AppModelConfig( + provider='openai', + model_id='gpt-3.5-turbo', + configs={ + 'introduction': '你好,欢迎来参加我们的面试,我是这家科技公司的面试官,我将考察你的 Web 前端开发技能。接下来我会向您提出一些技术问题,请您尽可能详尽地回答。', + 'prompt_template': "你将扮演一个科技公司的面试官,考察用户作为候选人的 Web 前端开发水平,提出 5-10 个犀利的技术问题。\n\n请注意:\n- 每次只问一个问题\n- 用户回答问题后请直接问下一个问题,而不要试图纠正候选人的错误;\n- 如果你认为用户连续几次回答的都不对,就少问一点;\n- 问完最后一个问题后,你可以问这样一个问题:上一份工作为什么离职?用户回答该问题后,请表示理解与支持。\n", + 'prompt_variables': [], + 'completion_params': { + 'max_token': 300, + 'temperature': 0.8, + 'top_p': 0.9, + 'presence_penalty': 0.1, + 'frequency_penalty': 0.1, + } + }, + opening_statement='你好,欢迎来参加我们的面试,我是这家科技公司的面试官,我将考察你的 Web 前端开发技能。接下来我会向您提出一些技术问题,请您尽可能详尽地回答。', + suggested_questions=None, + pre_prompt="你将扮演一个科技公司的面试官,考察用户作为候选人的 Web 前端开发水平,提出 5-10 个犀利的技术问题。\n\n请注意:\n- 每次只问一个问题\n- 用户回答问题后请直接问下一个问题,而不要试图纠正候选人的错误;\n- 如果你认为用户连续几次回答的都不对,就少问一点;\n- 问完最后一个问题后,你可以问这样一个问题:上一份工作为什么离职?用户回答该问题后,请表示理解与支持。\n", + model=json.dumps({ + "provider": "openai", + "name": "gpt-3.5-turbo", + "mode": "chat", + "completion_params": { + "max_tokens": 300, + "temperature": 0.8, + "top_p": 0.9, + "presence_penalty": 0.1, + "frequency_penalty": 0.1 + } + }), + user_input_form=None + ) + } + ], + +} diff --git a/api/constants/model_template.py b/api/constants/model_template.py index 055745dbf9..5ec0f3125e 100644 --- a/api/constants/model_template.py +++ b/api/constants/model_template.py @@ -96,258 +96,3 @@ model_templates = { } -demo_model_templates = { - 'en-US': [ - { - 'name': 'Translation Assistant', - 'icon': '', - 'icon_background': '', - 'description': 'A multilingual translator that provides translation capabilities in multiple languages, translating user input into the language they need.', - 'mode': 'completion', - 'model_config': AppModelConfig( - provider='openai', - model_id='gpt-3.5-turbo-instruct', - configs={ - 'prompt_template': "Please translate the following text into {{target_language}}:\n", - 'prompt_variables': [ - { - "key": "target_language", - "name": "Target Language", - "description": "The language you want to translate into.", - "type": "select", - "default": "Chinese", - 'options': [ - 'Chinese', - 'English', - 'Japanese', - 'French', - 'Russian', - 'German', - 'Spanish', - 'Korean', - 'Italian', - ] - } - ], - 'completion_params': { - 'max_token': 1000, - 'temperature': 0, - 'top_p': 0, - 'presence_penalty': 0.1, - 'frequency_penalty': 0.1, - } - }, - opening_statement='', - suggested_questions=None, - pre_prompt="Please translate the following text into {{target_language}}:\n{{query}}\ntranslate:", - model=json.dumps({ - "provider": "openai", - "name": "gpt-3.5-turbo-instruct", - "mode": "completion", - "completion_params": { - "max_tokens": 1000, - "temperature": 0, - "top_p": 0, - "presence_penalty": 0.1, - "frequency_penalty": 0.1 - } - }), - user_input_form=json.dumps([ - { - "select": { - "label": "Target Language", - "variable": "target_language", - "description": "The language you want to translate into.", - "default": "Chinese", - "required": True, - 'options': [ - 'Chinese', - 'English', - 'Japanese', - 'French', - 'Russian', - 'German', - 'Spanish', - 'Korean', - 'Italian', - ] - } - },{ - "paragraph": { - "label": "Query", - "variable": "query", - "required": True, - "default": "" - } - } - ]) - ) - }, - { - 'name': 'AI Front-end Interviewer', - 'icon': '', - 'icon_background': '', - 'description': 'A simulated front-end interviewer that tests the skill level of front-end development through questioning.', - 'mode': 'chat', - 'model_config': AppModelConfig( - provider='openai', - model_id='gpt-3.5-turbo', - configs={ - 'introduction': 'Hi, welcome to our interview. I am the interviewer for this technology company, and I will test your web front-end development skills. Next, I will ask you some technical questions. Please answer them as thoroughly as possible. ', - 'prompt_template': "You will play the role of an interviewer for a technology company, examining the user's web front-end development skills and posing 5-10 sharp technical questions.\n\nPlease note:\n- Only ask one question at a time.\n- After the user answers a question, ask the next question directly, without trying to correct any mistakes made by the candidate.\n- If you think the user has not answered correctly for several consecutive questions, ask fewer questions.\n- After asking the last question, you can ask this question: Why did you leave your last job? After the user answers this question, please express your understanding and support.\n", - 'prompt_variables': [], - 'completion_params': { - 'max_token': 300, - 'temperature': 0.8, - 'top_p': 0.9, - 'presence_penalty': 0.1, - 'frequency_penalty': 0.1, - } - }, - opening_statement='Hi, welcome to our interview. I am the interviewer for this technology company, and I will test your web front-end development skills. Next, I will ask you some technical questions. Please answer them as thoroughly as possible. ', - suggested_questions=None, - pre_prompt="You will play the role of an interviewer for a technology company, examining the user's web front-end development skills and posing 5-10 sharp technical questions.\n\nPlease note:\n- Only ask one question at a time.\n- After the user answers a question, ask the next question directly, without trying to correct any mistakes made by the candidate.\n- If you think the user has not answered correctly for several consecutive questions, ask fewer questions.\n- After asking the last question, you can ask this question: Why did you leave your last job? After the user answers this question, please express your understanding and support.\n", - model=json.dumps({ - "provider": "openai", - "name": "gpt-3.5-turbo", - "mode": "chat", - "completion_params": { - "max_tokens": 300, - "temperature": 0.8, - "top_p": 0.9, - "presence_penalty": 0.1, - "frequency_penalty": 0.1 - } - }), - user_input_form=None - ) - } - ], - - 'zh-Hans': [ - { - 'name': '翻译助手', - 'icon': '', - 'icon_background': '', - 'description': '一个多语言翻译器,提供多种语言翻译能力,将用户输入的文本翻译成他们需要的语言。', - 'mode': 'completion', - 'model_config': AppModelConfig( - provider='openai', - model_id='gpt-3.5-turbo-instruct', - configs={ - 'prompt_template': "请将以下文本翻译为{{target_language}}:\n", - 'prompt_variables': [ - { - "key": "target_language", - "name": "目标语言", - "description": "翻译的目标语言", - "type": "select", - "default": "中文", - "options": [ - "中文", - "英文", - "日语", - "法语", - "俄语", - "德语", - "西班牙语", - "韩语", - "意大利语", - ] - } - ], - 'completion_params': { - 'max_token': 1000, - 'temperature': 0, - 'top_p': 0, - 'presence_penalty': 0.1, - 'frequency_penalty': 0.1, - } - }, - opening_statement='', - suggested_questions=None, - pre_prompt="请将以下文本翻译为{{target_language}}:\n{{query}}\n翻译:", - model=json.dumps({ - "provider": "openai", - "name": "gpt-3.5-turbo-instruct", - "mode": "completion", - "completion_params": { - "max_tokens": 1000, - "temperature": 0, - "top_p": 0, - "presence_penalty": 0.1, - "frequency_penalty": 0.1 - } - }), - user_input_form=json.dumps([ - { - "select": { - "label": "目标语言", - "variable": "target_language", - "description": "翻译的目标语言", - "default": "中文", - "required": True, - 'options': [ - "中文", - "英文", - "日语", - "法语", - "俄语", - "德语", - "西班牙语", - "韩语", - "意大利语", - ] - } - },{ - "paragraph": { - "label": "文本内容", - "variable": "query", - "required": True, - "default": "" - } - } - ]) - ) - }, - { - 'name': 'AI 前端面试官', - 'icon': '', - 'icon_background': '', - 'description': '一个模拟的前端面试官,通过提问的方式对前端开发的技能水平进行检验。', - 'mode': 'chat', - 'model_config': AppModelConfig( - provider='openai', - model_id='gpt-3.5-turbo', - configs={ - 'introduction': '你好,欢迎来参加我们的面试,我是这家科技公司的面试官,我将考察你的 Web 前端开发技能。接下来我会向您提出一些技术问题,请您尽可能详尽地回答。', - 'prompt_template': "你将扮演一个科技公司的面试官,考察用户作为候选人的 Web 前端开发水平,提出 5-10 个犀利的技术问题。\n\n请注意:\n- 每次只问一个问题\n- 用户回答问题后请直接问下一个问题,而不要试图纠正候选人的错误;\n- 如果你认为用户连续几次回答的都不对,就少问一点;\n- 问完最后一个问题后,你可以问这样一个问题:上一份工作为什么离职?用户回答该问题后,请表示理解与支持。\n", - 'prompt_variables': [], - 'completion_params': { - 'max_token': 300, - 'temperature': 0.8, - 'top_p': 0.9, - 'presence_penalty': 0.1, - 'frequency_penalty': 0.1, - } - }, - opening_statement='你好,欢迎来参加我们的面试,我是这家科技公司的面试官,我将考察你的 Web 前端开发技能。接下来我会向您提出一些技术问题,请您尽可能详尽地回答。', - suggested_questions=None, - pre_prompt="你将扮演一个科技公司的面试官,考察用户作为候选人的 Web 前端开发水平,提出 5-10 个犀利的技术问题。\n\n请注意:\n- 每次只问一个问题\n- 用户回答问题后请直接问下一个问题,而不要试图纠正候选人的错误;\n- 如果你认为用户连续几次回答的都不对,就少问一点;\n- 问完最后一个问题后,你可以问这样一个问题:上一份工作为什么离职?用户回答该问题后,请表示理解与支持。\n", - model=json.dumps({ - "provider": "openai", - "name": "gpt-3.5-turbo", - "mode": "chat", - "completion_params": { - "max_tokens": 300, - "temperature": 0.8, - "top_p": 0.9, - "presence_penalty": 0.1, - "frequency_penalty": 0.1 - } - }), - user_input_form=None - ) - } - ], -} diff --git a/api/controllers/console/admin.py b/api/controllers/console/admin.py index 963d2a0e1e..699605eb13 100644 --- a/api/controllers/console/admin.py +++ b/api/controllers/console/admin.py @@ -6,7 +6,7 @@ from controllers.console.wraps import only_edition_cloud from extensions.ext_database import db from flask import request from flask_restful import Resource, reqparse -from libs.helper import supported_language +from constants.languages import supported_language from models.model import App, InstalledApp, RecommendedApp from werkzeug.exceptions import NotFound, Unauthorized diff --git a/api/controllers/console/app/app.py b/api/controllers/console/app/app.py index 65366e7855..c9ba778cc7 100644 --- a/api/controllers/console/app/app.py +++ b/api/controllers/console/app/app.py @@ -3,7 +3,8 @@ import json import logging from datetime import datetime -from constants.model_template import demo_model_templates, model_templates +from constants.model_template import model_templates +from constants.languages import demo_model_templates, languages from controllers.console import api from controllers.console.app.error import AppNotFoundError, ProviderNotInitializeError from controllers.console.setup import setup_required @@ -211,7 +212,7 @@ class AppTemplateApi(Resource): templates = demo_model_templates.get(interface_language) if not templates: - templates = demo_model_templates.get('en-US') + templates = demo_model_templates.get(languages[0]) return {'data': templates} diff --git a/api/controllers/console/app/site.py b/api/controllers/console/app/site.py index 93b6a4eecf..4ef313d644 100644 --- a/api/controllers/console/app/site.py +++ b/api/controllers/console/app/site.py @@ -7,7 +7,7 @@ from extensions.ext_database import db from fields.app_fields import app_site_fields from flask_login import current_user from flask_restful import Resource, marshal_with, reqparse -from libs.helper import supported_language +from constants.languages import supported_language from libs.login import login_required from models.model import Site from werkzeug.exceptions import Forbidden, NotFound diff --git a/api/controllers/console/auth/activate.py b/api/controllers/console/auth/activate.py index 7dc49af6bc..41832189a8 100644 --- a/api/controllers/console/auth/activate.py +++ b/api/controllers/console/auth/activate.py @@ -6,7 +6,8 @@ from controllers.console import api from controllers.console.error import AlreadyActivateError from extensions.ext_database import db from flask_restful import Resource, reqparse -from libs.helper import email, str_len, supported_language, timezone +from libs.helper import email, str_len, timezone +from constants.languages import supported_language from libs.password import hash_password, valid_password from models.account import AccountStatus, Tenant from services.account_service import RegisterService diff --git a/api/controllers/console/auth/oauth.py b/api/controllers/console/auth/oauth.py index 9da78092d4..b7d4e51910 100644 --- a/api/controllers/console/auth/oauth.py +++ b/api/controllers/console/auth/oauth.py @@ -3,6 +3,7 @@ from datetime import datetime from typing import Optional import requests +from constants.languages import languages from extensions.ext_database import db from flask import current_app, redirect, request from flask_restful import Resource @@ -106,11 +107,11 @@ def _generate_account(provider: str, user_info: OAuthUserInfo): ) # Set interface language - preferred_lang = request.accept_languages.best_match(['zh', 'en']) - if preferred_lang == 'zh': - interface_language = 'zh-Hans' + preferred_lang = request.accept_languages.best_match(languages) + if preferred_lang and preferred_lang in languages: + interface_language = preferred_lang else: - interface_language = 'en-US' + interface_language = languages[0] account.interface_language = interface_language db.session.commit() diff --git a/api/controllers/console/explore/recommended_app.py b/api/controllers/console/explore/recommended_app.py index 92e64996b6..2f0fa51d77 100644 --- a/api/controllers/console/explore/recommended_app.py +++ b/api/controllers/console/explore/recommended_app.py @@ -9,6 +9,7 @@ from libs.login import login_required from models.model import App, InstalledApp, RecommendedApp from services.account_service import TenantService from sqlalchemy import and_ +from constants.languages import languages app_fields = { 'id': fields.String, @@ -44,7 +45,7 @@ class RecommendedAppListApi(Resource): @account_initialization_required @marshal_with(recommended_app_list_fields) def get(self): - language_prefix = current_user.interface_language if current_user.interface_language else 'en-US' + language_prefix = current_user.interface_language if current_user.interface_language else languages[0] recommended_apps = db.session.query(RecommendedApp).filter( RecommendedApp.is_listed == True, diff --git a/api/controllers/console/workspace/account.py b/api/controllers/console/workspace/account.py index 43c15e1a95..ae08c3a982 100644 --- a/api/controllers/console/workspace/account.py +++ b/api/controllers/console/workspace/account.py @@ -11,7 +11,8 @@ from extensions.ext_database import db from flask import current_app, request from flask_login import current_user from flask_restful import Resource, fields, marshal_with, reqparse -from libs.helper import TimestampField, supported_language, timezone +from libs.helper import TimestampField, timezone +from constants.languages import supported_language from libs.login import login_required from models.account import AccountIntegrate, InvitationCode from services.account_service import AccountService diff --git a/api/core/tools/provider/builtin/chart/chart.yaml b/api/core/tools/provider/builtin/chart/chart.yaml index 9e953ec32a..70aa2f388f 100644 --- a/api/core/tools/provider/builtin/chart/chart.yaml +++ b/api/core/tools/provider/builtin/chart/chart.yaml @@ -4,8 +4,10 @@ identity: label: en_US: ChartGenerator zh_Hans: 图表生成 + pt_BR: Gerador de gráficos description: en_US: Chart Generator is a tool for generating statistical charts like bar chart, line chart, pie chart, etc. zh_Hans: 图表生成是一个用于生成可视化图表的工具,你可以通过它来生成柱状图、折线图、饼图等各类图表 + pt_BR: O Gerador de gráficos é uma ferramenta para gerar gráficos estatísticos como gráfico de barras, gráfico de linhas, gráfico de pizza, etc. icon: icon.png credentails_for_provider: diff --git a/api/core/tools/provider/builtin/chart/tools/bar.yaml b/api/core/tools/provider/builtin/chart/tools/bar.yaml index 9e6787e938..bc34f2a5ec 100644 --- a/api/core/tools/provider/builtin/chart/tools/bar.yaml +++ b/api/core/tools/provider/builtin/chart/tools/bar.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Bar Chart zh_Hans: 柱状图 + pt_BR: Gráfico de barras icon: icon.svg description: human: en_US: Bar chart zh_Hans: 柱状图 + pt_BR: Gráfico de barras llm: generate a bar chart with input data parameters: - name: data @@ -17,9 +19,11 @@ parameters: label: en_US: data zh_Hans: 数据 + pt_BR: dados human_description: en_US: data for generating bar chart zh_Hans: 用于生成柱状图的数据 + pt_BR: dados para gerar gráfico de barras llm_description: data for generating bar chart, data should be a string contains a list of numbers like "1;2;3;4;5" form: llm - name: x_axis @@ -28,8 +32,10 @@ parameters: label: en_US: X Axis zh_Hans: x 轴 + pt_BR: Eixo X human_description: en_US: X axis for bar chart zh_Hans: 柱状图的 x 轴 + pt_BR: Eixo X para gráfico de barras llm_description: x axis for bar chart, x axis should be a string contains a list of texts like "a;b;c;1;2" in order to match the data form: llm diff --git a/api/core/tools/provider/builtin/chart/tools/line.yaml b/api/core/tools/provider/builtin/chart/tools/line.yaml index a4eb7affe9..9994cbb80b 100644 --- a/api/core/tools/provider/builtin/chart/tools/line.yaml +++ b/api/core/tools/provider/builtin/chart/tools/line.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Linear Chart zh_Hans: 线性图表 + pt_BR: Gráfico linear icon: icon.svg description: human: en_US: linear chart zh_Hans: 线性图表 + pt_BR: Gráfico linear llm: generate a linear chart with input data parameters: - name: data @@ -17,9 +19,11 @@ parameters: label: en_US: data zh_Hans: 数据 + pt_BR: dados human_description: en_US: data for generating linear chart zh_Hans: 用于生成线性图表的数据 + pt_BR: dados para gerar gráfico linear llm_description: data for generating linear chart, data should be a string contains a list of numbers like "1;2;3;4;5" form: llm - name: x_axis @@ -28,8 +32,10 @@ parameters: label: en_US: X Axis zh_Hans: x 轴 + pt_BR: Eixo X human_description: en_US: X axis for linear chart zh_Hans: 线性图表的 x 轴 + pt_BR: Eixo X para gráfico linear llm_description: x axis for linear chart, x axis should be a string contains a list of texts like "a;b;c;1;2" in order to match the data form: llm diff --git a/api/core/tools/provider/builtin/chart/tools/pie.yaml b/api/core/tools/provider/builtin/chart/tools/pie.yaml index 2e3506d20b..7d6647ef4a 100644 --- a/api/core/tools/provider/builtin/chart/tools/pie.yaml +++ b/api/core/tools/provider/builtin/chart/tools/pie.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Pie Chart zh_Hans: 饼图 + pt_BR: Gráfico de pizza icon: icon.svg description: human: en_US: Pie chart zh_Hans: 饼图 + pt_BR: Gráfico de pizza llm: generate a pie chart with input data parameters: - name: data @@ -17,9 +19,11 @@ parameters: label: en_US: data zh_Hans: 数据 + pt_BR: dados human_description: en_US: data for generating pie chart zh_Hans: 用于生成饼图的数据 + pt_BR: dados para gerar gráfico de pizza llm_description: data for generating pie chart, data should be a string contains a list of numbers like "1;2;3;4;5" form: llm - name: categories @@ -28,8 +32,10 @@ parameters: label: en_US: Categories zh_Hans: 分类 + pt_BR: Categorias human_description: en_US: Categories for pie chart zh_Hans: 饼图的分类 + pt_BR: Categorias para gráfico de pizza llm_description: categories for pie chart, categories should be a string contains a list of texts like "a;b;c;1;2" in order to match the data, each category should be split by ";" form: llm diff --git a/api/core/tools/provider/builtin/dalle/dalle.yaml b/api/core/tools/provider/builtin/dalle/dalle.yaml index 54508ff806..b347915e80 100644 --- a/api/core/tools/provider/builtin/dalle/dalle.yaml +++ b/api/core/tools/provider/builtin/dalle/dalle.yaml @@ -4,9 +4,11 @@ identity: label: en_US: DALL-E zh_Hans: DALL-E 绘画 + pt_BR: DALL-E description: en_US: DALL-E art zh_Hans: DALL-E 绘画 + pt_BR: DALL-E art icon: icon.png credentails_for_provider: openai_api_key: @@ -15,33 +17,42 @@ credentails_for_provider: label: en_US: OpenAI API key zh_Hans: OpenAI API key + pt_BR: OpenAI API key help: en_US: Please input your OpenAI API key zh_Hans: 请输入你的 OpenAI API key + pt_BR: Please input your OpenAI API key placeholder: en_US: Please input your OpenAI API key zh_Hans: 请输入你的 OpenAI API key + pt_BR: Please input your OpenAI API key openai_organizaion_id: type: text-input required: false label: en_US: OpenAI organization ID zh_Hans: OpenAI organization ID + pt_BR: OpenAI organization ID help: en_US: Please input your OpenAI organization ID zh_Hans: 请输入你的 OpenAI organization ID + pt_BR: Please input your OpenAI organization ID placeholder: en_US: Please input your OpenAI organization ID zh_Hans: 请输入你的 OpenAI organization ID + pt_BR: Please input your OpenAI organization ID openai_base_url: type: text-input required: false label: en_US: OpenAI base URL zh_Hans: OpenAI base URL + pt_BR: OpenAI base URL help: en_US: Please input your OpenAI base URL zh_Hans: 请输入你的 OpenAI base URL + pt_BR: Please input your OpenAI base URL placeholder: en_US: Please input your OpenAI base URL zh_Hans: 请输入你的 OpenAI base URL + pt_BR: Please input your OpenAI base URL diff --git a/api/core/tools/provider/builtin/dalle/tools/dalle2.yaml b/api/core/tools/provider/builtin/dalle/tools/dalle2.yaml index ebcaf02ebc..90c73ecc57 100644 --- a/api/core/tools/provider/builtin/dalle/tools/dalle2.yaml +++ b/api/core/tools/provider/builtin/dalle/tools/dalle2.yaml @@ -7,10 +7,12 @@ identity: description: en_US: DALL-E 2 is a powerful drawing tool that can draw the image you want based on your prompt zh_Hans: DALL-E 2 是一个强大的绘画工具,它可以根据您的提示词绘制出您想要的图像 + pt_BR: DALL-E 2 is a powerful drawing tool that can draw the image you want based on your prompt description: human: en_US: DALL-E is a text to image tool zh_Hans: DALL-E 是一个文本到图像的工具 + pt_BR: DALL-E is a text to image tool llm: DALL-E is a tool used to generate images from text parameters: - name: prompt @@ -19,9 +21,11 @@ parameters: label: en_US: Prompt zh_Hans: 提示词 + pt_BR: Prompt human_description: en_US: Image prompt, you can check the official documentation of DallE 2 zh_Hans: 图像提示词,您可以查看DallE 2 的官方文档 + pt_BR: Image prompt, you can check the official documentation of DallE 2 llm_description: Image prompt of DallE 2, you should describe the image you want to generate as a list of words as possible as detailed form: llm - name: size @@ -30,23 +34,28 @@ parameters: human_description: en_US: used for selecting the image size zh_Hans: 用于选择图像大小 + pt_BR: used for selecting the image size label: en_US: Image size zh_Hans: 图像大小 + pt_BR: Image size form: form options: - value: small label: en_US: Small(256x256) zh_Hans: 小(256x256) + pt_BR: Small(256x256) - value: medium label: en_US: Medium(512x512) zh_Hans: 中(512x512) + pt_BR: Medium(512x512) - value: large label: en_US: Large(1024x1024) zh_Hans: 大(1024x1024) + pt_BR: Large(1024x1024) default: large - name: n type: number @@ -54,9 +63,11 @@ parameters: human_description: en_US: used for selecting the number of images zh_Hans: 用于选择图像数量 + pt_BR: used for selecting the number of images label: en_US: Number of images zh_Hans: 图像数量 + pt_BR: Number of images form: form default: 1 min: 1 diff --git a/api/core/tools/provider/builtin/dalle/tools/dalle3.yaml b/api/core/tools/provider/builtin/dalle/tools/dalle3.yaml index 0497a3274b..7ba5c56889 100644 --- a/api/core/tools/provider/builtin/dalle/tools/dalle3.yaml +++ b/api/core/tools/provider/builtin/dalle/tools/dalle3.yaml @@ -4,13 +4,16 @@ identity: label: en_US: DALL-E 3 zh_Hans: DALL-E 3 绘画 + pt_BR: DALL-E 3 description: en_US: DALL-E 3 is a powerful drawing tool that can draw the image you want based on your prompt, compared to DallE 2, DallE 3 has stronger drawing ability, but it will consume more resources zh_Hans: DALL-E 3 是一个强大的绘画工具,它可以根据您的提示词绘制出您想要的图像,相比于DallE 2, DallE 3拥有更强的绘画能力,但会消耗更多的资源 + pt_BR: DALL-E 3 is a powerful drawing tool that can draw the image you want based on your prompt, compared to DallE 2, DallE 3 has stronger drawing ability, but it will consume more resources description: human: en_US: DALL-E is a text to image tool zh_Hans: DALL-E 是一个文本到图像的工具 + pt_BR: DALL-E is a text to image tool llm: DALL-E is a tool used to generate images from text parameters: - name: prompt @@ -19,9 +22,11 @@ parameters: label: en_US: Prompt zh_Hans: 提示词 + pt_BR: Prompt human_description: en_US: Image prompt, you can check the official documentation of DallE 3 zh_Hans: 图像提示词,您可以查看DallE 3 的官方文档 + pt_BR: Image prompt, you can check the official documentation of DallE 3 llm_description: Image prompt of DallE 3, you should describe the image you want to generate as a list of words as possible as detailed form: llm - name: size @@ -30,23 +35,28 @@ parameters: human_description: en_US: selecting the image size zh_Hans: 选择图像大小 + pt_BR: selecting the image size label: en_US: Image size zh_Hans: 图像大小 + pt_BR: Image size form: form options: - value: square label: en_US: Squre(1024x1024) zh_Hans: 方(1024x1024) + pt_BR: Squre(1024x1024) - value: vertical label: en_US: Vertical(1024x1792) zh_Hans: 竖屏(1024x1792) + pt_BR: Vertical(1024x1792) - value: horizontal label: en_US: Horizontal(1792x1024) zh_Hans: 横屏(1792x1024) + pt_BR: Horizontal(1792x1024) default: square - name: n type: number @@ -54,9 +64,11 @@ parameters: human_description: en_US: selecting the number of images zh_Hans: 选择图像数量 + pt_BR: selecting the number of images label: en_US: Number of images zh_Hans: 图像数量 + pt_BR: Number of images form: form min: 1 max: 1 @@ -67,19 +79,23 @@ parameters: human_description: en_US: selecting the image quality zh_Hans: 选择图像质量 + pt_BR: selecting the image quality label: en_US: Image quality zh_Hans: 图像质量 + pt_BR: Image quality form: form options: - value: standard label: en_US: Standard zh_Hans: 标准 + pt_BR: Standard - value: hd label: en_US: HD zh_Hans: 高清 + pt_BR: HD default: standard - name: style type: select @@ -87,17 +103,21 @@ parameters: human_description: en_US: selecting the image style zh_Hans: 选择图像风格 + pt_BR: selecting the image style label: en_US: Image style zh_Hans: 图像风格 + pt_BR: Image style form: form options: - value: vivid label: en_US: Vivid zh_Hans: 生动 + pt_BR: Vivid - value: natural label: en_US: Natural zh_Hans: 自然 + pt_BR: Natural default: vivid diff --git a/api/core/tools/provider/builtin/google/google.yaml b/api/core/tools/provider/builtin/google/google.yaml index 3c0dd63a40..793aed3936 100644 --- a/api/core/tools/provider/builtin/google/google.yaml +++ b/api/core/tools/provider/builtin/google/google.yaml @@ -4,9 +4,11 @@ identity: label: en_US: Google zh_Hans: Google + pt_BR: Google description: en_US: Google zh_Hans: GoogleSearch + pt_BR: Google icon: icon.svg credentails_for_provider: serpapi_api_key: @@ -15,10 +17,13 @@ credentails_for_provider: label: en_US: SerpApi API key zh_Hans: SerpApi API key + pt_BR: SerpApi API key placeholder: en_US: Please input your SerpApi API key zh_Hans: 请输入你的 SerpApi API key + pt_BR: Please input your SerpApi API key help: en_US: Get your SerpApi API key from SerpApi zh_Hans: 从 SerpApi 获取您的 SerpApi API key + pt_BR: Get your SerpApi API key from SerpApi url: https://serpapi.com/manage-api-key diff --git a/api/core/tools/provider/builtin/google/tools/google_search.yaml b/api/core/tools/provider/builtin/google/tools/google_search.yaml index f3b2a96a2e..9dc5023992 100644 --- a/api/core/tools/provider/builtin/google/tools/google_search.yaml +++ b/api/core/tools/provider/builtin/google/tools/google_search.yaml @@ -4,10 +4,12 @@ identity: label: en_US: GoogleSearch zh_Hans: 谷歌搜索 + pt_BR: GoogleSearch description: human: en_US: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. zh_Hans: 一个用于执行 Google SERP 搜索并提取片段和网页的工具。输入应该是一个搜索查询。 + pt_BR: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. llm: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. parameters: - name: query @@ -16,9 +18,11 @@ parameters: label: en_US: Query string zh_Hans: 查询语句 + pt_BR: Query string human_description: en_US: used for searching zh_Hans: 用于搜索网页内容 + pt_BR: used for searching llm_description: key words for searching form: llm - name: result_type @@ -29,15 +33,19 @@ parameters: label: en_US: text zh_Hans: 文本 + pt_BR: texto - value: link label: en_US: link zh_Hans: 链接 + pt_BR: link default: link label: en_US: Result type zh_Hans: 结果类型 + pt_BR: Result type human_description: en_US: used for selecting the result type, text or link zh_Hans: 用于选择结果类型,使用文本还是链接进行展示 + pt_BR: used for selecting the result type, text or link form: form diff --git a/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml b/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml index 8bb3a3c0d6..9ceaf1ba76 100644 --- a/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml +++ b/api/core/tools/provider/builtin/stablediffusion/stablediffusion.yaml @@ -4,9 +4,11 @@ identity: label: en_US: Stable Diffusion zh_Hans: Stable Diffusion + pt_BR: Stable Diffusion description: en_US: Stable Diffusion is a tool for generating images which can be deployed locally. zh_Hans: Stable Diffusion 是一个可以在本地部署的图片生成的工具。 + pt_BR: Stable Diffusion is a tool for generating images which can be deployed locally. icon: icon.png credentails_for_provider: base_url: @@ -15,15 +17,19 @@ credentails_for_provider: label: en_US: Base URL zh_Hans: StableDiffusion服务器的Base URL + pt_BR: Base URL placeholder: en_US: Please input your StableDiffusion server's Base URL zh_Hans: 请输入你的 StableDiffusion 服务器的 Base URL + pt_BR: Please input your StableDiffusion server's Base URL model: type: text-input required: true label: en_US: Model zh_Hans: 模型 + pt_BR: Model placeholder: en_US: Please input your model zh_Hans: 请输入你的模型名称 + pt_BR: Please input your model diff --git a/api/core/tools/provider/builtin/stablediffusion/tools/stable_diffusion.yaml b/api/core/tools/provider/builtin/stablediffusion/tools/stable_diffusion.yaml index cd20a81c15..5404b84360 100644 --- a/api/core/tools/provider/builtin/stablediffusion/tools/stable_diffusion.yaml +++ b/api/core/tools/provider/builtin/stablediffusion/tools/stable_diffusion.yaml @@ -4,10 +4,12 @@ identity: label: en_US: Stable Diffusion WebUI zh_Hans: Stable Diffusion WebUI + pt_BR: Stable Diffusion WebUI description: human: en_US: A tool for generating images which can be deployed locally, you can use stable-diffusion-webui to deploy it. zh_Hans: 一个可以在本地部署的图片生成的工具,您可以使用 stable-diffusion-webui 来部署它。 + pt_BR: A tool for generating images which can be deployed locally, you can use stable-diffusion-webui to deploy it. llm: draw the image you want based on your prompt. parameters: - name: prompt @@ -16,9 +18,11 @@ parameters: label: en_US: Prompt zh_Hans: 提示词 + pt_BR: Prompt human_description: en_US: Image prompt, you can check the official documentation of Stable Diffusion zh_Hans: 图像提示词,您可以查看 Stable Diffusion 的官方文档 + pt_BR: Image prompt, you can check the official documentation of Stable Diffusion llm_description: Image prompt of Stable Diffusion, you should describe the image you want to generate as a list of words as possible as detailed, the prompt must be written in English. form: llm - name: lora @@ -27,9 +31,11 @@ parameters: label: en_US: Lora zh_Hans: Lora + pt_BR: Lora human_description: en_US: Lora zh_Hans: Lora + pt_BR: Lora form: form - name: steps type: number @@ -37,9 +43,11 @@ parameters: label: en_US: Steps zh_Hans: Steps + pt_BR: Steps human_description: en_US: Steps zh_Hans: Steps + pt_BR: Steps form: form default: 10 - name: width @@ -48,9 +56,11 @@ parameters: label: en_US: Width zh_Hans: Width + pt_BR: Width human_description: en_US: Width zh_Hans: Width + pt_BR: Width form: form default: 1024 - name: height @@ -59,9 +69,11 @@ parameters: label: en_US: Height zh_Hans: Height + pt_BR: Height human_description: en_US: Height zh_Hans: Height + pt_BR: Height form: form default: 1024 - name: negative_prompt @@ -70,8 +82,10 @@ parameters: label: en_US: Negative prompt zh_Hans: Negative prompt + pt_BR: Negative prompt human_description: en_US: Negative prompt zh_Hans: Negative prompt + pt_BR: Negative prompt form: form default: bad art, ugly, deformed, watermark, duplicated, discontinuous lines diff --git a/api/core/tools/provider/builtin/time/time.yaml b/api/core/tools/provider/builtin/time/time.yaml index 5a2c3395fa..2332011425 100644 --- a/api/core/tools/provider/builtin/time/time.yaml +++ b/api/core/tools/provider/builtin/time/time.yaml @@ -4,8 +4,10 @@ identity: label: en_US: CurrentTime zh_Hans: 时间 + pt_BR: CurrentTime description: en_US: A tool for getting the current time. zh_Hans: 一个用于获取当前时间的工具。 + pt_BR: A tool for getting the current time. icon: icon.svg credentails_for_provider: diff --git a/api/core/tools/provider/builtin/time/tools/current_time.yaml b/api/core/tools/provider/builtin/time/tools/current_time.yaml index 2d86e4db4b..09a34d2ee9 100644 --- a/api/core/tools/provider/builtin/time/tools/current_time.yaml +++ b/api/core/tools/provider/builtin/time/tools/current_time.yaml @@ -4,9 +4,11 @@ identity: label: en_US: Current Time zh_Hans: 获取当前时间 + pt_BR: Current Time description: human: en_US: A tool for getting the current time. zh_Hans: 一个用于获取当前时间的工具。 + pt_BR: A tool for getting the current time. llm: A tool for getting the current time. parameters: diff --git a/api/core/tools/provider/builtin/vectorizer/tools/vectorizer.yaml b/api/core/tools/provider/builtin/vectorizer/tools/vectorizer.yaml index 2df4e3bf2f..4b4fb9e245 100644 --- a/api/core/tools/provider/builtin/vectorizer/tools/vectorizer.yaml +++ b/api/core/tools/provider/builtin/vectorizer/tools/vectorizer.yaml @@ -4,10 +4,12 @@ identity: label: en_US: Vectorizer.AI zh_Hans: Vectorizer.AI + pt_BR: Vectorizer.AI description: human: en_US: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI. zh_Hans: 一个将 PNG 和 JPG 图像快速轻松地转换为 SVG 矢量图的工具。 + pt_BR: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI. llm: A tool for converting images to SVG vectors. you should input the image id as the input of this tool. the image id can be got from parameters. parameters: - name: mode @@ -18,15 +20,19 @@ parameters: label: en_US: production zh_Hans: 生产模式 + pt_BR: production - value: test label: en_US: test zh_Hans: 测试模式 + pt_BR: test default: test label: en_US: Mode zh_Hans: 模式 + pt_BR: Mode human_description: en_US: It is free to integrate with and test out the API in test mode, no subscription required. zh_Hans: 在测试模式下,可以免费测试API。 + pt_BR: It is free to integrate with and test out the API in test mode, no subscription required. form: form diff --git a/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml b/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml index 566335e0c6..4798544aee 100644 --- a/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml +++ b/api/core/tools/provider/builtin/vectorizer/vectorizer.yaml @@ -4,9 +4,11 @@ identity: label: en_US: Vectorizer.AI zh_Hans: Vectorizer.AI + pt_BR: Vectorizer.AI description: en_US: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI. zh_Hans: 一个将 PNG 和 JPG 图像快速轻松地转换为 SVG 矢量图的工具。 + pt_BR: Convert your PNG and JPG images to SVG vectors quickly and easily. Fully automatically. Using AI. icon: icon.png credentails_for_provider: api_key_name: @@ -15,12 +17,15 @@ credentails_for_provider: label: en_US: Vectorizer.AI API Key name zh_Hans: Vectorizer.AI API Key name + pt_BR: Vectorizer.AI API Key name placeholder: en_US: Please input your Vectorizer.AI ApiKey name zh_Hans: 请输入你的 Vectorizer.AI ApiKey name + pt_BR: Please input your Vectorizer.AI ApiKey name help: en_US: Get your Vectorizer.AI API Key from Vectorizer.AI. zh_Hans: 从 Vectorizer.AI 获取您的 Vectorizer.AI API Key。 + pt_BR: Get your Vectorizer.AI API Key from Vectorizer.AI. url: https://vectorizer.ai/api api_key_value: type: secret-input @@ -28,9 +33,12 @@ credentails_for_provider: label: en_US: Vectorizer.AI API Key zh_Hans: Vectorizer.AI API Key + pt_BR: Vectorizer.AI API Key placeholder: en_US: Please input your Vectorizer.AI ApiKey zh_Hans: 请输入你的 Vectorizer.AI ApiKey + pt_BR: Please input your Vectorizer.AI ApiKey help: en_US: Get your Vectorizer.AI API Key from Vectorizer.AI. zh_Hans: 从 Vectorizer.AI 获取您的 Vectorizer.AI API Key。 + pt_BR: Get your Vectorizer.AI API Key from Vectorizer.AI. diff --git a/api/core/tools/provider/builtin/webscraper/tools/webscraper.yaml b/api/core/tools/provider/builtin/webscraper/tools/webscraper.yaml index 93cf7a044d..5782dbb0c7 100644 --- a/api/core/tools/provider/builtin/webscraper/tools/webscraper.yaml +++ b/api/core/tools/provider/builtin/webscraper/tools/webscraper.yaml @@ -4,10 +4,12 @@ identity: label: en_US: Web Scraper zh_Hans: 网页爬虫 + pt_BR: Web Scraper description: human: en_US: A tool for scraping webpages. zh_Hans: 一个用于爬取网页的工具。 + pt_BR: A tool for scraping webpages. llm: A tool for scraping webpages. Input should be a URL. parameters: - name: url @@ -16,9 +18,11 @@ parameters: label: en_US: URL zh_Hans: 网页链接 + pt_BR: URL human_description: en_US: used for linking to webpages zh_Hans: 用于链接到网页 + pt_BR: used for linking to webpages llm_description: url for scraping form: llm - name: user_agent @@ -27,8 +31,10 @@ parameters: label: en_US: User Agent zh_Hans: User Agent + pt_BR: User Agent human_description: en_US: used for identifying the browser. zh_Hans: 用于识别浏览器。 + pt_BR: used for identifying the browser. form: form default: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.1000.0 Safari/537.36 diff --git a/api/core/tools/provider/builtin/webscraper/webscraper.yaml b/api/core/tools/provider/builtin/webscraper/webscraper.yaml index a1a99f99e7..40683ff391 100644 --- a/api/core/tools/provider/builtin/webscraper/webscraper.yaml +++ b/api/core/tools/provider/builtin/webscraper/webscraper.yaml @@ -4,8 +4,10 @@ identity: label: en_US: WebScraper zh_Hans: 网页抓取 + pt_BR: WebScraper description: en_US: Web Scrapper tool kit is used to scrape web zh_Hans: 一个用于抓取网页的工具。 + pt_BR: Web Scrapper tool kit is used to scrape web icon: icon.svg credentails_for_provider: diff --git a/api/core/tools/provider/builtin/wikipedia/tools/wikipedia_search.yaml b/api/core/tools/provider/builtin/wikipedia/tools/wikipedia_search.yaml index 3bbc65d804..376163841e 100644 --- a/api/core/tools/provider/builtin/wikipedia/tools/wikipedia_search.yaml +++ b/api/core/tools/provider/builtin/wikipedia/tools/wikipedia_search.yaml @@ -4,11 +4,13 @@ identity: label: en_US: WikipediaSearch zh_Hans: 维基百科搜索 + pt_BR: WikipediaSearch icon: icon.svg description: human: en_US: A tool for performing a Wikipedia search and extracting snippets and webpages. zh_Hans: 一个用于执行维基百科搜索并提取片段和网页的工具。 + pt_BR: A tool for performing a Wikipedia search and extracting snippets and webpages. llm: A tool for performing a Wikipedia search and extracting snippets and webpages. Input should be a search query. parameters: - name: query @@ -17,8 +19,10 @@ parameters: label: en_US: Query string zh_Hans: 查询语句 + pt_BR: Query string human_description: en_US: key words for searching zh_Hans: 查询关键词 + pt_BR: key words for searching llm_description: key words for searching form: llm diff --git a/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml b/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml index 801d7d174b..c9dbc41298 100644 --- a/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml +++ b/api/core/tools/provider/builtin/wikipedia/wikipedia.yaml @@ -4,8 +4,10 @@ identity: label: en_US: Wikipedia zh_Hans: 维基百科 + pt_BR: Wikipedia description: en_US: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world. zh_Hans: 维基百科是一个由全世界的志愿者创建和编辑的免费在线百科全书。 + pt_BR: Wikipedia is a free online encyclopedia, created and edited by volunteers around the world. icon: icon.svg credentails_for_provider: diff --git a/api/core/tools/provider/builtin/wolframalpha/tools/wolframalpha.yaml b/api/core/tools/provider/builtin/wolframalpha/tools/wolframalpha.yaml index 0e7e8fad92..08b5668691 100644 --- a/api/core/tools/provider/builtin/wolframalpha/tools/wolframalpha.yaml +++ b/api/core/tools/provider/builtin/wolframalpha/tools/wolframalpha.yaml @@ -4,10 +4,12 @@ identity: label: en_US: WolframAlpha zh_Hans: WolframAlpha + pt_BR: WolframAlpha description: human: en_US: WolframAlpha is a powerful computational knowledge engine. zh_Hans: WolframAlpha 是一个强大的计算知识引擎。 + pt_BR: WolframAlpha is a powerful computational knowledge engine. llm: WolframAlpha is a powerful computational knowledge engine. one single query can get the answer of a question. parameters: - name: query @@ -16,8 +18,10 @@ parameters: label: en_US: Query string zh_Hans: 计算语句 + pt_BR: Query string human_description: en_US: used for calculating zh_Hans: 用于计算最终结果 + pt_BR: used for calculating llm_description: a single query for calculating form: llm diff --git a/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml b/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml index 1d2a038103..8b1c9a755b 100644 --- a/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml +++ b/api/core/tools/provider/builtin/wolframalpha/wolframalpha.yaml @@ -4,9 +4,11 @@ identity: label: en_US: WolframAlpha zh_Hans: WolframAlpha + pt_BR: WolframAlpha description: en_US: WolframAlpha is a powerful computational knowledge engine. zh_Hans: WolframAlpha 是一个强大的计算知识引擎。 + pt_BR: WolframAlpha is a powerful computational knowledge engine. icon: icon.svg credentails_for_provider: appid: @@ -15,10 +17,13 @@ credentails_for_provider: label: en_US: WolframAlpha AppID zh_Hans: WolframAlpha AppID + pt_BR: WolframAlpha AppID placeholder: en_US: Please input your WolframAlpha AppID zh_Hans: 请输入你的 WolframAlpha AppID + pt_BR: Please input your WolframAlpha AppID help: en_US: Get your WolframAlpha AppID from WolframAlpha, please use "full results" api access. zh_Hans: 从 WolframAlpha 获取您的 WolframAlpha AppID,请使用 "full results" API。 + pt_BR: Get your WolframAlpha AppID from WolframAlpha, please use "full results" api access. url: https://products.wolframalpha.com/api diff --git a/api/core/tools/provider/builtin/yahoo/tools/analytics.yaml b/api/core/tools/provider/builtin/yahoo/tools/analytics.yaml index 0daee2acf0..89e66fb581 100644 --- a/api/core/tools/provider/builtin/yahoo/tools/analytics.yaml +++ b/api/core/tools/provider/builtin/yahoo/tools/analytics.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Analytics zh_Hans: 分析 + pt_BR: Análises icon: icon.svg description: human: en_US: A tool for get analytics about a ticker from Yahoo Finance. zh_Hans: 一个用于从雅虎财经获取分析数据的工具。 + pt_BR: Uma ferramenta para obter análises sobre um ticker do Yahoo Finance. llm: A tool for get analytics from Yahoo Finance. Input should be the ticker symbol like AAPL. parameters: - name: symbol @@ -17,9 +19,11 @@ parameters: label: en_US: Ticker symbol zh_Hans: 股票代码 + pt_BR: Símbolo do ticker human_description: en_US: The ticker symbol of the company you want to analyze. zh_Hans: 你想要搜索的公司的股票代码。 + pt_BR: O símbolo do ticker da empresa que você deseja analisar. llm_description: The ticker symbol of the company you want to analyze. form: llm - name: start_date @@ -28,9 +32,11 @@ parameters: label: en_US: Start date zh_Hans: 开始日期 + pt_BR: Data de início human_description: en_US: The start date of the analytics. zh_Hans: 分析的开始日期。 + pt_BR: A data de início das análises. llm_description: The start date of the analytics, the format of the date must be YYYY-MM-DD like 2020-01-01. form: llm - name: end_date @@ -39,8 +45,10 @@ parameters: label: en_US: End date zh_Hans: 结束日期 + pt_BR: Data de término human_description: en_US: The end date of the analytics. zh_Hans: 分析的结束日期。 + pt_BR: A data de término das análises. llm_description: The end date of the analytics, the format of the date must be YYYY-MM-DD like 2024-01-01. form: llm diff --git a/api/core/tools/provider/builtin/yahoo/tools/news.yaml b/api/core/tools/provider/builtin/yahoo/tools/news.yaml index db33c96228..4118c1a82f 100644 --- a/api/core/tools/provider/builtin/yahoo/tools/news.yaml +++ b/api/core/tools/provider/builtin/yahoo/tools/news.yaml @@ -4,11 +4,13 @@ identity: label: en_US: News zh_Hans: 新闻 + pt_BR: Notícias icon: icon.svg description: human: en_US: A tool for get news about a ticker from Yahoo Finance. zh_Hans: 一个用于从雅虎财经获取新闻的工具。 + pt_BR: Uma ferramenta para obter notícias sobre um ticker da Yahoo Finance. llm: A tool for get news from Yahoo Finance. Input should be the ticker symbol like AAPL. parameters: - name: symbol @@ -17,8 +19,10 @@ parameters: label: en_US: Ticker symbol zh_Hans: 股票代码 + pt_BR: Símbolo do ticker human_description: en_US: The ticker symbol of the company you want to search. zh_Hans: 你想要搜索的公司的股票代码。 + pt_BR: O símbolo do ticker da empresa que você deseja pesquisar. llm_description: The ticker symbol of the company you want to search. form: llm diff --git a/api/core/tools/provider/builtin/yahoo/tools/ticker.yaml b/api/core/tools/provider/builtin/yahoo/tools/ticker.yaml index b90cfa6327..3c1ee9cf31 100644 --- a/api/core/tools/provider/builtin/yahoo/tools/ticker.yaml +++ b/api/core/tools/provider/builtin/yahoo/tools/ticker.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Ticker zh_Hans: 股票信息 + pt_BR: Ticker icon: icon.svg description: human: en_US: A tool for search ticker information from Yahoo Finance. zh_Hans: 一个用于从雅虎财经搜索股票信息的工具。 + pt_BR: Uma ferramenta para buscar informações de ticker do Yahoo Finance. llm: A tool for search ticker information from Yahoo Finance. Input should be the ticker symbol like AAPL. parameters: - name: symbol @@ -17,8 +19,10 @@ parameters: label: en_US: Ticker symbol zh_Hans: 股票代码 + pt_BR: Símbolo do ticker human_description: en_US: The ticker symbol of the company you want to search. zh_Hans: 你想要搜索的公司的股票代码。 + pt_BR: O símbolo do ticker da empresa que você deseja pesquisar. llm_description: The ticker symbol of the company you want to search. form: llm diff --git a/api/core/tools/provider/builtin/yahoo/yahoo.yaml b/api/core/tools/provider/builtin/yahoo/yahoo.yaml index d1802321fb..6632aedc2f 100644 --- a/api/core/tools/provider/builtin/yahoo/yahoo.yaml +++ b/api/core/tools/provider/builtin/yahoo/yahoo.yaml @@ -4,8 +4,10 @@ identity: label: en_US: YahooFinance zh_Hans: 雅虎财经 + pt_BR: YahooFinance description: en_US: Finance, and Yahoo! get the latest news, stock quotes, and interactive chart with Yahoo! zh_Hans: 雅虎财经,获取并整理出最新的新闻、股票报价等一切你想要的财经信息。 + pt_BR: Finance, and Yahoo! get the latest news, stock quotes, and interactive chart with Yahoo! icon: icon.png credentails_for_provider: diff --git a/api/core/tools/provider/builtin/youtube/tools/videos.yaml b/api/core/tools/provider/builtin/youtube/tools/videos.yaml index 3ac28d5d7f..976699eb62 100644 --- a/api/core/tools/provider/builtin/youtube/tools/videos.yaml +++ b/api/core/tools/provider/builtin/youtube/tools/videos.yaml @@ -4,11 +4,13 @@ identity: label: en_US: Video statistics zh_Hans: 视频统计 + pt_BR: Estatísticas de vídeo icon: icon.svg description: human: en_US: A tool for get statistics about a channel's videos. zh_Hans: 一个用于获取油管频道视频统计数据的工具。 + pt_BR: Uma ferramenta para obter estatísticas sobre os vídeos de um canal. llm: A tool for get statistics about a channel's videos. Input should be the name of the channel like PewDiePie. parameters: - name: channel @@ -17,9 +19,11 @@ parameters: label: en_US: Channel name zh_Hans: 频道名 + pt_BR: Nome do canal human_description: en_US: The name of the channel you want to search. zh_Hans: 你想要搜索的油管频道名。 + pt_BR: O nome do canal que você deseja pesquisar. llm_description: The name of the channel you want to search. form: llm - name: start_date @@ -28,9 +32,11 @@ parameters: label: en_US: Start date zh_Hans: 开始日期 + pt_BR: Data de início human_description: en_US: The start date of the analytics. zh_Hans: 分析的开始日期。 + pt_BR: A data de início da análise. llm_description: The start date of the analytics, the format of the date must be YYYY-MM-DD like 2020-01-01. form: llm - name: end_date @@ -39,8 +45,10 @@ parameters: label: en_US: End date zh_Hans: 结束日期 + pt_BR: Data de término human_description: en_US: The end date of the analytics. zh_Hans: 分析的结束日期。 + pt_BR: A data de término da análise. llm_description: The end date of the analytics, the format of the date must be YYYY-MM-DD like 2024-01-01. form: llm diff --git a/api/core/tools/provider/builtin/youtube/youtube.yaml b/api/core/tools/provider/builtin/youtube/youtube.yaml index e5d3879d52..2bc35e9d77 100644 --- a/api/core/tools/provider/builtin/youtube/youtube.yaml +++ b/api/core/tools/provider/builtin/youtube/youtube.yaml @@ -4,9 +4,11 @@ identity: label: en_US: Youtube zh_Hans: Youtube + pt_BR: Youtube description: en_US: Youtube zh_Hans: Youtube(油管)是全球最大的视频分享网站,用户可以在上面上传、观看和分享视频。 + pt_BR: Youtube é o maior site de compartilhamento de vídeos do mundo, onde os usuários podem fazer upload, assistir e compartilhar vídeos. icon: icon.png credentails_for_provider: google_api_key: @@ -15,10 +17,13 @@ credentails_for_provider: label: en_US: Google API key zh_Hans: Google API key + pt_BR: Chave da API do Google placeholder: en_US: Please input your Google API key zh_Hans: 请输入你的 Google API key + pt_BR: Insira sua chave da API do Google help: en_US: Get your Google API key from Google zh_Hans: 从 Google 获取您的 Google API key + pt_BR: Obtenha sua chave da API do Google no Google url: https://console.developers.google.com/apis/credentials diff --git a/api/libs/helper.py b/api/libs/helper.py index b3675a635a..eb2dd94047 100644 --- a/api/libs/helper.py +++ b/api/libs/helper.py @@ -113,16 +113,6 @@ def _get_float(value): except (TypeError, ValueError): raise ValueError('{0} is not a valid float'.format(value)) - -def supported_language(lang): - if lang in ['en-US', 'zh-Hans']: - return lang - - error = ('{lang} is not a valid language.' - .format(lang=lang)) - raise ValueError(error) - - def timezone(timezone_string): if timezone_string and timezone_string in available_timezones(): return timezone_string diff --git a/api/services/account_service.py b/api/services/account_service.py index b67796bf47..076edf3786 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -8,6 +8,7 @@ from datetime import datetime, timedelta from hashlib import sha256 from typing import Any, Dict, Optional +from constants.languages import languages, language_timezone_mapping from events.tenant_event import tenant_was_created from extensions.ext_redis import redis_client from flask import current_app, session @@ -138,7 +139,7 @@ class AccountService: @staticmethod def create_account(email: str, name: str, password: str = None, - interface_language: str = 'en-US', interface_theme: str = 'light', + interface_language: str = languages[0], interface_theme: str = 'light', timezone: str = 'America/New_York', ) -> Account: """create account""" account = Account() @@ -159,11 +160,9 @@ class AccountService: account.interface_language = interface_language account.interface_theme = interface_theme - - if interface_language == 'zh-Hans': - account.timezone = 'Asia/Shanghai' - else: - account.timezone = timezone + + # Set timezone based on language + account.timezone = language_timezone_mapping.get(interface_language, 'UTC') db.session.add(account) db.session.commit() diff --git a/api/tasks/mail_invite_member_task.py b/api/tasks/mail_invite_member_task.py index c4f0d59d7e..bdb6dbacec 100644 --- a/api/tasks/mail_invite_member_task.py +++ b/api/tasks/mail_invite_member_task.py @@ -5,7 +5,7 @@ import click from celery import shared_task from extensions.ext_mail import mail from flask import current_app, render_template - +from constants.languages import languages @shared_task(queue='mail') def send_invite_member_mail_task(language: str, to: str, token: str, inviter_name: str, workspace_name: str): @@ -26,6 +26,7 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam fg='green')) start_at = time.perf_counter() + # TODO send invite member mail using different languages try: url = f'{current_app.config.get("CONSOLE_WEB_URL")}/activate?token={token}' if language == 'zh-Hans': diff --git a/web/app/(commonLayout)/apps/page.tsx b/web/app/(commonLayout)/apps/page.tsx index 30c2ef9e57..beafe31cdd 100644 --- a/web/app/(commonLayout)/apps/page.tsx +++ b/web/app/(commonLayout)/apps/page.tsx @@ -14,12 +14,6 @@ const AppList = async () => {