🐞 fix: 进一步的检查与校准

This commit is contained in:
IGCrystal
2025-06-17 12:22:00 +08:00
parent 7e4c89b0cb
commit 38eae1d1ee
16 changed files with 75 additions and 48 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ const customizer = useCustomizerStore();
<div
style="height: 100%; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
<div id="container">
<ChatPage chatbox-mode="true"></ChatPage>
<ChatPage :chatbox-mode="true"></ChatPage>
</div>
</div>
</v-app>
+16 -6
View File
@@ -124,6 +124,12 @@
class="fullscreen-icon">mdi-fullscreen</v-icon>
</template>
</v-tooltip>
<!-- 语言切换按钮 -->
<v-tooltip :text="t('core.common.language')" v-if="chatboxMode">
<template v-slot:activator="{ props }">
<LanguageSwitcher variant="chatbox" />
</template>
</v-tooltip>
<!-- 主题切换按钮 -->
<v-tooltip :text="isDark ? tm('modes.lightMode') : tm('modes.darkMode')" v-if="chatboxMode">
<template v-slot:activator="{ props }">
@@ -286,6 +292,7 @@ import axios from 'axios';
import { marked } from 'marked';
import { useCustomizerStore } from '@/stores/customizer';
import { useI18n, useModuleI18n } from '@/i18n/composables';
import LanguageSwitcher from '@/components/shared/LanguageSwitcher.vue';
marked.setOptions({
breaks: true
@@ -294,6 +301,7 @@ marked.setOptions({
export default {
name: 'ChatPage',
components: {
LanguageSwitcher
},
props: {
chatboxMode: {
@@ -410,7 +418,7 @@ export default {
mounted() {
// Theme is now handled globally by the customizer store.
// 设置输入框标签
this.inputFieldLabel = this.tm('title');
this.inputFieldLabel = this.tm('input.chatPrompt');
this.startListeningEvent();
this.checkStatus();
this.getConversations();
@@ -637,7 +645,7 @@ export default {
type: 'bot',
message: `<audio controls class="audio-player">
<source src="${audioUrl}" type="audio/wav">
您的浏览器不支持音频播放。
${this.t('messages.errors.browser.audioNotSupported')}
</audio>`
}
this.messages.push(bot_resp);
@@ -690,12 +698,12 @@ export default {
};
this.mediaRecorder.start();
this.isRecording = true;
this.inputFieldLabel = this.tm('features.chat.input.recordingPrompt');
this.inputFieldLabel = this.tm('input.recordingPrompt');
},
async stopRecording() {
this.isRecording = false;
this.inputFieldLabel = this.tm('features.chat.input.chatPrompt');
this.inputFieldLabel = this.tm('input.chatPrompt');
this.mediaRecorder.stop();
this.mediaRecorder.onstop = async () => {
const audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' });
@@ -805,7 +813,7 @@ export default {
const audioUrl = await this.getMediaFile(audio);
message[i].message = `<audio controls class="audio-player">
<source src="${audioUrl}" type="audio/wav">
您的浏览器不支持音频播放。
${this.t('messages.errors.browser.audioNotSupported')}
</audio>`
}
if (message[i].image_url && message[i].image_url.length > 0) {
@@ -861,7 +869,9 @@ export default {
second: '2-digit',
hour12: false
};
return date.toLocaleString('zh-CN', options).replace(/\//g, '-').replace(/, /g, ' ');
// 使用当前语言环境的locale
const locale = this.t('core.common.locale') || 'zh-CN';
return date.toLocaleString(locale, options).replace(/\//g, '-').replace(/, /g, ' ');
},
deleteConversation(cid) {
+5 -5
View File
@@ -157,11 +157,11 @@ export default {
// 安全访问翻译的计算属性
messages() {
return {
loadError: this.tm('features.config.messages.loadError'),
saveSuccess: this.tm('features.config.messages.saveSuccess'),
saveError: this.tm('features.config.messages.saveError'),
configApplied: this.tm('features.config.messages.configApplied'),
configApplyError: this.tm('features.config.messages.configApplyError')
loadError: this.tm('messages.loadError'),
saveSuccess: this.tm('messages.saveSuccess'),
saveError: this.tm('messages.saveError'),
configApplied: this.tm('messages.configApplied'),
configApplyError: this.tm('messages.configApplyError')
};
}
},
+4 -4
View File
@@ -179,7 +179,7 @@ const checkUpdate = () => {
if (matchedPlugin) {
extension.online_version = matchedPlugin.version;
extension.has_update = extension.version !== matchedPlugin.version &&
matchedPlugin.version !== tm('features.extension.status.unknown');
matchedPlugin.version !== tm('status.unknown');
} else {
extension.has_update = false;
}
@@ -204,7 +204,7 @@ const uninstallExtension = async (extension_name) => {
};
const updateExtension = async (extension_name) => {
loadingDialog.title = tm('features.extension.status.loading');
loadingDialog.title = tm('status.loading');
loadingDialog.show = true;
try {
const res = await axios.post('/api/plugin/update', {
@@ -465,7 +465,7 @@ const newExtension = async () => {
return;
}
loading_.value = true;
loadingDialog.title = tm('features.extension.status.loading');
loadingDialog.title = tm('status.loading');
loadingDialog.show = true;
if (upload_file.value !== null) {
toast(tm('messages.installing'), "primary");
@@ -542,7 +542,7 @@ onMounted(async () => {
checkAlreadyInstalled();
checkUpdate();
} catch (err) {
console.error(tm('messages.getMarketDataFailed'), err);
toast(tm('messages.getMarketDataFailed') + " " + err, "error");
}
});
+6 -6
View File
@@ -177,11 +177,11 @@ export default {
// 安全访问翻译的计算属性
messages() {
return {
updateSuccess: this.tm('features.platform.messages.updateSuccess'),
addSuccess: this.tm('features.platform.messages.addSuccess'),
deleteSuccess: this.tm('features.platform.messages.deleteSuccess'),
statusUpdateSuccess: this.tm('features.platform.messages.statusUpdateSuccess'),
deleteConfirm: this.tm('features.platform.messages.deleteConfirm')
updateSuccess: this.tm('messages.updateSuccess'),
addSuccess: this.tm('messages.addSuccess'),
deleteSuccess: this.tm('messages.deleteSuccess'),
statusUpdateSuccess: this.tm('messages.statusUpdateSuccess'),
deleteConfirm: this.tm('messages.deleteConfirm')
};
}
},
@@ -277,7 +277,7 @@ export default {
},
deletePlatform(platform) {
if (confirm(`${this.messages.deleteConfirm} ${platform.id}?`)) {
if (confirm(`${this.messages.deleteConfirm} ${platform.id}?`)) {
axios.post('/api/config/platform/delete', { id: platform.id }).then((res) => {
this.getConfig();
this.$refs.wfr.check();
@@ -366,7 +366,7 @@ export default {
this.searchResults = Object.keys(data).map(doc_id => {
return {
doc_id: doc_id,
text: data[doc_id].text || '无文本内容',
text: data[doc_id].text || this.tm('search.noTextContent'),
score: data[doc_id].score || 0
};
});
@@ -596,7 +596,7 @@ export default {
// 格式化时间戳的辅助方法
formatTime(timestamp) {
if (!timestamp) return '未知';
if (!timestamp) return this.tm('factDialog.unknown');
try {
return new Date(timestamp).toLocaleString();
} catch (e) {
@@ -709,7 +709,7 @@ export default {
this.selectedEdgeFactId = factId;
this.getFactDetails(factId);
} else {
this.$toast.info('该关系没有关联的记忆数据');
this.$toast.info(this.tm('messages.relationNoMemoryData'));
}
});