model inference settings

This commit is contained in:
Storme-bit
2026-04-18 06:16:31 -07:00
parent daf5b9a8ae
commit 4b75529806
3 changed files with 39 additions and 0 deletions

View File

@@ -4,6 +4,9 @@ const fs = require('fs');
const path = require('path');
const appSettings = require('../config/settings');
const { getEnv, SERVICES } = require('@nexusai/shared');
const INFERENCE_SERVICE_URL = getEnv('INFERENCE_SERVICE_URL', SERVICES.INFERENCE_URL);
router.get('/', (req, res) => {
const { modelsFolderPath } = appSettings.load();
@@ -40,6 +43,21 @@ router.get('/', (req, res) => {
}
});
router.get('/props', async (req, res) => {
try {
const response = await fetch(`${INFERENCE_SERVICE_URL}/props`);
if (!response.ok) throw new Error(`Inference service error: ${response.status}`);
const data = await response.json();
res.json({
contextWindow: data.n_ctx,
modelAlias: data.model_alias,
});
} catch (err) {
console.error('[models/props]', err.message);
res.status(503).json({ error: 'Could not reach inference service' });
}
});
function getFileSizeMB(filepath) {
try {
const bytes = fs.statSync(filepath).size;