refactor(frontend): streamline knowledge base and agent handling with chat resources store

- Updated components to utilize the new `useChatResourcesStore` for managing knowledge bases and agents, improving data fetching and caching mechanisms.
- Refactored `AgentSelector`, `IMChannelPanel`, `Input-field`, and `menu` components to replace direct API calls with store methods, enhancing maintainability and performance.
- Adjusted knowledge base loading logic to ensure consistency across components and reduce redundant API requests.
- Improved session state handling in `settings` store to prevent overwriting user selections during state restoration.
This commit is contained in:
wizardchen
2026-06-08 20:55:54 +08:00
committed by lyingbug
parent dc8d4f686a
commit 815c72c964
22 changed files with 994 additions and 501 deletions
@@ -300,7 +300,7 @@ import { ref, watch, onMounted, computed } from 'vue'
import { MessagePlugin } from 'tdesign-vue-next'
import { useI18n } from 'vue-i18n'
import { extractTextRelations, fabriText, fabriTag, type Node, type Relation } from '@/api/initialization'
import { getSystemInfo } from '@/api/system'
import { useEditorResourcesStore } from '@/stores/editorResources'
import { useAuthStore } from '@/stores/auth'
const { t } = useI18n()
@@ -544,11 +544,13 @@ const clearExtractExample = () => {
MessagePlugin.success(t('graphSettings.exampleCleared'))
}
const editorResources = useEditorResourcesStore()
// 加载系统信息
const loadSystemInfo = async () => {
const loadSystemInfo = async (force = false) => {
try {
const response = await getSystemInfo()
systemInfo.value = response.data
await editorResources.ensureSystemInfo(force)
systemInfo.value = editorResources.systemInfo
} catch (error: any) {
console.error('Failed to load system info:', error)
}