feat: enhance storage engine configuration and UI updates
- Updated `.air.toml` to include additional CGO flags for improved build settings. - Expanded `StorageEngineConfig` interface to support "tos" (火山引擎 TOS) as a new storage provider. - Modified related components and views to accommodate the new storage engine, including updates to `ListSpaceSidebar`, `AgentList`, `KnowledgeBaseList`, and `OrganizationList`. - Improved UI elements for batch management in the menu and sidebar components. - Added internationalization support for new memory features and storage engine descriptions across multiple languages. This update enhances the flexibility of storage options and improves user experience with better UI interactions.
This commit is contained in:
@@ -34,9 +34,25 @@
|
||||
<p class="desc">{{ $t('settings.enableMemoryDesc') }}</p>
|
||||
</div>
|
||||
<div class="setting-control">
|
||||
<t-switch v-model="isMemoryEnabled" @change="handleMemoryChange" />
|
||||
<t-switch
|
||||
v-model="isMemoryEnabled"
|
||||
:disabled="!isNeo4jAvailable"
|
||||
@change="handleMemoryChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<t-alert
|
||||
v-if="!isNeo4jAvailable"
|
||||
theme="warning"
|
||||
style="margin-top: -8px; margin-bottom: 16px;"
|
||||
>
|
||||
<template #message>
|
||||
<div>{{ $t('settings.memoryRequiresNeo4j') }}</div>
|
||||
<t-link theme="primary" href="https://github.com/Tencent/WeKnora/blob/main/docs/KnowledgeGraph.md" target="_blank">
|
||||
{{ $t('settings.memoryHowToEnable') }}
|
||||
</t-link>
|
||||
</template>
|
||||
</t-alert>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -46,6 +62,7 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import { MessagePlugin } from 'tdesign-vue-next'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { getSystemInfo } from '@/api/system'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const settingsStore = useSettingsStore()
|
||||
@@ -54,6 +71,13 @@ const settingsStore = useSettingsStore()
|
||||
const localLanguage = ref('zh-CN')
|
||||
const localTheme = ref('light')
|
||||
|
||||
// 系统信息
|
||||
const systemInfo = ref<any>(null)
|
||||
|
||||
const isNeo4jAvailable = computed(() => {
|
||||
return systemInfo.value?.graph_database_engine && systemInfo.value.graph_database_engine !== '未启用'
|
||||
})
|
||||
|
||||
// 记忆功能状态
|
||||
const isMemoryEnabled = computed({
|
||||
get: () => settingsStore.isMemoryEnabled,
|
||||
@@ -61,7 +85,7 @@ const isMemoryEnabled = computed({
|
||||
})
|
||||
|
||||
// 初始化加载
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
// 从 localStorage 加载语言设置
|
||||
const savedLocale = localStorage.getItem('locale')
|
||||
if (savedLocale) {
|
||||
@@ -70,6 +94,17 @@ onMounted(() => {
|
||||
} else {
|
||||
localLanguage.value = locale.value
|
||||
}
|
||||
|
||||
// 加载系统信息以检查 Neo4j 可用性
|
||||
try {
|
||||
const response = await getSystemInfo()
|
||||
systemInfo.value = response.data
|
||||
if (!isNeo4jAvailable.value && settingsStore.isMemoryEnabled) {
|
||||
settingsStore.toggleMemory(false)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load system info:', error)
|
||||
}
|
||||
})
|
||||
|
||||
// 处理语言变化
|
||||
@@ -81,6 +116,11 @@ const handleLanguageChange = () => {
|
||||
|
||||
// 处理记忆功能变化
|
||||
const handleMemoryChange = (val: boolean) => {
|
||||
if (val && !isNeo4jAvailable.value) {
|
||||
MessagePlugin.warning(t('settings.memoryRequiresNeo4j'))
|
||||
settingsStore.toggleMemory(false)
|
||||
return
|
||||
}
|
||||
settingsStore.toggleMemory(val)
|
||||
MessagePlugin.success(t('common.success'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user