Przeglądaj źródła

clean: remove some unused code/comments

KernelDeimos 5 miesięcy temu
rodzic
commit
0f2641b88f

+ 5 - 8
src/backend/src/filesystem/hl_operations/hl_data_read.js

@@ -75,14 +75,11 @@ class HLDataRead extends HLFilesystemOperation {
 
         const output_stream = new PassThrough();
 
-        new Promise((resolve, reject) => {
-            rl.on('line', (line) => {
-                output_stream.write(line);
-            });
-            rl.on('close', () => {
-                output_stream.end();
-                resolve();
-            });
+        rl.on('line', (line) => {
+            output_stream.write(line);
+        });
+        rl.on('close', () => {
+            output_stream.end();
         });
 
         return output_stream;

+ 0 - 1
src/backend/src/middleware/abuse.js

@@ -20,7 +20,6 @@ const APIError = require("../api/APIError");
 const { Context } = require("../util/context");
 
 const abuse = options => (req, res, next) => {
-    // const svc_abuse = x.get('services').get('abuse-prevention');
     const requester = Context.get('requester');
 
     if ( options.no_bots ) {

+ 2 - 11
src/backend/src/modules/core/AlarmService.js

@@ -71,9 +71,6 @@ class AlarmService extends BaseService {
             * @returns {void}
             */
             this.alarm_widget = () => {
-                // return `\x1B[31;1m alarms (${
-                //     Object.keys(this.alarms)
-                // })\x1B[0m`;
                 const lines = [];
                 for ( const alarm of Object.values(this.alarms) ) {
                     const line =
@@ -97,12 +94,6 @@ class AlarmService extends BaseService {
     }
 
     adapt_id_ (id) {
-        // let shorten = false;
-        // // Check if id uses characters that aren't on a US QWERTY keyboard.
-        // if ( /[^\x20-\x7E]/.test(id) ) shorten = true;
-
-        // // Check if id is too long
-        // if ( id.length > 20 ) shorten = true;
         let shorten = true;
 
         if ( shorten ) {
@@ -344,7 +335,7 @@ class AlarmService extends BaseService {
         // Write a .log file for the alert that happened
         try {
             const lines = [];
-            lines.push(`ALERT ${alarm.id_string} :: ${alarm.message} (${alarm.count})`),
+            lines.push(`ALERT ${alarm.id_string} :: ${alarm.message} (${alarm.count})`);
             lines.push(`started: ${new Date(alarm.started).toISOString()}`);
             lines.push(`short id: ${alarm.short_id}`);
             lines.push(`original id: ${alarm.id}`);
@@ -356,7 +347,7 @@ class AlarmService extends BaseService {
 
             (async () => {
                 try {
-                    await fs.appendFileSync(`alert_${alarm.id}.log`, alert_info + '\n');
+                    fs.appendFileSync(`alert_${alarm.id}.log`, alert_info + '\n');
                 } catch (e) {
                     this.log.error(`failed to write alert log: ${e.message}`);
                 }

+ 0 - 3
src/backend/src/modules/core/ProcessEventService.js

@@ -38,9 +38,6 @@ class ProcessEventService extends BaseService {
         const log = services.get('log-service').create('process-event-service');
         const errors = services.get('error-service').create(log);
 
-        // TODO: when the service lifecycle is implemented, but these
-        //       in the init hook
-
         process.on('uncaughtException', async (err, origin) => {
             /**
             * Handles uncaught exceptions in the process

+ 1 - 4
src/backend/src/modules/puterai/AIChatService.js

@@ -116,7 +116,6 @@ class AIChatService extends BaseService {
             }
         }
 
-        // TODO: get models and pricing for each model
         for ( const provider of this.providers ) {
             const delegate = this.services.get(provider.service_name)
                 .as('puter-chat-completion');
@@ -289,7 +288,7 @@ class AIChatService extends BaseService {
                 }
                 
                 const svc_driver = this.services.get('driver');
-                let ret, error, errors = [];
+                let ret, error;
                 let service_used = intended_service;
                 let model_used = this.get_model_from_request(parameters, {
                     intended_service
@@ -315,7 +314,6 @@ class AIChatService extends BaseService {
                     tried.push(model);
 
                     error = e;
-                    errors.push(e);
                     console.error(e);
                     this.log.error('error calling service', {
                         intended_service,
@@ -368,7 +366,6 @@ class AIChatService extends BaseService {
                             };
                         } catch (e) {
                             error = e;
-                            errors.push(e);
                             tried.push(fallback_model_name);
                             this.log.error('error calling fallback', {
                                 intended_service,