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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ export default {
}, },
source_url: { source_url: {
label: 'Web Root 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' requiredMessage: 'Please enter the Web root URL'
}, },
selector: { selector: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -106,7 +106,7 @@
}} }}
</template> </template>
</el-table-column> </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 }"> <template #default="{ row, $index }">
<span class="mr-4"> <span class="mr-4">
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top"> <el-tooltip effect="dark" :content="$t('common.modify')" placement="top">

View File

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

View File

@ -41,7 +41,7 @@
</template> </template>
</el-table-column> </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 }"> <template #default="{ row, $index }">
<span class="mr-4"> <span class="mr-4">
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top"> <el-tooltip effect="dark" :content="$t('common.modify')" placement="top">

View File

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