Try detect LM Studio in status check Fixes #2849

2bc87a401eb60bfe2e411de91fa7a7fa513e6a65

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -1Ignore whitespace
src/endpoints/backends/text-completions.js+2 -1
@@ -137,6 +137,7 @@ router.post('/status', jsonParser, async function (request, response) {
137 }137 }
138138
139 const modelsReply = await fetch(url, args);139 const modelsReply = await fetch(url, args);
140 const isPossiblyLmStudio = modelsReply.headers.get('x-powered-by') === 'Express';
140141
141 if (!modelsReply.ok) {142 if (!modelsReply.ok) {
142 console.log('Models endpoint is offline.');143 console.log('Models endpoint is offline.');
@@ -174,7 +175,7 @@ router.post('/status', jsonParser, async function (request, response) {
174 // Set result to the first model ID175 // Set result to the first model ID
175 result = modelIds[0] || 'Valid';176 result = modelIds[0] || 'Valid';
176177
177 if (apiType === TEXTGEN_TYPES.OOBA) {178 if (apiType === TEXTGEN_TYPES.OOBA && !isPossiblyLmStudio) {
178 try {179 try {
179 const modelInfoUrl = baseUrl + '/v1/internal/model/info';180 const modelInfoUrl = baseUrl + '/v1/internal/model/info';
180 const modelInfoReply = await fetch(modelInfoUrl, args);181 const modelInfoReply = await fetch(modelInfoUrl, args);