Initial commit: Hermes Chat v2
Svelte 5 + shadcn-svelte + Tailwind CSS v4 chat interface for Hermes Agent with Monaco editor, file drag/drop, artifacts, image preview, and real session management. - SSE streaming via hermes CLI proxy - File upload + drag/drop with image preview - Code artifacts with Monaco editor - Markdown + highlight.js syntax highlighting - Full settings (model, provider, temp, system prompt) - 12 shadcn UI components - Dark/light theme
This commit is contained in:
23
src/routes/api/hermes/sessions/+server.ts
Normal file
23
src/routes/api/hermes/sessions/+server.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
export async function GET({ url }) {
|
||||
try {
|
||||
const limit = url.searchParams.get('limit') || '20';
|
||||
const output = execSync(
|
||||
'hermes sessions list --limit ' + limit + ' --json 2>/dev/null || echo "[]"',
|
||||
{ timeout: 5000, encoding: 'utf-8' }
|
||||
);
|
||||
const parsed = JSON.parse(output);
|
||||
return json(
|
||||
parsed.map((s: any) => ({
|
||||
id: s.id || s.session_id || '',
|
||||
title: s.title || 'Untitled',
|
||||
preview: s.preview || (s.first_message || '').slice(0, 80),
|
||||
timestamp: s.timestamp || s.created_at || Date.now()
|
||||
}))
|
||||
);
|
||||
} catch {
|
||||
return json([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user