Initial commit: Hermes Chat App with Svelte 5 + shadcn-svelte
This commit is contained in:
35
src/routes/api/hermes/status/+server.ts
Normal file
35
src/routes/api/hermes/status/+server.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const version = execSync('hermes --version 2>/dev/null || echo "not found"', {
|
||||
timeout: 5000,
|
||||
encoding: 'utf-8'
|
||||
}).trim();
|
||||
|
||||
const modelOutput = execSync(
|
||||
'hermes config get model.default 2>/dev/null || echo "not set"',
|
||||
{ timeout: 5000, encoding: 'utf-8' }
|
||||
).trim();
|
||||
|
||||
const providerOutput = execSync(
|
||||
'hermes config get model.provider 2>/dev/null || echo "openrouter"',
|
||||
{ timeout: 5000, encoding: 'utf-8' }
|
||||
).trim();
|
||||
|
||||
return json({
|
||||
available: version !== 'not found',
|
||||
model: modelOutput === 'not set' ? '' : modelOutput,
|
||||
provider: providerOutput,
|
||||
version
|
||||
});
|
||||
} catch {
|
||||
return json({
|
||||
available: false,
|
||||
model: '',
|
||||
provider: 'openrouter',
|
||||
version: 'not found'
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user