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

@@ -195,3 +195,9 @@ export async function getServiceHealth() {
if (!res.ok) throw new Error(`Failed to fetch health: ${res.status}`);
return res.json();
}
export async function getModelProps() {
const res = await fetch(`${BASE_URL}/models/props`);
if (!res.ok) throw new Error('Failed to fetch model props');
return res.json();
}

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
import { useSettings } from '../hooks/useSettings';
import { getServiceHealth } from '../api/orchestration';
import { useModels } from '../hooks/useModels';
import { getModelProps } from '../api/orchestration';
export default function SettingsView({ onNavigate }) {
const { settings, saveSetting, saving } = useSettings();
@@ -243,6 +244,11 @@ function ModelsSection({ onNavigate }) {
const [selectedInfo, setSelectedInfo] = useState(null);
const {settings, saveSetting, saving} = useSettings();
const [modelProps, setModelProps] = useState(null);
useEffect(() => {
getModelProps().then(setModelProps).catch(() => {});
}, []);
// Sync info panel when selection changes
useEffect(() => {
const m = models.find(m => m.value === selectedModel);
@@ -325,6 +331,15 @@ function ModelsSection({ onNavigate }) {
{selectedInfo.description && (
<InfoLine label="Description" value={selectedInfo.description} />
)}
<InfoLine
label="Context"
value={modelProps ? `${modelProps.contextWindow.toLocaleString()} tokens` : '—'}
/>
<InfoLine
label="Loaded"
value={modelProps?.modelAlias ?? '—'}
mono
/>
</div>
<p className="text-xs text-muted" style={{ marginTop: 4, fontStyle: 'italic' }}>
Model loading and parameter configuration coming soon

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;