From c85542e36838f6d06fb0d15a244f9ec84266573e Mon Sep 17 00:00:00 2001 From: Marco Brunet Date: Fri, 2 Feb 2024 15:26:34 +0100 Subject: [PATCH] Add chatbot path to nginx server configuration Remove chatbot parameter --- nginx.vh.default.conf | 13 ++++++++++++- .../src/lib/hyt-chatbot/hyt-chatbot.component.ts | 2 +- src/app/app.component.html | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/nginx.vh.default.conf b/nginx.vh.default.conf index 6f946bed..d42008c8 100644 --- a/nginx.vh.default.conf +++ b/nginx.vh.default.conf @@ -2,6 +2,17 @@ server { listen 80; listen [::]:80; client_max_body_size 200M; + + #WebSocket reverse proxy configuration for chatbot + location /hyperiot/llm/ws { + resolver 127.0.0.1 [::1]; + rewrite ^/hyperiot/llm/ws/(.*) /ws/$1 break; + proxy_http_version 1.1; + proxy_set_header Upgrade ${DOLLAR}http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass "${API_CHATBOT_URL}"; + } + #WebSocket reverse proxy configuration location /hyperiot/ws { resolver 127.0.0.1 [::1]; @@ -17,7 +28,7 @@ server { proxy_http_version 1.1; proxy_pass "${API_URL}"; } - + #Angular APP Configuration location / { root /usr/share/nginx/html; diff --git a/projects/components/src/lib/hyt-chatbot/hyt-chatbot.component.ts b/projects/components/src/lib/hyt-chatbot/hyt-chatbot.component.ts index 7389ca6a..4cf70cf7 100644 --- a/projects/components/src/lib/hyt-chatbot/hyt-chatbot.component.ts +++ b/projects/components/src/lib/hyt-chatbot/hyt-chatbot.component.ts @@ -36,7 +36,7 @@ export class HytChatbotComponent implements OnInit, OnDestroy, AfterViewInit { @ViewChild("inputMsg") inputMsgEl?: ElementRef; /** Url for ccat defined inside src/environments/ */ - @Input() public ccatUrl: string; + @Input() public ccatUrl: string = location.hostname; /** enable ccat secure connection (ws or wss) */ @Input() public secure = false; diff --git a/src/app/app.component.html b/src/app/app.component.html index 0f322c97..ace9c819 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -22,7 +22,6 @@