feat: enhance LM Studio stability and session management v2.2.27

This commit is contained in:
한예성
2026-04-25 00:37:47 +09:00
parent 0e20dff154
commit 78a50bd1f9
8 changed files with 918 additions and 777 deletions
+14 -3
View File
@@ -1,7 +1,7 @@
import * as http from 'http';
import * as fs from 'fs';
import * as path from 'path';
import axios from 'axios';
// axios removed
import { getConfig, _getBrainDir, _isBrainDirExplicitlySet, findBrainFiles } from './utils';
export interface BridgeInterface {
@@ -154,7 +154,18 @@ export class BridgeServer {
stream: false
};
const res = await axios.post(apiUrl, payload, { timeout: config.timeout });
return isLMStudio ? (res.data.choices?.[0]?.message?.content || '') : (res.data.message?.content || '');
const res = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
signal: AbortSignal.timeout(config.timeout)
});
if (!res.ok) {
throw new Error(`Bridge AI call failed: ${res.status}`);
}
const data = await res.json() as any;
return isLMStudio ? (data.choices?.[0]?.message?.content || '') : (data.message?.content || '');
}
}