Skip to content

Commit

Permalink
Update Translation Assistant
Browse files Browse the repository at this point in the history
-
  • Loading branch information
yangjiakai committed Jul 5, 2023
1 parent 3cbf18f commit ca1ac7b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/components/ai/ChatAssistant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
<script setup lang="ts">
import { useDisplay } from "vuetify";
import { useSnackbarStore } from "@/stores/snackbarStore";
import AnimationChat from "@/components/animations/AnimationChat1.vue";
import AnimationAi from "@/components/animations/AnimationBot1.vue";
import { read, countAndCompleteCodeBlocks } from "@/utils/aiUtils";
import { scrollToBottom } from "@/utils/common";
import MdEditor from "md-editor-v3";
import { useChatGPTStore } from "@/stores/chatGPTStore";
import "md-editor-v3/lib/style.css";
import ApiKeyDialog from "@/components/ApiKeyDialog.vue";

const snackbarStore = useSnackbarStore();
const chatGPTStore = useChatGPTStore();
Expand Down
27 changes: 24 additions & 3 deletions src/components/ai/TranslationAssistant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useDisplay } from "vuetify";
import { read } from "@/utils/aiUtils";
import { useSnackbarStore } from "@/stores/snackbarStore";
import { useSpeechStore } from "@/stores/speechStore";
import { Icon } from "@iconify/vue";
const speechStore = useSpeechStore();
const snackbarStore = useSnackbarStore();
const chatGPTStore = useChatGPTStore();
Expand Down Expand Up @@ -285,28 +286,43 @@ const readText = () => {
<div class="pa-2">
<v-textarea
v-model="baseContent"
placeholder="Enter the text to be translated"
hide-details
variant="solo"
class="elevation-1"
color="white"
clearable
@focus="isBaseContentEmpty = false"
:placeholder="
$t(
'toolbox.translationAssistant.sourceLanguagePlaceholder'
)
"
></v-textarea>
</div>
<v-card-actions class="bg-grey-lighten-4 text-primary">
<v-tooltip
v-if="!isRecording"
location="bottom"
:text="$t('toolbox.translationAssistant.speech')"
>
<template #activator="{ props }">
<v-btn @click="record" v-bind="props" icon>
<v-icon v-if="isRecording">mdi-microphone</v-icon>
<v-icon v-else>mdi-microphone-outline</v-icon>
</v-btn>
</template>
</v-tooltip>
<v-tooltip
location="bottom"
:text="$t('toolbox.translationAssistant.stopSpeech')"
v-else
>
<template #activator="{ props }">
<v-btn @click="record" v-bind="props" icon>
<Icon icon="svg-spinners:bars-scale-fade" />
</v-btn>
</template>
</v-tooltip>
<!-- <v-tooltip
location="bottom"
:text="$t('toolbox.translationAssistant.read')"
>
Expand All @@ -315,7 +331,7 @@ const readText = () => {
><v-icon>mdi-volume-high</v-icon>
</v-btn>
</template>
</v-tooltip>
</v-tooltip> -->
<v-spacer></v-spacer>
<CopyBtn :text="baseContent" />
</v-card-actions>
Expand All @@ -332,6 +348,11 @@ const readText = () => {
class="elevation-1"
color="primary"
clearable
:placeholder="
$t(
'toolbox.translationAssistant.targetLanguagePlaceholder'
)
"
></v-textarea>
</div>
<v-card-actions
Expand Down
5 changes: 4 additions & 1 deletion src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ export default {
title: "Translation Assistant",
targetLanguage: "Target Language",
translate: "Translate",
speech: "Speech",
speech: "Click to start recording.",
stopSpeech: "Click again to end recording.",
read: "Read",
sourceLanguagePlaceholder: "Select the target translation language",
targetLanguagePlaceholder: "You can paste the text directly for reading",
},
codeAssistant: {
title: "Code Assistant",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ export default {
title: "翻訳アシスタント",
targetLanguage: "翻訳先の言語",
translate: "翻訳",
speech: "音声",
speech: "タップして録音を開始",
stopSpeech: "もう一度タップして録音を終了",
read: "読む",
sourceLanguagePlaceholder: "ターゲット翻訳言語を選択してください",
targetLanguagePlaceholder: "テキストを直接貼り付けて朗読できる",
},
codeAssistant: {
title: "コードアシスタント",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/zhHans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ export default {
title: "翻译助手",
targetLanguage: "目标语言",
translate: "翻译",
speech: "语音",
speech: "点击开始录音",
stopSpeech: "再次点击结束录音",
read: "朗读",
sourceLanguagePlaceholder: "请选择目标翻译语言",
targetLanguagePlaceholder: "可以直接粘贴文本进行阅读",
},
codeAssistant: {
title: "代码助手",
Expand Down

0 comments on commit ca1ac7b

Please sign in to comment.