refactor ambiguous "Client" from node-rest-client
This commit is contained in:
parent
26e008e907
commit
d07779e5da
12
server.js
12
server.js
|
@ -32,7 +32,7 @@ const DeviceDetector = require("device-detector-js");
|
||||||
const ipaddr = require('ipaddr.js');
|
const ipaddr = require('ipaddr.js');
|
||||||
const ipMatching = require('ip-matching');
|
const ipMatching = require('ip-matching');
|
||||||
const json5 = require('json5');
|
const json5 = require('json5');
|
||||||
const Client = require('node-rest-client').Client;
|
const RESTClient = require('node-rest-client').Client;
|
||||||
const WebSocket = require('ws');
|
const WebSocket = require('ws');
|
||||||
|
|
||||||
// image processing related library imports
|
// image processing related library imports
|
||||||
|
@ -142,9 +142,9 @@ function getHordeClient() {
|
||||||
return ai_horde;
|
return ai_horde;
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = new Client();
|
const restClient = new RESTClient();
|
||||||
|
|
||||||
client.on('error', (err) => {
|
restClient.on('error', (err) => {
|
||||||
console.error('An error occurred:', err);
|
console.error('An error occurred:', err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1862,7 +1862,7 @@ app.post("/getstatus_novelai", jsonParser, function (request, response_getstatus
|
||||||
headers: { "Content-Type": "application/json", "Authorization": "Bearer " + api_key_novel }
|
headers: { "Content-Type": "application/json", "Authorization": "Bearer " + api_key_novel }
|
||||||
};
|
};
|
||||||
|
|
||||||
client.get(api_novelai + "/user/subscription", args, function (data, response) {
|
restClient.get(api_novelai + "/user/subscription", args, function (data, response) {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
response_getstatus_novel.send(data);//data);
|
response_getstatus_novel.send(data);//data);
|
||||||
|
@ -3125,7 +3125,7 @@ app.post("/getstatus_openai", jsonParser, function (request, response_getstatus_
|
||||||
...headers,
|
...headers,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
client.get(api_url + "/models", args, function (data, response) {
|
restClient.get(api_url + "/models", args, function (data, response) {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
response_getstatus_openai.send(data);
|
response_getstatus_openai.send(data);
|
||||||
if (request.body.use_openrouter) {
|
if (request.body.use_openrouter) {
|
||||||
|
@ -3978,7 +3978,7 @@ async function postAsync(url, args) {
|
||||||
|
|
||||||
function getAsync(url, args) {
|
function getAsync(url, args) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
client.get(url, args, (data, response) => {
|
restClient.get(url, args, (data, response) => {
|
||||||
if (response.statusCode >= 400) {
|
if (response.statusCode >= 400) {
|
||||||
reject(data);
|
reject(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue