feat: add usage statistics page, CLI improvements, and UI enhancements
- Add Usage Stats page with token breakdown, model distribution, and 30-day trend - Pass through cache/cost token fields in BFF (cache_read/write_tokens, reasoning_tokens, actual_cost_usd) - Add CLI commands: -v/--version, -h/--help, update/upgrade with auto-restart - Auto-open browser on startup, auto-kill port conflicts (cross-platform) - Validate all api_server config fields on startup (enabled, host, port, key, cors_origins) - Add streaming thinking video animation with tool calls panel - Add context token usage display (used / total) in chat header - Sidebar: white logo area with shadow, dance video beside logo (canvas seamless loop) - Fix sidebar nav scroll (app-main overflow-y: auto) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+15
-7
@@ -84,7 +84,7 @@ async function ensureApiServerConfig() {
|
||||
const yaml = (await import('js-yaml')).default
|
||||
const configPath = resolve(homedir(), '.hermes/config.yaml')
|
||||
|
||||
const apiServerConfig = {
|
||||
const apiServerDefaults: Record<string, any> = {
|
||||
enabled: true,
|
||||
host: '127.0.0.1',
|
||||
port: 8642,
|
||||
@@ -101,8 +101,20 @@ async function ensureApiServerConfig() {
|
||||
const content = readFileSync(configPath, 'utf-8')
|
||||
const config = yaml.load(content) as any || {}
|
||||
|
||||
// Check if api_server is already correct
|
||||
if (config.platforms?.api_server?.enabled === true) {
|
||||
if (!config.platforms) config.platforms = {}
|
||||
if (!config.platforms.api_server) config.platforms.api_server = {}
|
||||
|
||||
const api = config.platforms.api_server
|
||||
let needsUpdate = false
|
||||
|
||||
for (const [key, value] of Object.entries(apiServerDefaults)) {
|
||||
if (api[key] === undefined || api[key] === null) {
|
||||
api[key] = value
|
||||
needsUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!needsUpdate) {
|
||||
console.log(' ✓ api_server config is correct')
|
||||
return
|
||||
}
|
||||
@@ -110,10 +122,6 @@ async function ensureApiServerConfig() {
|
||||
// Backup before modifying
|
||||
copyFileSync(configPath, configPath + '.bak')
|
||||
|
||||
// Ensure platforms.api_server with correct values
|
||||
if (!config.platforms) config.platforms = {}
|
||||
config.platforms.api_server = apiServerConfig
|
||||
|
||||
const updated = yaml.dump(config, { lineWidth: -1, noRefs: true, quotingType: '"' })
|
||||
writeFileSync(configPath, updated, 'utf-8')
|
||||
console.log(' ✓ api_server config ensured (backup saved to config.yaml.bak)')
|
||||
|
||||
Reference in New Issue
Block a user