Try detect LM Studio in status check Fixes #2849

2bc87a401eb60bfe2e411de91fa7a7fa513e6a65

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

1 files changed, +2 -1Showing whitespace changes
src/endpoints/backends/text-completions.js+2 -1
@@ -137,6 +137,7 @@ router.post('/status', jsonParser, async function (request, response) {
137137 }
138138
139139 const modelsReply = await fetch(url, args);
140+ const isPossiblyLmStudio = modelsReply.headers.get('x-powered-by') === 'Express';
140141
141142 if (!modelsReply.ok) {
142143 console.log('Models endpoint is offline.');
@@ -174,7 +175,7 @@ router.post('/status', jsonParser, async function (request, response) {
174175 // Set result to the first model ID
175176 result = modelIds[0] || 'Valid';
176177
177178 if (apiType === TEXTGEN_TYPES.OOBA && !isPossiblyLmStudio) {
178179 try {
179180 const modelInfoUrl = baseUrl + '/v1/internal/model/info';
180181 const modelInfoReply = await fetch(modelInfoUrl, args);