mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
addition i18n (#2631)
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
import { PromptTemplateItem } from '../type.d';
|
import { PromptTemplateItem } from '../type.d';
|
||||||
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||||
{
|
{
|
||||||
title: '标准模板',
|
title: i18nT('app:template.standard_template'),
|
||||||
desc: '标准提示词,用于结构不固定的知识库。',
|
desc: i18nT('app:template.standard_template_des'),
|
||||||
value: `{{q}}
|
value: `{{q}}
|
||||||
{{a}}`
|
{{a}}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '问答模板',
|
title: i18nT('app:template.qa_template'),
|
||||||
desc: '适合 QA 问答结构的知识库,可以让AI较为严格的按预设内容回答',
|
desc: i18nT('app:template.qa_template_des'),
|
||||||
value: `<Question>
|
value: `<Question>
|
||||||
{{q}}
|
{{q}}
|
||||||
</Question>
|
</Question>
|
||||||
@@ -18,14 +18,14 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
</Answer>`
|
</Answer>`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '标准严格模板',
|
title: i18nT('app:template.standard_strict'),
|
||||||
desc: '在标准模板基础上,对模型的回答做更严格的要求。',
|
desc: i18nT('app:template.standard_strict_des'),
|
||||||
value: `{{q}}
|
value: `{{q}}
|
||||||
{{a}}`
|
{{a}}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '严格问答模板',
|
title: i18nT('app:template.hard_strict'),
|
||||||
desc: '在问答模板基础上,对模型的回答做更严格的要求。',
|
desc: i18nT('app:template.hard_strict_des'),
|
||||||
value: `<Question>
|
value: `<Question>
|
||||||
{{q}}
|
{{q}}
|
||||||
</Question>
|
</Question>
|
||||||
@@ -37,7 +37,7 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
|
|
||||||
export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
||||||
{
|
{
|
||||||
title: '标准模板',
|
title: i18nT('app:template.standard_template'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: `使用 <Data></Data> 标记中的内容作为你的知识:
|
value: `使用 <Data></Data> 标记中的内容作为你的知识:
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
|||||||
问题:"""{{question}}"""`
|
问题:"""{{question}}"""`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '问答模板',
|
title: i18nT('app:template.qa_template'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: `使用 <QA></QA> 标记中的问答对进行回答。
|
value: `使用 <QA></QA> 标记中的问答对进行回答。
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
|||||||
问题:"""{{question}}"""`
|
问题:"""{{question}}"""`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '标准严格模板',
|
title: i18nT('app:template.standard_strict'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: `忘记你已有的知识,仅使用 <Data></Data> 标记中的内容作为你的知识:
|
value: `忘记你已有的知识,仅使用 <Data></Data> 标记中的内容作为你的知识:
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
|||||||
问题:"""{{question}}"""`
|
问题:"""{{question}}"""`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '严格问答模板',
|
title: i18nT('app:template.hard_strict'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
value: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||||
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
export enum FlowNodeInputTypeEnum { // render ui
|
export enum FlowNodeInputTypeEnum { // render ui
|
||||||
reference = 'reference', // reference to other node output
|
reference = 'reference', // reference to other node output
|
||||||
input = 'input', // one line input
|
input = 'input', // one line input
|
||||||
@@ -167,23 +167,23 @@ export const FlowValueTypeMap = {
|
|||||||
value: WorkflowIOValueTypeEnum.any
|
value: WorkflowIOValueTypeEnum.any
|
||||||
},
|
},
|
||||||
[WorkflowIOValueTypeEnum.chatHistory]: {
|
[WorkflowIOValueTypeEnum.chatHistory]: {
|
||||||
label: '历史记录',
|
label: i18nT('common:core.chat.History'),
|
||||||
value: WorkflowIOValueTypeEnum.chatHistory
|
value: WorkflowIOValueTypeEnum.chatHistory
|
||||||
},
|
},
|
||||||
[WorkflowIOValueTypeEnum.datasetQuote]: {
|
[WorkflowIOValueTypeEnum.datasetQuote]: {
|
||||||
label: '知识库引用',
|
label: i18nT('common:core.workflow.Dataset quote'),
|
||||||
value: WorkflowIOValueTypeEnum.datasetQuote
|
value: WorkflowIOValueTypeEnum.datasetQuote
|
||||||
},
|
},
|
||||||
[WorkflowIOValueTypeEnum.selectApp]: {
|
[WorkflowIOValueTypeEnum.selectApp]: {
|
||||||
label: '选择应用',
|
label: i18nT('common:plugin.App'),
|
||||||
value: WorkflowIOValueTypeEnum.selectApp
|
value: WorkflowIOValueTypeEnum.selectApp
|
||||||
},
|
},
|
||||||
[WorkflowIOValueTypeEnum.selectDataset]: {
|
[WorkflowIOValueTypeEnum.selectDataset]: {
|
||||||
label: '选择知识库',
|
label: i18nT('common:core.chat.Select dataset'),
|
||||||
value: WorkflowIOValueTypeEnum.selectDataset
|
value: WorkflowIOValueTypeEnum.selectDataset
|
||||||
},
|
},
|
||||||
[WorkflowIOValueTypeEnum.dynamic]: {
|
[WorkflowIOValueTypeEnum.dynamic]: {
|
||||||
label: '动态输入',
|
label: i18nT('common:core.workflow.dynamic_input'),
|
||||||
value: WorkflowIOValueTypeEnum.dynamic
|
value: WorkflowIOValueTypeEnum.dynamic
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -27,9 +27,9 @@
|
|||||||
"confirm_delete_folder_tip": "Confirm to delete this folder? All apps and corresponding conversation records under it will be deleted. Please confirm!",
|
"confirm_delete_folder_tip": "Confirm to delete this folder? All apps and corresponding conversation records under it will be deleted. Please confirm!",
|
||||||
"copy_one_app": "Create Duplicate",
|
"copy_one_app": "Create Duplicate",
|
||||||
"create_copy_success": "Duplicate Created Successfully",
|
"create_copy_success": "Duplicate Created Successfully",
|
||||||
"create_empty_app": "Create Blank App",
|
"create_empty_app": "Create Default App",
|
||||||
"create_empty_plugin": "Create Blank Plugin",
|
"create_empty_plugin": "Create Default Plugin",
|
||||||
"create_empty_workflow": "Create Blank Workflow",
|
"create_empty_workflow": "Create Default Workflow",
|
||||||
"cron": {
|
"cron": {
|
||||||
"every_day": "Run Daily",
|
"every_day": "Run Daily",
|
||||||
"every_month": "Run Monthly",
|
"every_month": "Run Monthly",
|
||||||
@@ -108,6 +108,15 @@
|
|||||||
"template": {
|
"template": {
|
||||||
"simple_robot": "Simple Robot"
|
"simple_robot": "Simple Robot"
|
||||||
},
|
},
|
||||||
|
"template.hard_strict": "Strict Q&A template",
|
||||||
|
"template.hard_strict_des": "Based on the question and answer template, stricter requirements are imposed on the model's answers.",
|
||||||
|
"template.qa_template": "Q&A template",
|
||||||
|
"template.qa_template_des": "A knowledge base suitable for QA question and answer structure, which allows AI to answer strictly according to preset content",
|
||||||
|
"template.simple_robot": "Simple robot",
|
||||||
|
"template.standard_strict": "Standard strict template",
|
||||||
|
"template.standard_strict_des": "Based on the standard template, stricter requirements are imposed on the model's answers.",
|
||||||
|
"template.standard_template": "Standard template",
|
||||||
|
"template.standard_template_des": "Standard prompt words for knowledge bases with unfixed structures.",
|
||||||
"templateMarket": {
|
"templateMarket": {
|
||||||
"Search_template": "Search Template",
|
"Search_template": "Search Template",
|
||||||
"Template_market": "Template Market",
|
"Template_market": "Template Market",
|
||||||
@@ -182,4 +191,4 @@
|
|||||||
"user_select": "User Selection",
|
"user_select": "User Selection",
|
||||||
"user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches."
|
"user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -336,7 +336,7 @@
|
|||||||
"Random": "Divergent",
|
"Random": "Divergent",
|
||||||
"Search team tags": "Search Tags",
|
"Search team tags": "Search Tags",
|
||||||
"Select TTS": "Select Voice Playback Mode",
|
"Select TTS": "Select Voice Playback Mode",
|
||||||
"Select app from template": "Select from Template",
|
"Select app from template": "Template",
|
||||||
"Select quote template": "Select Quote Prompt Template",
|
"Select quote template": "Select Quote Prompt Template",
|
||||||
"Set a name for your app": "Set a Name for Your App",
|
"Set a name for your app": "Set a Name for Your App",
|
||||||
"Setting ai property": "Click to Configure AI Model Properties",
|
"Setting ai property": "Click to Configure AI Model Properties",
|
||||||
@@ -957,6 +957,7 @@
|
|||||||
"Run result": "Run Result",
|
"Run result": "Run Result",
|
||||||
"Show result": "Show Result"
|
"Show result": "Show Result"
|
||||||
},
|
},
|
||||||
|
"dynamic_input": "dynamic input",
|
||||||
"inputType": {
|
"inputType": {
|
||||||
"JSON Editor": "JSON Input Box",
|
"JSON Editor": "JSON Input Box",
|
||||||
"Manual input": "Manual Input",
|
"Manual input": "Manual Input",
|
||||||
|
@@ -99,7 +99,15 @@
|
|||||||
"setting_app": "应用配置",
|
"setting_app": "应用配置",
|
||||||
"setting_plugin": "插件配置",
|
"setting_plugin": "插件配置",
|
||||||
"template": {
|
"template": {
|
||||||
"simple_robot": "简易机器人"
|
"simple_robot": "简易机器人",
|
||||||
|
"standard_template": "标准模板",
|
||||||
|
"standard_template_des": "标准提示词,用于结构不固定的知识库。",
|
||||||
|
"qa_template": "问答模板",
|
||||||
|
"qa_template_des": "适合 QA 问答结构的知识库,可以让AI较为严格的按预设内容回答",
|
||||||
|
"standard_strict": "标准严格模板",
|
||||||
|
"standard_strict_des": "在标准模板基础上,对模型的回答做更严格的要求。",
|
||||||
|
"hard_strict": "严格问答模板",
|
||||||
|
"hard_strict_des": "在问答模板基础上,对模型的回答做更严格的要求。"
|
||||||
},
|
},
|
||||||
"templateMarket": {
|
"templateMarket": {
|
||||||
"Search_template": "搜索模板",
|
"Search_template": "搜索模板",
|
||||||
@@ -182,4 +190,4 @@
|
|||||||
"manage": "写权限基础上,可配置发布渠道、查看对话日志、分配该应用权限"
|
"manage": "写权限基础上,可配置发布渠道、查看对话日志、分配该应用权限"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -927,6 +927,7 @@
|
|||||||
},
|
},
|
||||||
"view_chat_detail": "查看对话详情",
|
"view_chat_detail": "查看对话详情",
|
||||||
"workflow": {
|
"workflow": {
|
||||||
|
"dynamic_input": "动态输入",
|
||||||
"Can not delete node": "该节点不允许删除",
|
"Can not delete node": "该节点不允许删除",
|
||||||
"Change input type tip": "修改输入类型会清空已填写的值,请确认!",
|
"Change input type tip": "修改输入类型会清空已填写的值,请确认!",
|
||||||
"Check Failed": "工作流校验失败,请检查节点是否正确填值,以及连线是否正常",
|
"Check Failed": "工作流校验失败,请检查节点是否正确填值,以及连线是否正常",
|
||||||
|
@@ -37,10 +37,10 @@ const PromptTemplate = ({
|
|||||||
: {})}
|
: {})}
|
||||||
onClick={() => setSelectTemplateTitle(item)}
|
onClick={() => setSelectTemplateTitle(item)}
|
||||||
>
|
>
|
||||||
<Box color={'myGray.900'}>{item.title}</Box>
|
<Box color={'myGray.900'}>{t(item.title as any)}</Box>
|
||||||
|
|
||||||
<Box color={'myGray.500'} fontSize={'xs'} whiteSpace={'pre-wrap'}>
|
<Box color={'myGray.500'} fontSize={'xs'} whiteSpace={'pre-wrap'}>
|
||||||
{item.desc}
|
{t(item.desc as any)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
@@ -415,7 +415,7 @@ const MenuRender = React.memo(function MenuRender({
|
|||||||
leftIcon={<MyIcon name={item.icon as any} w={'13px'} />}
|
leftIcon={<MyIcon name={item.icon as any} w={'13px'} />}
|
||||||
onClick={item.onClick}
|
onClick={item.onClick}
|
||||||
>
|
>
|
||||||
{item.label}
|
{t(item.label as any)}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
@@ -3,14 +3,15 @@ import type { RenderInputProps } from '../type';
|
|||||||
import { Input } from '@chakra-ui/react';
|
import { Input } from '@chakra-ui/react';
|
||||||
import { useContextSelector } from 'use-context-selector';
|
import { useContextSelector } from 'use-context-selector';
|
||||||
import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context';
|
import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
const TextInput = ({ item, nodeId }: RenderInputProps) => {
|
const TextInput = ({ item, nodeId }: RenderInputProps) => {
|
||||||
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
|
||||||
|
const { t } = useTranslation();
|
||||||
const Render = useMemo(() => {
|
const Render = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
placeholder={item.placeholder ?? item.description}
|
placeholder={t(item.placeholder as any) ?? t(item.description as any)}
|
||||||
defaultValue={item.value}
|
defaultValue={item.value}
|
||||||
bg={'white'}
|
bg={'white'}
|
||||||
px={3}
|
px={3}
|
||||||
@@ -28,7 +29,7 @@ const TextInput = ({ item, nodeId }: RenderInputProps) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}, [item, nodeId, onChangeNode]);
|
}, [item, nodeId, onChangeNode, t]);
|
||||||
|
|
||||||
return Render;
|
return Render;
|
||||||
};
|
};
|
||||||
|
@@ -3,6 +3,7 @@ import { Box } from '@chakra-ui/react';
|
|||||||
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
import { WorkflowIOValueTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
const ValueTypeLabel = ({
|
const ValueTypeLabel = ({
|
||||||
valueType,
|
valueType,
|
||||||
@@ -12,7 +13,7 @@ const ValueTypeLabel = ({
|
|||||||
valueDesc?: string;
|
valueDesc?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const valueTypeData = valueType ? FlowValueTypeMap[valueType] : undefined;
|
const valueTypeData = valueType ? FlowValueTypeMap[valueType] : undefined;
|
||||||
|
const { t } = useTranslation();
|
||||||
const label = valueTypeData?.label || '';
|
const label = valueTypeData?.label || '';
|
||||||
|
|
||||||
return !!label ? (
|
return !!label ? (
|
||||||
@@ -29,7 +30,7 @@ const ValueTypeLabel = ({
|
|||||||
alignItems={'center'}
|
alignItems={'center'}
|
||||||
fontSize={'11px'}
|
fontSize={'11px'}
|
||||||
>
|
>
|
||||||
{label}
|
{t(label as any)}
|
||||||
</Box>
|
</Box>
|
||||||
</MyTooltip>
|
</MyTooltip>
|
||||||
) : null;
|
) : null;
|
||||||
|
Reference in New Issue
Block a user