model inference settings
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user