Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit 540d9da

Browse files
committed
feat: language use radio selection
1 parent bb7adcf commit 540d9da

File tree

5 files changed

+40
-19
lines changed

5 files changed

+40
-19
lines changed

src/components/Session/components/SessionAvatar.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ const calcToken = (data: SessionData) => {
8686
/>
8787
</a-tooltip>
8888

89-
<span class="text-gray text-xs" v-if="isTokenUsage">
89+
<span
90+
class="text-gray w-13! whitespace-nowrap text-center text-xs"
91+
v-if="isTokenUsage"
92+
>
9093
{{ calcToken(data) }}
9194
</span>
9295

src/components/Session/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ watch([currentSession, sessionDataList], () => {
7979
{{ getLocalTime(item.time!) }}
8080
</span>
8181

82-
<div class="blink-block" v-if="!item.message.content" />
82+
<div
83+
class="blink-block"
84+
:class="[showTime ? 'p0' : 'py-4']"
85+
v-if="!item.message.content"
86+
/>
8387

8488
<SessionContent :data="item" v-else />
8589
</div>

src/components/Settings/components/General.vue

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
const settingsStore = useSettingsStore()
33
const { toggleTheme, setLanguage } = settingsStore
4-
const { themeMode, autoStart, isRememberPosition, proxy, showTime } =
4+
const { themeMode, autoStart, isRememberPosition, proxy, currentLang } =
55
storeToRefs(settingsStore)
66
77
const relaunch = () => {
@@ -11,11 +11,21 @@ const relaunch = () => {
1111

1212
<template>
1313
<ul class="general flex flex-col gap-4">
14-
<button @click="setLanguage('zh')">zh</button>
15-
<button @click="setLanguage('en')">en</button>
1614
<li>
17-
<i>唤醒窗口:</i>
18-
<ShortcutKey />
15+
<i>语言:</i>
16+
<a-radio-group
17+
v-model="currentLang"
18+
type="button"
19+
size="large"
20+
@change="(value: any) => setLanguage(value)"
21+
>
22+
<a-radio value="zh">
23+
<icon-chinese-fill />
24+
</a-radio>
25+
<a-radio value="en">
26+
<icon-english-fill />
27+
</a-radio>
28+
</a-radio-group>
1929
</li>
2030

2131
<li>
@@ -38,6 +48,11 @@ const relaunch = () => {
3848
</a-radio-group>
3949
</li>
4050

51+
<li>
52+
<i>唤醒窗口:</i>
53+
<ShortcutKey />
54+
</li>
55+
4156
<li>
4257
<i>开机自启动:</i>
4358
<a-switch v-model="autoStart" type="round" size="medium" />
@@ -48,11 +63,6 @@ const relaunch = () => {
4863
<a-switch v-model="isRememberPosition" type="round" />
4964
</li>
5065

51-
<li>
52-
<i>显示对话时间:</i>
53-
<a-switch v-model="showTime" type="round" />
54-
</li>
55-
5666
<li>
5767
<i>开启代理:</i>
5868
<a-switch v-model="proxy.bypass" type="round"></a-switch>

src/components/Settings/components/Modal.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
2-
const { apiKey, isMemory, modalParams, isTokenUsage, tokenUnit } = storeToRefs(
3-
useSettingsStore()
4-
)
2+
const { apiKey, isMemory, modalParams, isTokenUsage, tokenUnit, showTime } =
3+
storeToRefs(useSettingsStore())
54
65
const totalCredit = ref(0)
76
const usedCredit = ref(0)
@@ -35,6 +34,11 @@ watch(
3534
<a-input-password v-model="apiKey" placeholder="OpenAI API KEY" />
3635
</li>
3736

37+
<li>
38+
<i>显示对话时间:</i>
39+
<a-switch v-model="showTime" type="round" />
40+
</li>
41+
3842
<li>
3943
<i>记忆模式:</i>
4044
<a-switch v-model="isMemory" type="round" />

src/stores/settings.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export const useSettingsStore = defineStore(
5252
// 显示对话时间
5353
const showTime = ref(false)
5454

55+
// 当前显示语言
56+
const currentLang = ref<string | undefined>()
57+
const { locale } = useI18n({ useScope: 'global' })
58+
5559
// 绑定快捷键
5660
const registerKey = async () => {
5761
await unregisterAll()
@@ -80,10 +84,6 @@ export const useSettingsStore = defineStore(
8084
document.body.setAttribute('arco-theme', theme)
8185
}
8286

83-
// 当前显示语言
84-
const currentLang = ref<string | undefined>()
85-
const { locale } = useI18n({ useScope: 'global' })
86-
8787
// 语言切换
8888
const setLanguage = async (lang?: Locales) => {
8989
const systemLang = ((await invoke('get_user_language')) as string).split(

0 commit comments

Comments
 (0)