690618:2126 239 #01
CI / CD Pipeline / build (push) Successful in 6m54s
CI / CD Pipeline / deploy (push) Successful in 10m58s

This commit is contained in:
2026-06-18 21:26:07 +07:00
parent e8e10e8c04
commit 78e61fd300
15 changed files with 1432 additions and 344 deletions
@@ -17,7 +17,11 @@ export interface VramStatus {
totalVramMb: number;
usedVramMb: number;
freeVramMb: number;
loadedModels: string[];
loadedModels: Array<{
modelId: string;
modelName: string;
vramUsageMB: number;
}>;
hasCapacity: boolean;
}
@@ -102,7 +106,11 @@ export class VramMonitorService {
}>;
}>(`${this.ollamaUrl}/api/ps`, { timeout: 3000 });
const models = response.data?.models ?? [];
const loadedModels = models.map((m) => m.name);
const loadedModels = models.map((m) => ({
modelId: m.name,
modelName: m.name,
vramUsageMB: Math.round((m.size_vram || 0) / (1024 * 1024)),
}));
const headroom = await this.getVramHeadroom();
return {
totalVramMb: headroom.totalMb,
@@ -120,7 +120,13 @@ describe('VramMonitorService', () => {
},
});
const status = await service.getVramStatus(4000);
expect(status.loadedModels).toContain('np-dms-ai:latest');
expect(status.loadedModels).toEqual([
{
modelId: 'np-dms-ai:latest',
modelName: 'np-dms-ai:latest',
vramUsageMB: 3072,
},
]);
expect(status.totalVramMb).toBe(8192);
expect(status.hasCapacity).toBe(true); // 8192MB - 3072MB = 5120MB free > 4000MB required
});