Try detect LM Studio in status check

Fixes #2849
This commit is contained in:
Cohee 2024-09-15 08:24:28 +03:00
parent 2478e17164
commit 2bc87a401e

View File

@ -137,6 +137,7 @@ router.post('/status', jsonParser, async function (request, response) {
}
const modelsReply = await fetch(url, args);
const isPossiblyLmStudio = modelsReply.headers.get('x-powered-by') === 'Express';
if (!modelsReply.ok) {
console.log('Models endpoint is offline.');
@ -174,7 +175,7 @@ router.post('/status', jsonParser, async function (request, response) {
// Set result to the first model ID
result = modelIds[0] || 'Valid';
if (apiType === TEXTGEN_TYPES.OOBA) {
if (apiType === TEXTGEN_TYPES.OOBA && !isPossiblyLmStudio) {
try {
const modelInfoUrl = baseUrl + '/v1/internal/model/info';
const modelInfoReply = await fetch(modelInfoUrl, args);