refactor: restructure project for multi-agent extensibility
- Migrate source to packages/client and packages/server directories - Namespace all Hermes-specific code under hermes/ subdirectories (api/hermes/, components/hermes/, views/hermes/, stores/hermes/) - Add hermes.* route names and /hermes/* path prefixes - Upgrade @koa/router to v15, adapt path-to-regexp v8 syntax - Fix proxy path rewriting: /api/hermes/v1/* → /v1/*, /api/hermes/* → /api/* - Fix frontend API paths to match backend /api/hermes/* routes - Fix WebSocket terminal path to /api/hermes/terminal - Add proxyMiddleware for reliable unmatched route proxying - Add profiles route module and hermes-cli profile commands - Update CLAUDE.md development guide with new architecture - Add Chinese README (README_zh.md) - Add Web Terminal feature to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import * as configApi from '@/api/hermes/config'
|
||||
import type { DisplayConfig, AgentConfig, MemoryConfig, SessionResetConfig, PrivacyConfig } from '@/api/hermes/config'
|
||||
|
||||
export const useSettingsStore = defineStore('settings', () => {
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
|
||||
const display = ref<DisplayConfig>({})
|
||||
const agent = ref<AgentConfig>({})
|
||||
const memory = ref<MemoryConfig>({})
|
||||
const sessionReset = ref<SessionResetConfig>({})
|
||||
const privacy = ref<PrivacyConfig>({})
|
||||
const telegram = ref<Record<string, any>>({})
|
||||
const discord = ref<Record<string, any>>({})
|
||||
const slack = ref<Record<string, any>>({})
|
||||
const whatsapp = ref<Record<string, any>>({})
|
||||
const matrix = ref<Record<string, any>>({})
|
||||
const wecom = ref<Record<string, any>>({})
|
||||
const feishu = ref<Record<string, any>>({})
|
||||
const dingtalk = ref<Record<string, any>>({})
|
||||
const weixin = ref<Record<string, any>>({})
|
||||
const platforms = ref<Record<string, any>>({})
|
||||
|
||||
async function fetchSettings() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await configApi.fetchConfig()
|
||||
display.value = data.display || {}
|
||||
agent.value = data.agent || {}
|
||||
memory.value = data.memory || {}
|
||||
sessionReset.value = data.session_reset || {}
|
||||
privacy.value = data.privacy || {}
|
||||
telegram.value = data.telegram || {}
|
||||
discord.value = data.discord || {}
|
||||
slack.value = data.slack || {}
|
||||
whatsapp.value = data.whatsapp || {}
|
||||
matrix.value = data.matrix || {}
|
||||
wecom.value = data.wecom || {}
|
||||
feishu.value = data.feishu || {}
|
||||
dingtalk.value = data.dingtalk || {}
|
||||
weixin.value = data.weixin || {}
|
||||
platforms.value = data.platforms || {}
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch settings:', err)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSection(section: string, values: Record<string, any>) {
|
||||
saving.value = true
|
||||
try {
|
||||
await configApi.updateConfigSection(section, values)
|
||||
switch (section) {
|
||||
case 'display': display.value = { ...display.value, ...values }; break
|
||||
case 'agent': agent.value = { ...agent.value, ...values }; break
|
||||
case 'memory': memory.value = { ...memory.value, ...values }; break
|
||||
case 'session_reset': sessionReset.value = { ...sessionReset.value, ...values }; break
|
||||
case 'privacy': privacy.value = { ...privacy.value, ...values }; break
|
||||
case 'telegram': telegram.value = { ...telegram.value, ...values }; break
|
||||
case 'discord': discord.value = { ...discord.value, ...values }; break
|
||||
case 'slack': slack.value = { ...slack.value, ...values }; break
|
||||
case 'whatsapp': whatsapp.value = { ...whatsapp.value, ...values }; break
|
||||
case 'matrix': matrix.value = { ...matrix.value, ...values }; break
|
||||
case 'wechat': case 'wecom': wecom.value = { ...wecom.value, ...values }; break
|
||||
case 'feishu': feishu.value = { ...feishu.value, ...values }; break
|
||||
case 'dingtalk': dingtalk.value = { ...dingtalk.value, ...values }; break
|
||||
case 'weixin': weixin.value = { ...weixin.value, ...values }; break
|
||||
case 'platforms': {
|
||||
// Deep-merge each platform's credentials
|
||||
for (const [key, val] of Object.entries(values)) {
|
||||
platforms.value = {
|
||||
...platforms.value,
|
||||
[key]: { ...(platforms.value[key] || {}), ...(val as Record<string, any>) },
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
loading, saving,
|
||||
display, agent, memory, sessionReset, privacy,
|
||||
telegram, discord, slack, whatsapp, matrix, wecom, feishu, dingtalk, weixin, platforms,
|
||||
fetchSettings, saveSection,
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user