Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cortex-js/src/domain/models/resource.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ export interface ResourceStatus {
cpu: {
usage: number;
};
gpus: GpuInfo[];
}

export interface UsedMemInfo {
total: number;
used: number;
}

export interface GpuInfo {
name: string | undefined;
vram: number | null;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import osUtils from 'node-os-utils'
import {
ResourceStatus,
UsedMemInfo,
} from '@/domain/models/resource.interface';
import { getMemoryInformation, MemoryInformation } from '@/utils/system-resource';
import { Injectable } from '@nestjs/common';
import systemInformation, { Systeminformation } from 'systeminformation';
import si, { Systeminformation } from 'systeminformation';

@Injectable()
export class ResourcesManagerService {
async getResourceStatuses(): Promise<ResourceStatus> {
const promises = [systemInformation.currentLoad(), getMemoryInformation()];
const promises = [si.currentLoad(), getMemoryInformation()];
const results = await Promise.all(promises);

const cpuUsage = results[0] as Systeminformation.CurrentLoadData;
Expand All @@ -19,12 +18,15 @@ export class ResourcesManagerService {
total: memory.total,
used: memory.used,
};

return {
mem: memInfo,
cpu: {
usage: Number(cpuUsage.currentLoad.toFixed(2)),
},
gpus: (await si.graphics()).controllers.map((gpu) => ({
name: gpu.name,
vram: gpu.vram,
})),
};
}
}
2 changes: 1 addition & 1 deletion cortex-js/src/usecases/models/models.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export class ModelsUsecases {

// Default Inference Params
stream: true,
max_tokens: 4098,
max_tokens: 4096,
frequency_penalty: 0.7,
presence_penalty: 0.7,
temperature: 0.7,
Expand Down