chore: Enable Japanese descriptions for Tools (#8646)

This commit is contained in:
Shota Totsuka 2024-09-23 10:06:01 +09:00 committed by GitHub
parent cae73b9a32
commit 03fdf5e7f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 5 deletions

View File

@ -10,6 +10,7 @@ class I18nObject(BaseModel):
zh_Hans: Optional[str] = None
pt_BR: Optional[str] = None
ja_JP: Optional[str] = None
en_US: str
def __init__(self, **data):
@ -18,6 +19,8 @@ class I18nObject(BaseModel):
self.zh_Hans = self.en_US
if not self.pt_BR:
self.pt_BR = self.en_US
if not self.ja_JP:
self.ja_JP = self.en_US
def to_dict(self) -> dict:
return {"zh_Hans": self.zh_Hans, "en_US": self.en_US, "pt_BR": self.pt_BR}
return {"zh_Hans": self.zh_Hans, "en_US": self.en_US, "pt_BR": self.pt_BR, "ja_JP": self.ja_JP}

View File

@ -4,9 +4,11 @@ identity:
label:
en_US: ArXiv
zh_Hans: ArXiv
ja_JP: ArXiv
description:
en_US: Access to a vast repository of scientific papers and articles in various fields of research.
zh_Hans: 访问各个研究领域大量科学论文和文章的存储库。
ja_JP: 多様な研究分野の科学論文や記事の膨大なリポジトリへのアクセス。
icon: icon.svg
tags:
- search

View File

@ -4,10 +4,12 @@ identity:
label:
en_US: Arxiv Search
zh_Hans: Arxiv 搜索
ja_JP: Arxiv 検索
description:
human:
en_US: A tool for searching scientific papers and articles from the Arxiv repository. Input can be an Arxiv ID or an author's name.
zh_Hans: 一个用于从Arxiv存储库搜索科学论文和文章的工具。 输入可以是Arxiv ID或作者姓名。
ja_JP: Arxivリポジトリから科学論文や記事を検索するためのツールです。入力はArxiv IDまたは著者名にすることができます。
llm: A tool for searching scientific papers and articles from the Arxiv repository. Input can be an Arxiv ID or an author's name.
parameters:
- name: query
@ -16,8 +18,10 @@ parameters:
label:
en_US: Query string
zh_Hans: 查询字符串
ja_JP: クエリ文字列
human_description:
en_US: The Arxiv ID or author's name used for searching.
zh_Hans: 用于搜索的Arxiv ID或作者姓名。
ja_JP: 検索に使用されるArxiv IDまたは著者名。
llm_description: The Arxiv ID or author's name used for searching.
form: llm

View File

@ -74,12 +74,14 @@ class ToolTransformService:
en_US=provider_controller.identity.description.en_US,
zh_Hans=provider_controller.identity.description.zh_Hans,
pt_BR=provider_controller.identity.description.pt_BR,
ja_JP=provider_controller.identity.description.ja_JP,
),
icon=provider_controller.identity.icon,
label=I18nObject(
en_US=provider_controller.identity.label.en_US,
zh_Hans=provider_controller.identity.label.zh_Hans,
pt_BR=provider_controller.identity.label.pt_BR,
ja_JP=provider_controller.identity.label.ja_JP,
),
type=ToolProviderType.BUILT_IN,
masked_credentials={},

View File

@ -31,10 +31,8 @@ export const languages = data.languages
export const LanguagesSupported = languages.filter(item => item.supported).map(item => item.value)
export const getLanguage = (locale: string) => {
if (locale === 'zh-Hans')
return locale.replace('-', '_')
return LanguagesSupported[0].replace('-', '_')
const supportedLocale = LanguagesSupported.find(lang => lang.startsWith(locale.split('-')[0]))
return (supportedLocale || LanguagesSupported[0]).replace('-', '_')
}
export const NOTICE_I18N = {