谦言 commited on
Commit
0a72604
1 Parent(s): 26a67d8

change language default to en and add serveral english text

Browse files
Files changed (3) hide show
  1. app.py +7 -9
  2. config/builder_config.json +5 -5
  3. i18n.py +12 -2
app.py CHANGED
@@ -162,16 +162,18 @@ with demo:
162
  uuid_str = gr.Textbox(label='modelscope_uuid', visible=False)
163
  draw_seed = random.randint(0, 1000000000)
164
  state = gr.State({'session_seed': draw_seed})
165
- i18n = I18n('zh-cn')
 
 
166
  with gr.Row():
167
  with gr.Column(scale=5):
168
  header = gr.Markdown(i18n.get('header'))
169
  with gr.Column(scale=1):
170
  language = gr.Dropdown(
171
- choices=[('中文', 'zh-cn'), ('English', 'en')],
172
  show_label=False,
173
  container=False,
174
- value='zh-cn',
175
  interactive=True)
176
  with gr.Row():
177
  with gr.Column():
@@ -179,8 +181,7 @@ with demo:
179
  with gr.Tab(i18n.get_whole('create'), id=0) as create_tab:
180
  with gr.Column():
181
  # "Create" 标签页的 Chatbot 组件
182
- start_text = '欢迎使用agent创建助手。我可以帮助您创建一个定制agent。'\
183
- '您希望您的agent主要用于什么领域或任务?比如,您可以说,我想做一个RPG游戏agent'
184
  create_chatbot = gr.Chatbot(
185
  show_label=False, value=[[None, start_text]])
186
  create_chat_input = gr.Textbox(
@@ -234,10 +235,7 @@ with demo:
234
  col_count=(1, 'fixed'),
235
  interactive=True)
236
  gr.Markdown(
237
- '*注意:知识库上传的文本文档默认按照\\n\\n切分,pdf默认按照页切分。如果片段'
238
- '对应的字符大于[配置文件](https://github.com/modelscope/modelscope-agent/'
239
- 'blob/master/apps/agentfabric/config/model_config.json)中指定模型的'
240
- 'knowledge限制,则在被召回时有可能会被截断。*')
241
  knowledge_input = gr.File(
242
  label=i18n.get('form_knowledge'),
243
  file_count='multiple',
 
162
  uuid_str = gr.Textbox(label='modelscope_uuid', visible=False)
163
  draw_seed = random.randint(0, 1000000000)
164
  state = gr.State({'session_seed': draw_seed})
165
+ #i18n = I18n('zh-cn')
166
+ i18n = I18n('en')
167
+
168
  with gr.Row():
169
  with gr.Column(scale=5):
170
  header = gr.Markdown(i18n.get('header'))
171
  with gr.Column(scale=1):
172
  language = gr.Dropdown(
173
+ choices=[('English', 'en'), ('中文', 'zh-cn')],
174
  show_label=False,
175
  container=False,
176
+ value='en',
177
  interactive=True)
178
  with gr.Row():
179
  with gr.Column():
 
181
  with gr.Tab(i18n.get_whole('create'), id=0) as create_tab:
182
  with gr.Column():
183
  # "Create" 标签页的 Chatbot 组件
184
+ start_text = i18n.get('start_text')
 
185
  create_chatbot = gr.Chatbot(
186
  show_label=False, value=[[None, start_text]])
187
  create_chat_input = gr.Textbox(
 
235
  col_count=(1, 'fixed'),
236
  interactive=True)
237
  gr.Markdown(
238
+ i18n.get_whole('knowledge_text'))
 
 
 
239
  knowledge_input = gr.File(
240
  label=i18n.get('form_knowledge'),
241
  file_count='multiple',
config/builder_config.json CHANGED
@@ -3,12 +3,12 @@
3
  "avatar": "custom_bot_avatar.png",
4
  "description": "",
5
  "instruction": "",
6
- "language": "zh",
7
  "prompt_recommend": [
8
- "你可以做什么?",
9
- "你有什么功能?",
10
- "如何使用你的功能?",
11
- "能否给我一些示例指令?"
12
  ],
13
  "knowledge": [],
14
  "tools": {
 
3
  "avatar": "custom_bot_avatar.png",
4
  "description": "",
5
  "instruction": "",
6
+ "language": "en",
7
  "prompt_recommend": [
8
+ "你可以做什么?What can you do?",
9
+ "你有什么功能?What are your features?",
10
+ "如何使用你的功能? How to use your features?",
11
+ "能否给我一些示例指令? Can you give me some examples of instructions?"
12
  ],
13
  "knowledge": [],
14
  "tools": {
i18n.py CHANGED
@@ -57,8 +57,18 @@ i18n = {
57
  """
58
  ],
59
  'header': [
60
- '<span style="font-size: 20px; font-weight: 500;">\N{fire} AgentFabric -- 由 Modelscope-agent 驱动 </span> [github 点赞](https://github.com/modelscope/modelscope-agent/tree/main)', # noqa E501
61
- '<span style="font-size: 20px; font-weight: 500;">\N{fire} AgentFabric powered by Modelscope-agent </span> [github star](https://github.com/modelscope/modelscope-agent/tree/main)' # noqa E501
 
 
 
 
 
 
 
 
 
 
62
  ],
63
  }
64
 
 
57
  """
58
  ],
59
  'header': [
60
+ '<span style="font-size: 20px; font-weight: 500;">\N{fire} AgentScope -- 由 Modelscope-agent 驱动 </span> [github 点赞](https://github.com/modelscope/modelscope-agent/tree/main)', # noqa E501
61
+ '<span style="font-size: 20px; font-weight: 500;">\N{fire} AgentScope powered by Modelscope-agent </span> [github star](https://github.com/modelscope/modelscope-agent/tree/main)' # noqa E501
62
+ ],
63
+
64
+ 'start_text': [
65
+ '欢迎使用agent创建助手。我可以帮助您创建一个定制agent。您希望您的agent主要用于什么领域或任务?比如,您可以说,我想做一个RPG游戏agent', # noqa E501
66
+ 'Welcome to AgentScope. I can help you create a custom agent. What field or task do you want your agent to be mainly used for? For example, you can say, I want to make an RPG game agent', # noqa E501
67
+ ],
68
+
69
+ 'knowledge_text': [
70
+ '*注意:知识库上传的文本文档默认按照\\n\\n切分,pdf默认按照页切分。如果片段对应的字符大于[配置文件](https://github.com/modelscope/modelscope-agent/blob/master/apps/agentfabric/config/model_config.json)中指定模型的knowledge限制,则在被召回时有可能会被截断。*', # noqa E501
71
+ '*Note: The text document uploaded by the knowledge base is split by \\n\\n by default, and the pdf is split by page by default. If the number of characters corresponding to the fragment is greater than the knowledge limit of the specified model in the [configuration file]((https://github.com/modelscope/modelscope-agent/blob/master/apps/agentfabric/config/model_config.json)', # noqa E501
72
  ],
73
  }
74