feat: enhance LM Studio stability and session management v2.2.27
This commit is contained in:
+14
-3
@@ -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 || '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user