Skip to content

Commit 1389c58

Browse files
feat: i18n
1 parent 27a8fac commit 1389c58

File tree

78 files changed

+648
-663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+648
-663
lines changed

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 74 additions & 40 deletions
Large diffs are not rendered by default.

ui/src/components/ai-chat/KnowledgeSource.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
22
<div class="flex align-center mt-16" v-if="!isWorkFlow(props.type)">
3-
<span class="mr-4 color-secondary">{{ $t('components.chat.KnowledgeSource.title') }}</span>
3+
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
44
<el-divider direction="vertical" />
55
<el-button type="primary" class="mr-8" link @click="openParagraph(data)">
66
<AppIcon iconName="app-reference-outlined" class="mr-4"></AppIcon>
7-
{{ $t('components.chat.KnowledgeSource.referenceParagraph') }}
7+
{{ $t('chat.KnowledgeSource.referenceParagraph') }}
88
{{ data.paragraph_list?.length || 0 }}</el-button
99
>
1010
</div>
@@ -43,8 +43,8 @@
4343

4444
<div class="border-t color-secondary flex-between mt-12" style="padding-top: 12px">
4545
<div>
46-
<span class="mr-8"> {{ $t('components.chat.KnowledgeSource.consume') }} tokens: {{ data?.message_tokens + data?.answer_tokens }} </span>
47-
<span> {{ $t('components.chat.KnowledgeSource.consumeTime') }}: {{ data?.run_time?.toFixed(2) }} s</span>
46+
<span class="mr-8"> {{ $t('chat.KnowledgeSource.consume') }} tokens: {{ data?.message_tokens + data?.answer_tokens }} </span>
47+
<span> {{ $t('chat.KnowledgeSource.consumeTime') }}: {{ data?.run_time?.toFixed(2) }} s</span>
4848
</div>
4949
<el-button
5050
v-if="isWorkFlow(props.type)"
@@ -53,7 +53,7 @@
5353
@click="openExecutionDetail(data.execution_details)"
5454
>
5555
<el-icon class="mr-4"><Document /></el-icon>
56-
{{ $t('components.chat.executionDetails.title') }}</el-button
56+
{{ $t('chat.executionDetails.title') }}</el-button
5757
>
5858
</div>
5959
<!-- 知识库引用 dialog -->

ui/src/components/ai-chat/ParagraphSourceDialog.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<el-dialog
33
class="paragraph-source"
4-
title="知识库引用"
4+
:title="$t('chat.paragraphSource.title')"
55
v-model="dialogVisible"
66
destroy-on-close
77
append-to-body
@@ -13,13 +13,13 @@
1313
<el-scrollbar>
1414
<div class="paragraph-source-height p-16 pb-0">
1515
<el-form label-position="top">
16-
<el-form-item label="用户问题">
16+
<el-form-item :label="$t('chat.paragraphSource.question')">
1717
<el-input v-model="detail.problem_text" disabled />
1818
</el-form-item>
19-
<el-form-item label="优化后问题">
19+
<el-form-item :label="$t('chat.paragraphSource.optimizationQuestion')">
2020
<el-input v-model="detail.padding_problem_text" disabled />
2121
</el-form-item>
22-
<el-form-item :label="$t('components.chat.KnowledgeSource.referenceParagraph')">
22+
<el-form-item :label="$t('chat.KnowledgeSource.referenceParagraph')">
2323
<div v-if="detail.paragraph_list.length > 0" class="w-full">
2424
<template v-for="(item, index) in detail.paragraph_list" :key="index">
2525
<ParagraphCard :data="item" :index="index" />

ui/src/components/ai-chat/component/answer-content/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
(chatRecord.write_ed === undefined || chatRecord.write_ed === true) &&
1313
!answer_text.content
1414
"
15-
source=" 抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。"
15+
:source="$t('chat.tip.answerMessage')"
1616
></MdRenderer>
1717
<MdRenderer
1818
:chat_record_id="answer_text.chat_record_id"
@@ -24,10 +24,10 @@
2424
:send-message="chatMessage"
2525
></MdRenderer>
2626
<span v-else-if="chatRecord.is_stop" shadow="always" class="dialog-card">
27-
已停止回答
27+
{{ $t('chat.tip.stopAnswer') }}
2828
</span>
2929
<span v-else shadow="always" class="dialog-card">
30-
回答中 <span class="dotting"></span>
30+
{{ $t('chat.tip.answerLoading') }} <span class="dotting"></span>
3131
</span>
3232
<!-- 知识来源 -->
3333
<div v-if="showSource(chatRecord) && index === chatRecord.answer_text_list.length - 1">

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@
9595
v-model="inputValue"
9696
:placeholder="
9797
startRecorderTime
98-
? '说话中...'
98+
? `${$t('chat.inputPlaceholder.speaking')}...`
9999
: recorderLoading
100-
? '转文字中...'
101-
: '请输入问题,Ctrl+Enter 换行,Enter发送'
100+
? `${$t('chat.inputPlaceholder.recorderLoading')}...`
101+
: $t('chat.inputPlaceholder.default')
102102
"
103103
:autosize="{ minRows: 1, maxRows: isMobile ? 4 : 10 }"
104104
type="textarea"
@@ -119,12 +119,13 @@
119119
<el-tooltip effect="dark" placement="top" popper-class="upload-tooltip-width">
120120
<template #content>
121121
<div class="break-all pre-wrap">
122-
上传文件:最多{{
123-
props.applicationDetails.file_upload_setting.maxFiles
124-
}}个,每个文件限制
125-
{{ props.applicationDetails.file_upload_setting.fileLimit }}MB<br />文件类型:{{
126-
getAcceptList().replace(/\./g, '').replace(/,/g, '、').toUpperCase()
127-
}}
122+
{{ $t('chat.uploadFile.label') }}:{{
123+
$t('chat.uploadFile.most')
124+
}}{{ props.applicationDetails.file_upload_setting.maxFiles
125+
}}{{ $t('chat.uploadFile.limit') }}
126+
{{ props.applicationDetails.file_upload_setting.fileLimit }}MB<br />{{
127+
$t('chat.uploadFile.fileType')
128+
}}:{{ getAcceptList().replace(/\./g, '').replace(/,/g, '、').toUpperCase() }}
128129
</div>
129130
</template>
130131
<el-button text :disabled="checkMaxFilesLimit()" class="mt-4">
@@ -186,14 +187,11 @@ import bus from '@/bus'
186187
import 'recorder-core/src/engine/mp3'
187188
import 'recorder-core/src/engine/mp3-engine'
188189
import { MsgWarning } from '@/utils/message'
189-
import useStore from '@/stores'
190190
import { t } from '@/locales'
191191
const router = useRouter()
192192
const route = useRoute()
193-
const { application } = useStore()
194193
const {
195194
query: { mode, question },
196-
params: { accessToken }
197195
} = route as any
198196
const quickInputRef = ref()
199197
const props = withDefaults(
@@ -257,7 +255,7 @@ const getAcceptList = () => {
257255
}
258256
259257
if (accepts.length === 0) {
260-
return '.请在文件上传配置中选择文件类型'
258+
return `.${t('chat.uploadFile.tipMessage')}`
261259
}
262260
return accepts.map((ext: any) => '.' + ext).join(',')
263261
}
@@ -281,13 +279,13 @@ const uploadFile = async (file: any, fileList: any) => {
281279
uploadAudioList.value.length +
282280
uploadVideoList.value.length
283281
if (file_limit_once >= maxFiles) {
284-
MsgWarning('最多上传' + maxFiles + '个文件')
282+
MsgWarning(t('chat.uploadFile.limitMessage1') + maxFiles + t('chat.uploadFile.limitMessage2'))
285283
fileList.splice(0, fileList.length)
286284
return
287285
}
288286
if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) {
289287
// MB
290-
MsgWarning('单个文件大小不能超过' + fileLimit + 'MB')
288+
MsgWarning(t('chat.uploadFile.sizeLimit') + fileLimit + 'MB')
291289
fileList.splice(0, fileList.length)
292290
return
293291
}
@@ -356,7 +354,7 @@ const uploadFile = async (file: any, fileList: any) => {
356354
}
357355
})
358356
if (!inputValue.value && uploadImageList.value.length > 0) {
359-
inputValue.value = '请解析图片内容'
357+
inputValue.value = t('chat.uploadFile.imageMessage')
360358
}
361359
})
362360
}
@@ -397,14 +395,10 @@ const startRecording = async () => {
397395
(err: any) => {
398396
MsgAlert(
399397
t('common.tip'),
400-
`<p>该功能需要使用麦克风,浏览器禁止不安全页面录音,解决方案如下:<br/>
401-
1、可开启 https 解决;<br/>
402-
2、若无 https 配置则需要修改浏览器安全配置,Chrome 设置如下:<br/>
403-
(1) 地址栏输入chrome://flags/#unsafely-treat-insecure-origin-as-secure;<br/>
404-
(2) 将 http 站点配置在文本框中,例如: http://127.0.0.1:8080。</p>
398+
`${t('chat.tip.recorderTip')}
405399
<img src="${new URL(`@/assets/tipIMG.jpg`, import.meta.url).href}" style="width: 100%;" />`,
406400
{
407-
confirmButtonText: '我知道了',
401+
confirmButtonText: t('chat.tip.confirm'),
408402
dangerouslyUseHTMLString: true,
409403
customClass: 'record-tip-confirm'
410404
}
@@ -414,14 +408,10 @@ const startRecording = async () => {
414408
} catch (error) {
415409
MsgAlert(
416410
t('common.tip'),
417-
`<p>该功能需要使用麦克风,浏览器禁止不安全页面录音,解决方案如下:<br/>
418-
1、可开启 https 解决;<br/>
419-
2、若无 https 配置则需要修改浏览器安全配置,Chrome 设置如下:<br/>
420-
(1) 地址栏输入chrome://flags/#unsafely-treat-insecure-origin-as-secure;<br/>
421-
(2) 将 http 站点配置在文本框中,例如: http://127.0.0.1:8080。</p>
411+
`${t('chat.tip.recorderTip')}
422412
<img src="${new URL(`@/assets/tipIMG.jpg`, import.meta.url).href}" style="width: 100%;" />`,
423413
{
424-
confirmButtonText: '我知道了',
414+
confirmButtonText: t('chat.tip.confirm'),
425415
dangerouslyUseHTMLString: true,
426416
customClass: 'record-tip-confirm'
427417
}
@@ -445,7 +435,7 @@ const stopRecording = () => {
445435
uploadRecording(blob) // 上传录音文件
446436
},
447437
(err: any) => {
448-
console.error('录音失败:', err)
438+
console.error(`${t('chat.tip.recorderError')}:`, err)
449439
}
450440
)
451441
}
@@ -472,7 +462,7 @@ const uploadRecording = async (audioBlob: Blob) => {
472462
})
473463
} catch (error) {
474464
recorderLoading.value = false
475-
console.error('上传失败:', error)
465+
console.error(`${t('chat.uploadFile.errorMessage')}:`, error)
476466
}
477467
}
478468
const handleTimeChange = () => {

ui/src/components/ai-chat/component/control/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const menus = ref([
5656
}
5757
},
5858
{
59-
label: '引用',
59+
label: t('chat.quote'),
6060
icon: 'app-quote',
6161
click: () => {
6262
bus.emit('chat-input', getSelection())

ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77
<div>
88
<!-- 语音播放 -->
99
<span v-if="tts">
10-
<el-tooltip effect="dark" content="点击播放" placement="top" v-if="!audioPlayerStatus">
10+
<el-tooltip effect="dark" :content="$t('chat.operation.play')" placement="top" v-if="!audioPlayerStatus">
1111
<el-button text :disabled="!data?.write_ed" @click="playAnswerText(data?.answer_text)">
1212
<AppIcon iconName="app-video-play"></AppIcon>
1313
</el-button>
1414
</el-tooltip>
15-
<el-tooltip v-else effect="dark" content="停止" placement="top">
15+
<el-tooltip v-else effect="dark" :content="$t('chat.operation.pause')" placement="top">
1616
<el-button type="primary" text :disabled="!data?.write_ed" @click="pausePlayAnswerText()">
1717
<AppIcon iconName="app-video-pause"></AppIcon>
1818
</el-button>
1919
</el-tooltip>
2020
<el-divider direction="vertical" />
2121
</span>
2222
<span v-if="type == 'ai-chat' || type == 'log'">
23-
<el-tooltip effect="dark" content="换个答案" placement="top">
23+
<el-tooltip effect="dark" :content="$t('chat.operation.regeneration')" placement="top">
2424
<el-button :disabled="chat_loading" text @click="regeneration">
2525
<el-icon><RefreshRight /></el-icon>
2626
</el-button>
2727
</el-tooltip>
2828
<el-divider direction="vertical" />
29-
<el-tooltip effect="dark" content="复制" placement="top">
29+
<el-tooltip effect="dark" :content="$t('common.copy')" placement="top">
3030
<el-button text @click="copyClick(data?.answer_text)">
3131
<AppIcon iconName="app-copy"></AppIcon>
3232
</el-button>
3333
</el-tooltip>
3434
<el-divider direction="vertical" />
3535
<el-tooltip
3636
effect="dark"
37-
content="赞同"
37+
:content="$t('chat.operation.like')"
3838
placement="top"
3939
v-if="buttonData?.vote_status === '-1'"
4040
>
@@ -44,7 +44,7 @@
4444
</el-tooltip>
4545
<el-tooltip
4646
effect="dark"
47-
content="取消赞同"
47+
:content="$t('chat.operation.cancelLike')"
4848
placement="top"
4949
v-if="buttonData?.vote_status === '0'"
5050
>
@@ -55,7 +55,7 @@
5555
<el-divider direction="vertical" v-if="buttonData?.vote_status === '-1'" />
5656
<el-tooltip
5757
effect="dark"
58-
content="反对"
58+
:content="$t('chat.operation.oppose')"
5959
placement="top"
6060
v-if="buttonData?.vote_status === '-1'"
6161
>
@@ -65,7 +65,7 @@
6565
</el-tooltip>
6666
<el-tooltip
6767
effect="dark"
68-
content="取消反对"
68+
:content="$t('chat.operation.cancelOppose')"
6969
placement="top"
7070
v-if="buttonData?.vote_status === '1'"
7171
>
@@ -85,7 +85,7 @@ import { copyClick } from '@/utils/clipboard'
8585
import applicationApi from '@/api/application'
8686
import { datetimeFormat } from '@/utils/time'
8787
import { MsgError } from '@/utils/message'
88-
88+
import { t } from '@/locales'
8989
const route = useRoute()
9090
const {
9191
params: { id }
@@ -164,7 +164,7 @@ function removeFormRander(text: string) {
164164
165165
const playAnswerText = (text: string) => {
166166
if (!text) {
167-
text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。'
167+
text = t('chat.tip.answerMessage')
168168
}
169169
// 移除表单渲染器
170170
text = removeFormRander(text)

ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
<div>
99
<!-- 语音播放 -->
1010
<span v-if="tts">
11-
<el-tooltip effect="dark" content="点击播放" placement="top" v-if="!audioPlayerStatus">
11+
<el-tooltip effect="dark" :content="$t('chat.operation.play')" placement="top" v-if="!audioPlayerStatus">
1212
<el-button text @click="playAnswerText(data?.answer_text)">
1313
<AppIcon iconName="app-video-play"></AppIcon>
1414
</el-button>
1515
</el-tooltip>
16-
<el-tooltip v-else effect="dark" content="停止" placement="top">
16+
<el-tooltip v-else effect="dark" :content="$t('chat.operation.pause')" placement="top">
1717
<el-button type="primary" text @click="pausePlayAnswerText()">
1818
<AppIcon iconName="app-video-pause"></AppIcon>
1919
</el-button>
2020
</el-tooltip>
2121
<el-divider direction="vertical" />
2222
</span>
23-
<el-tooltip effect="dark" content="复制" placement="top">
23+
<el-tooltip effect="dark" :content="$t('common.copy')" placement="top">
2424
<el-button text @click="copyClick(data?.answer_text)">
2525
<AppIcon iconName="app-copy"></AppIcon>
2626
</el-button>
@@ -29,15 +29,15 @@
2929
<el-tooltip
3030
v-if="buttonData.improve_paragraph_id_list.length === 0"
3131
effect="dark"
32-
content="修改内容"
32+
:content="$t('views.log.editContent')"
3333
placement="top"
3434
>
3535
<el-button text @click="editContent(data)">
3636
<el-icon><EditPen /></el-icon>
3737
</el-button>
3838
</el-tooltip>
3939

40-
<el-tooltip v-else effect="dark" content="修改标注" placement="top">
40+
<el-tooltip v-else effect="dark" :content="$t('views.log.editMark')" placement="top">
4141
<el-button text @click="editMark(data)">
4242
<AppIcon iconName="app-document-active" class="primary"></AppIcon>
4343
</el-button>
@@ -67,7 +67,7 @@ import { datetimeFormat } from '@/utils/time'
6767
import applicationApi from '@/api/application'
6868
import { useRoute } from 'vue-router'
6969
import { MsgError } from '@/utils/message'
70-
70+
import { t } from '@/locales'
7171
const route = useRoute()
7272
const {
7373
params: { id }
@@ -143,7 +143,7 @@ function removeFormRander(text: string) {
143143
144144
const playAnswerText = (text: string) => {
145145
if (!text) {
146-
text = '抱歉,没有查找到相关内容,请重新描述您的问题或提供更多信息。'
146+
text = t('chat.tip.answerMessage')
147147
}
148148
// 移除表单渲染器
149149
text = removeFormRander(text)

ui/src/components/ai-chat/component/operation-button/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
v-if="chatRecord.is_stop && !chatRecord.write_ed"
1818
@click="startChat(chatRecord)"
1919
link
20-
>继续
20+
>{{ $t('chat.operation.continue') }}
2121
</el-button>
2222
<el-button
2323
type="primary"
2424
v-else-if="!chatRecord.write_ed"
2525
@click="stopChat(chatRecord)"
2626
link
27-
>停止回答
27+
>{{ $t('chat.operation.stopChat') }}
2828
</el-button>
2929
</div>
3030
</div>

0 commit comments

Comments
 (0)