feat: add admin menu, persistent json config, multi-provider support, and custom model fallback revolver
This commit is contained in:
parent
637a3cf255
commit
1c955619e7
21 changed files with 3742 additions and 388 deletions
11
src/stats.ts
11
src/stats.ts
|
|
@ -1,6 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { config } from './config';
|
||||
import { configStore } from './configStore';
|
||||
|
||||
export interface StatsData {
|
||||
totalRequests: number;
|
||||
|
|
@ -310,6 +311,11 @@ export class StatsTracker {
|
|||
const uptimeSeconds = Math.floor((Date.now() - this.serverStartedAt.getTime()) / 1000);
|
||||
const uptimeFormatted = this.formatUptime(uptimeSeconds);
|
||||
|
||||
const providers = configStore.getProviders();
|
||||
const totalKeys = providers.reduce((sum, p) => sum + p.keys.length, 0);
|
||||
const keysCount = totalKeys > 0 ? totalKeys : config.geminiApiKeys.length;
|
||||
const activeModel = configStore.getDefaultModel()?.name || config.model;
|
||||
|
||||
return {
|
||||
requests: {
|
||||
total,
|
||||
|
|
@ -329,8 +335,8 @@ export class StatsTracker {
|
|||
startedAt: this.serverStartedAt.toISOString(),
|
||||
lastRequestAt: this.stats.lastRequestAt,
|
||||
server: {
|
||||
model: config.model,
|
||||
configuredKeysCount: config.geminiApiKeys.length
|
||||
model: activeModel,
|
||||
configuredKeysCount: keysCount
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1138,6 +1144,7 @@ export class StatsTracker {
|
|||
|
||||
<div class="nav-actions">
|
||||
<div class="nav-links">
|
||||
<a href="/admin" title="Admin Menu & Model Revolver">Admin Console</a>
|
||||
<a href="/api/stats" target="_blank" title="View raw JSON API">JSON API</a>
|
||||
<a href="/health" target="_blank" title="View gateway health status">Health</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue