feat: i18n

This commit is contained in:
wangdan-fit2cloud 2025-01-21 19:24:56 +08:00
parent 4dc2036530
commit 47bcb7f2e5
23 changed files with 75 additions and 80 deletions

View File

@ -6,7 +6,7 @@
<el-input
ref="quickInputRef"
v-model="inputValue"
:placeholder="`${$t('common.inputPlaceholder')}${quickCreateName}`"
:placeholder="`${$t('common.inputPlaceholder')} ${quickCreateName}`"
class="w-500 mr-12"
autofocus
:maxlength="quickCreateMaxlength || '-'"
@ -62,11 +62,11 @@ const props = defineProps({
},
quickCreateName: {
type: String,
default: '文档名称'
default: t('components.quickCreateName')
},
quickCreatePlaceholder: {
type: String,
default: '快速创建空白文档'
default: t('components.quickCreatePlaceholder')
},
quickCreateMaxlength: {
type: Number,

View File

@ -68,7 +68,7 @@
v-model="formValue.default_value"
:maxlength="formValue.maxlength"
:minlength="formValue.minlength"
:placeholder="$t('dynamicsForm.paramForm.default.placeholder')"
:placeholder="$t('dynamicsForm.default.placeholder')"
show-word-limit
type="text"
/>

View File

@ -20,8 +20,8 @@
</div>
<div class="ml-12 lighter">
<p>{{ $t('views.document.generateQuestion.tip1', { data: '{data}' }) }}</p>
<p>{{ $t('views.document.generateQuestion.tip2') }}</p>
<p>{{ $t('views.document.generateQuestion.tip3') }}</p>
<p>{{ $t('views.document.generateQuestion.tip2')+ '<question></question>' + $t('views.document.generateQuestion.tip3') }}</p>
<p>{{ $t('views.document.generateQuestion.tip4') }}</p>
</div>
</div>
<el-form-item
@ -88,7 +88,6 @@ const apiType = ref('') // 文档document或段落paragraph
const FormRef = ref()
const userId = user.userInfo?.id as string
const form = ref(prompt.get(userId))
const rules = reactive({
model_id: [
{

View File

@ -34,7 +34,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('common.status')" width="80">
<el-table-column :label="$t('common.status.label')" width="80">
<template #default="{ row }">
<div @click.stop>
<el-switch size="small" v-model="row.is_active" @change="changeState($event, row)" />
@ -110,8 +110,8 @@ function settingApiKey(row: any) {
function deleteApiKey(row: any) {
MsgConfirm(
// @ts-ignore
`${t('common.msgConfirm1')}: ${row.secret_key}?`,
t('common.msgConfirm2'),
`${t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1')}: ${row.secret_key}?`,
t(t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2')),
{
confirmButtonText: t('common.delete'),
cancelButtonText: t('common.cancel'),

View File

@ -24,8 +24,8 @@ export default {
search: 'Search',
clear: 'Clear',
professional: 'Purchase the Professional Edition',
createDate: 'Create date',
createTime: 'Create time',
createDate: 'Create Date',
createTime: 'Create Time',
operation: 'Operation',
character: 'words',
export: 'Export',

View File

@ -11,10 +11,10 @@ export default {
RadioRow: 'Radio Row'
},
default: {
label: 'Default Value',
placeholder: 'Please enter a default value',
label: 'Default',
placeholder: 'Please enter a default',
requiredMessage: ' is a required property',
show: 'Show Default Value'
show: 'Show Default'
},
tip: {
requiredMessage: 'Cannot be empty',
@ -31,22 +31,22 @@ export default {
requiredMessage2: 'Only letters, numbers, and underscores are allowed'
},
name: {
label: 'Display Name',
placeholder: 'Please enter a display name',
requiredMessage: 'Display Name is a required property'
label: 'Name',
placeholder: 'Please enter a name',
requiredMessage: 'Name is a required property'
},
tooltip: {
label: 'Parameter Tooltip',
placeholder: 'Please enter a parameter tooltip'
label: 'Tooltip',
placeholder: 'Please enter a tooltip'
},
required: {
label: 'Is Required',
requiredMessage: 'Is Required is a required property'
label: 'Required',
requiredMessage: 'Required is a required property'
},
input_type: {
label: 'Component Type',
placeholder: 'Please select a component type',
requiredMessage: 'Component Type is a required property'
label: 'Type',
placeholder: 'Please select a type',
requiredMessage: 'Type is a required property'
}
},
DatePicker: {

View File

@ -1,7 +1,7 @@
export default {
github: 'Project address',
wiki: 'User manual',
forum: 'Forum for help',
github: 'Project Address',
wiki: 'User Manual',
forum: 'Forum For Help',
avatar: {
about: 'About',
logout: 'Logout',

View File

@ -8,8 +8,8 @@ export default {
copyLinkText: 'Copy Link',
refreshLinkText: 'Refresh Link',
demo: 'Demo',
embedThirdParty: 'Embed Third Party',
accessRestrictions: 'Access Restrictions',
embedInWebsite: 'Embed in website',
accessControl: 'Access Control',
displaySetting: 'Display Setting',
apiAccessCredentials: 'API Access Credentials',
apiKey: 'API Key',
@ -38,7 +38,6 @@ export default {
uploadImagePrompt: 'Please upload an image'
},
EmbedDialog: {
embedDialogTitle: 'Embed Third Party',
fullscreenModeTitle: 'Fullscreen Mode',
copyInstructions: 'Copy the following code to embed',
floatingModeTitle: 'Floating Mode'
@ -95,10 +94,10 @@ export default {
startDatePlaceholder: 'Start Date',
endDatePlaceholder: 'End Date',
pastDayOptions: {
past7Days: 'Past 7 Days',
past30Days: 'Past 30 Days',
past90Days: 'Past 90 Days',
past183Days: 'Past Half Year',
past7Days: 'Last 7 Days',
past30Days: 'Last 30 Days',
past90Days: 'Last 90 Days',
past183Days: 'Last 6 Months',
other: 'Custom'
},
charts: {

View File

@ -53,7 +53,7 @@ export default {
},
source_url: {
label: 'Web Root URL',
placeholder: 'Please enter the Web root URL',
placeholder: 'Please enter the web root URL',
requiredMessage: 'Please enter the Web root URL'
},
selector: {

View File

@ -130,8 +130,8 @@ export default {
'Segments within the selected documents will also be deleted. Please proceed with caution.',
successMessage: 'Batch deletion successful',
confirmTitle3: 'Confirm Deleting Document:',
confirmMessage1:
'All segments under this document will be deleted. Please proceed with caution.'
confirmMessage1: 'Under this document',
confirmMessage2: 'All segments will be deleted, please operate with caution. '
},
form: {
source_url: {
@ -166,11 +166,11 @@ export default {
title: 'Generate Questions',
successMessage: 'Question generation successful',
tip1: 'The {data} in the prompt is a placeholder for segmented content, which is replaced by the segmented content when executed and sent to the AI model;',
tip2: 'The AI model generates relevant questions based on the segmented content. Please place the generated questions within the &lt;question&gt;&lt;/question&gt; tags, and the system will automatically associate the questions within these tags;',
tip3: 'The generation effect depends on the selected model and prompt. Users can adjust to achieve the best effect.',
prompt:`Content: {data}\n
\n
Please summarize the above content and generate a summary based on the content 5 a question. \n
Answer requirements: \n - Please output only questions; \n - Please place each question in&lt;question&gt;&lt;/question&gt;tag.`
tip2: 'The AI model generates relevant questions based on the segmented content. Please place the generated questions within the',
tip3: 'tags, and the system will automatically associate the questions within these tags;',
tip4: 'The generation effect depends on the selected model and prompt. Users can adjust to achieve the best effect.',
prompt1:
'Content: {data}\n \n Please summarize the above content and generate a summary based on the content 5 a question. \nAnswer requirements: \n - Please output only questions; \n - Please place each question in',
prompt2: 'tag.'
}
}

View File

@ -8,8 +8,8 @@ export default {
copyLinkText: '复制链接',
refreshLinkText: '刷新链接',
demo: '演示',
embedThirdParty: '嵌入第三方',
accessRestrictions: '访问限制',
embedInWebsite: '嵌入第三方',
accessControl: '访问限制',
displaySetting: '显示设置',
apiAccessCredentials: 'API 访问凭据',
apiKey: 'API Key',
@ -38,13 +38,11 @@ export default {
uploadImagePrompt: '请上传一张图片'
},
EmbedDialog: {
embedDialogTitle: '嵌入第三方',
fullscreenModeTitle: '全屏模式',
copyInstructions: '复制以下代码进行嵌入',
floatingModeTitle: '浮窗模式'
},
LimitDialog: {
dialogTitle: '访问限制',
showSourceLabel: '显示知识来源',
clientQueryLimitLabel: '每个客户端提问限制',
timesDays: '次/天',

View File

@ -162,13 +162,10 @@ export default {
title: '生成问题',
successMessage: '生成问题成功',
tip1: '提示词中的 {data} 为分段内容的占位符,执行时替换为分段内容发送给 AI 模型;',
tip2: 'AI 模型根据分段内容生成相关问题,请将生成的问题放至&lt;question&gt;&lt;/question&gt;标签中,系统会自动关联标签中的问题;',
tip3: '生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。',
prompt:`内容:{data}\n
\n
5 \n
\n
- \n
- &lt;question&gt;&lt;/question&gt;`
tip2: 'AI 模型根据分段内容生成相关问题,请将生成的问题放至',
tip3: '标签中,系统会自动关联标签中的问题;',
tip4: '生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。',
prompt1: `内容:{data}\n\n请总结上面的内容并根据内容总结生成 5 个问题。\n回答要求\n- 请只输出问题;\n- 请将每个问题放置`,
prompt2: `标签中。`
}
}

View File

@ -8,8 +8,8 @@ export default {
copyLinkText: '複製連結',
refreshLinkText: '重新整理連結',
demo: '示範',
embedThirdParty: '嵌入第三方',
accessRestrictions: '訪問限制',
embedInWebsite: '嵌入第三方',
accessControl: '訪問限制',
displaySetting: '顯示設定',
apiAccessCredentials: 'API 存取憑證',
apiKey: 'API Key',
@ -37,7 +37,6 @@ export default {
uploadImagePrompt: '請上傳一張圖片'
},
EmbedDialog: {
embedDialogTitle: '嵌入第三方',
fullscreenModeTitle: '全螢幕模式',
copyInstructions: '複製以下程式碼進行嵌入',
floatingModeTitle: '浮窗模式'

View File

@ -163,11 +163,10 @@ export default {
title: '生成問題',
successMessage: '生成問題成功',
tip1: '提示詞中的 {data} 為分段內容的佔位符,執行時替換為分段內容並發送給 AI 模型;',
tip2: 'AI 模型根據分段內容生成相關問題,請將生成的問題放置於&lt;question&gt;&lt;/question&gt; 標籤中,系統會自動關聯標籤中的問題;',
tip3: '生成效果取決於所選模型和提示詞,用戶可自行調整至最佳效果。',
prompt:`內容:{data}\n
\n
5 \n
\n - \n - &lt;question&gt;&lt;/question&gt;`
tip2: 'AI 模型根據分段內容生成相關問題,請將生成的問題放置於',
tip3: '標籤中,系統會自動關聯標籤中的問題;',
tip4: '生成效果取決於所選模型和提示詞,用戶可自行調整至最佳效果。',
prompt1: `內容:{data}\n\n請總結上面的內容並根據內容總結生成 5 個問題。\n回答要求\n - 請只輸出問題;\n - 請將每個問題放置在`,
prompt2: `標籤中。`
}
}

View File

@ -2,12 +2,12 @@ import { defineStore } from 'pinia'
import { t } from '@/locales'
export interface promptTypes {
user: string
formValue: { model_id: string, prompt: string }
formValue: { model_id: string; prompt: string }
}
const usePromptStore = defineStore({
id: 'prompt',
state: (): promptTypes[] => (JSON.parse(localStorage.getItem('PROMPT_CACHE') || '[]')),
state: (): promptTypes[] => JSON.parse(localStorage.getItem('PROMPT_CACHE') || '[]'),
actions: {
save(user: string, formValue: any) {
this.$state.forEach((item: any, index: number) => {
@ -19,6 +19,7 @@ const usePromptStore = defineStore({
localStorage.setItem('PROMPT_CACHE', JSON.stringify(this.$state))
},
get(user: string) {
console.log(this.$state)
for (let i = 0; i < this.$state.length; i++) {
if (this.$state[i].user === user) {
return this.$state[i].formValue
@ -26,10 +27,13 @@ const usePromptStore = defineStore({
}
return {
model_id: '',
prompt: t('views.document.generateQuestion.prompt', { data: '{data}' })
prompt:
t('views.document.generateQuestion.prompt1', { data: '{data}' }) +
'<question></question>' +
t('views.document.generateQuestion.prompt2')
}
}
}
})
export default usePromptStore
export default usePromptStore

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
:title="$t('views.applicationOverview.appInfo.EmbedDialog.embedDialogTitle')"
:title="$t('views.applicationOverview.appInfo.embedInWebsite')"
v-model="dialogVisible"
width="900"
class="embed-dialog"

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
:title="$t('views.applicationOverview.appInfo.LimitDialog.dialogTitle')"
:title="$t('views.applicationOverview.appInfo.accessControl')"
v-model="dialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"

View File

@ -85,10 +85,10 @@
{{ $t('views.applicationOverview.appInfo.demo') }}
</el-button>
<el-button :disabled="!accessToken?.is_active" @click="openDialog">
{{ $t('views.applicationOverview.appInfo.embedThirdParty') }}
{{ $t('views.applicationOverview.appInfo.embedInWebsite') }}
</el-button>
<el-button @click="openLimitDialog">
{{ $t('views.applicationOverview.appInfo.accessRestrictions') }}
{{ $t('views.applicationOverview.appInfo.accessControl') }}
</el-button>
<el-button @click="openDisplaySettingDialog">
{{ $t('views.applicationOverview.appInfo.displaySetting') }}

View File

@ -45,7 +45,7 @@
<template #label>
<div class="flex align-center">
<span class="mr-4">{{
$t('views.document.form.hit_handling_method.requiredMessage')
$t('views.document.form.hit_handling_method.label')
}}</span>
<el-tooltip
effect="dark"

View File

@ -106,7 +106,7 @@
}}
</template>
</el-table-column>
<el-table-column :label="$t('common.operation')" align="left" width="80">
<el-table-column :label="$t('common.operation')" align="left" width="90">
<template #default="{ row, $index }">
<span class="mr-4">
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">

View File

@ -38,7 +38,7 @@
<el-table-column
:label="$t('views.team.setting.management')"
align="center"
width="80"
width="100"
fixed="right"
>
<template #header>
@ -57,7 +57,7 @@
/>
</template>
</el-table-column>
<el-table-column :label="$t('views.team.setting.check')" align="center" width="80" fixed="right">
<el-table-column :label="$t('views.team.setting.check')" align="center" width="100" fixed="right">
<template #header>
<el-checkbox
:disabled="props.manage"

View File

@ -41,7 +41,7 @@
</template>
</el-table-column>
<el-table-column :label="$t('common.operation')" align="left" width="80">
<el-table-column :label="$t('common.operation')" align="left" width="90">
<template #default="{ row, $index }">
<span class="mr-4">
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">

View File

@ -37,13 +37,13 @@
prop="default_value"
:rules="{
required: form.is_required,
message: $t('dynamicsForm.paramForm.default.placeholder'),
message: $t('dynamicsForm.default.placeholder'),
trigger: 'blur'
}"
>
<el-input
v-model="form.default_value"
:placeholder="$t('dynamicsForm.paramForm.default.placeholder')"
:placeholder="$t('dynamicsForm.default.placeholder')"
@blur="form.name = form.name.trim()"
/>
</el-form-item>