model inference settings
This commit is contained in:
@@ -194,4 +194,10 @@ export async function getServiceHealth() {
|
|||||||
const res = await fetch(`${BASE_URL}/health/services`);
|
const res = await fetch(`${BASE_URL}/health/services`);
|
||||||
if (!res.ok) throw new Error(`Failed to fetch health: ${res.status}`);
|
if (!res.ok) throw new Error(`Failed to fetch health: ${res.status}`);
|
||||||
return res.json();
|
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();
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|||||||
import { useSettings } from '../hooks/useSettings';
|
import { useSettings } from '../hooks/useSettings';
|
||||||
import { getServiceHealth } from '../api/orchestration';
|
import { getServiceHealth } from '../api/orchestration';
|
||||||
import { useModels } from '../hooks/useModels';
|
import { useModels } from '../hooks/useModels';
|
||||||
|
import { getModelProps } from '../api/orchestration';
|
||||||
|
|
||||||
export default function SettingsView({ onNavigate }) {
|
export default function SettingsView({ onNavigate }) {
|
||||||
const { settings, saveSetting, saving } = useSettings();
|
const { settings, saveSetting, saving } = useSettings();
|
||||||
@@ -243,6 +244,11 @@ function ModelsSection({ onNavigate }) {
|
|||||||
const [selectedInfo, setSelectedInfo] = useState(null);
|
const [selectedInfo, setSelectedInfo] = useState(null);
|
||||||
const {settings, saveSetting, saving} = useSettings();
|
const {settings, saveSetting, saving} = useSettings();
|
||||||
|
|
||||||
|
const [modelProps, setModelProps] = useState(null);
|
||||||
|
useEffect(() => {
|
||||||
|
getModelProps().then(setModelProps).catch(() => {});
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Sync info panel when selection changes
|
// Sync info panel when selection changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const m = models.find(m => m.value === selectedModel);
|
const m = models.find(m => m.value === selectedModel);
|
||||||
@@ -325,6 +331,15 @@ function ModelsSection({ onNavigate }) {
|
|||||||
{selectedInfo.description && (
|
{selectedInfo.description && (
|
||||||
<InfoLine label="Description" value={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>
|
</div>
|
||||||
<p className="text-xs text-muted" style={{ marginTop: 4, fontStyle: 'italic' }}>
|
<p className="text-xs text-muted" style={{ marginTop: 4, fontStyle: 'italic' }}>
|
||||||
Model loading and parameter configuration coming soon
|
Model loading and parameter configuration coming soon
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const appSettings = require('../config/settings');
|
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) => {
|
router.get('/', (req, res) => {
|
||||||
const { modelsFolderPath } = appSettings.load();
|
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) {
|
function getFileSizeMB(filepath) {
|
||||||
try {
|
try {
|
||||||
const bytes = fs.statSync(filepath).size;
|
const bytes = fs.statSync(filepath).size;
|
||||||
|
|||||||
Reference in New Issue
Block a user