tweak: fixed whitespace

This commit is contained in:
Rishabh Shinde
2025-03-15 18:36:22 -04:00
parent 4b325caf12
commit ad0575b127
2 changed files with 5 additions and 19 deletions

View File

@@ -149,3 +149,4 @@ thumbnail-service
# init sql generated from ./run.sh
init.sql
test-app/

View File

@@ -365,32 +365,26 @@ class AIChatService extends BaseService {
await svc_event.emit('ai.prompt.validate', event);
if ( ! event.allow ) {
test_mode = true;
}
}
if ( parameters.messages ) {
parameters.messages =
Messages.normalize_messages(parameters.messages);
}
if ( ! test_mode && ! await this.moderate(parameters) ) {
test_mode = true;
}
if ( ! test_mode ) {
Context.set('moderated', true);
}
}
if ( test_mode ) {
intended_service = 'fake-chat';
if ( event.abuse ) {
parameters.model = 'abuse';
}
}
}
if ( parameters.tools ) {
FunctionCalling.normalize_tools_object(parameters.tools);
}
}
if ( intended_service === this.service_name ) {
throw new Error('Calling ai-chat directly is not yet supported');
}
@@ -456,7 +450,6 @@ class AIChatService extends BaseService {
}
return false;
})();
if ( is_request_error ) {
throw APIError.create('error_400_from_delegate', null, {
delegate: intended_service,
@@ -464,7 +457,6 @@ class AIChatService extends BaseService {
});
}
console.error(e);
if ( config.disable_fallback_mechanisms ) {
throw e;
}
@@ -580,7 +572,6 @@ class AIChatService extends BaseService {
usage,
});
})();
if ( ret.result.value.init_chat_stream ) {
const stream = new PassThrough();
const retval = new TypedValue({
@@ -629,7 +620,6 @@ class AIChatService extends BaseService {
service_used,
});
if (parameters.response?.normalize ) {
ret.result.message =
Messages.normalize_single_message(ret.result.message);
@@ -767,12 +757,10 @@ class AIChatService extends BaseService {
return true;
}
async models_ () {
return this.detail_model_list;
}
/**
* Returns a list of available AI models with basic details
* @returns {Promise<Array>} Array of simple model objects containing basic model information
@@ -781,7 +769,6 @@ class AIChatService extends BaseService {
return this.simple_model_list;
}
/**
* Gets the appropriate delegate service for handling chat completion requests.
* If the intended service is this service (ai-chat), returns undefined.
@@ -818,7 +805,6 @@ class AIChatService extends BaseService {
this.log.noticeme('conflict exists', { model, target_model });
target_model = target_model[0];
}
// First check KV for the sorted list
let sorted_models = this.modules.kv.get(
`${this.kvkey}:fallbacks:${model}`);
@@ -858,7 +844,6 @@ class AIChatService extends BaseService {
tried,
});
}
get_model_from_request (parameters, modified_context = {}) {
const client_driver_call = Context.get('client_driver_call');
let { intended_service } = client_driver_call;