From 6351576cf8b3b3b138393f7a5894e5fe4c4b597f Mon Sep 17 00:00:00 2001 From: WFH Brian Date: Mon, 22 Apr 2024 11:18:45 -0400 Subject: [PATCH] enable endpoint without port when building from config --- smart-chat-model/smart_chat_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smart-chat-model/smart_chat_model.js b/smart-chat-model/smart_chat_model.js index b46ea25b..f9d70cee 100644 --- a/smart-chat-model/smart_chat_model.js +++ b/smart-chat-model/smart_chat_model.js @@ -363,12 +363,13 @@ class SmartChatModel { // use endpoint of combine protocol, hostname, port, and path get endpoint() { if(typeof this.adapter?.endpoint !== 'undefined') return this.adapter.endpoint.replace('MODEL_NAME', this.model_name); - return this.config.endpoint || this.config.protocol + "://" + this.config.hostname + ":" + this.config.port + this.config.path; + return this.config.endpoint || this.config.protocol + "://" + this.config.hostname + (this.config.port ? ":" + this.config.port : "") + this.endpoint_path; } get endpoint_streaming() { if(typeof this.adapter?.endpoint_streaming !== 'undefined') return this.adapter.endpoint_streaming.replace('MODEL_NAME', this.model_name); return this.config.endpoint_streaming || this.endpoint; } + get endpoint_path() { return this.config.path.startsWith('/') ? this.config.path : '/' + this.config.path; } get max_input_tokens() { return this.config.max_input_tokens; } get max_output_tokens() { return this.config.max_output_tokens; } get model_name() { return this.config.model_name || this.config.default_model; }