From dd06d6f0aaf05edfcbd66e9963e8c8f65a82930c Mon Sep 17 00:00:00 2001 From: Thomas Hansen Date: Tue, 17 Oct 2023 08:34:51 +0300 Subject: [PATCH] Bumping version and applying hard cache on chatbot CSS on version --- backend/files/system/openai/front.files/chat/default.js | 4 ++-- backend/files/system/openai/include-javascript.get.hl | 7 +++++++ backend/files/system/openai/include-style.get.hl | 4 ++-- backend/slots/Version.cs | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/files/system/openai/front.files/chat/default.js b/backend/files/system/openai/front.files/chat/default.js index 296f4a599a..911ba9ab20 100644 --- a/backend/files/system/openai/front.files/chat/default.js +++ b/backend/files/system/openai/front.files/chat/default.js @@ -41,7 +41,7 @@ let ainiroChatbotType = '[[type]]'; if (!window.ainiroHasDownloadIcofont) { window.ainiroHasDownloadIcofont = true; const icofontCss = window.document.createElement('link'); - icofontCss.href = 'https://ainiro.io/assets/css/icofont.min.css?v=16.9.5'; + icofontCss.href = 'https://ainiro.io/assets/css/icofont.min.css?v=[[ainiro_version]]'; icofontCss.rel = 'stylesheet'; window.document.getElementsByTagName('head')[0].appendChild(icofontCss); } @@ -84,7 +84,7 @@ if (window.getAiniroChatbotCssFile) { // Fetching theme's CSS file and including on page window.ainiroHasDownloadIcofont = true; const icofontCss = window.document.createElement('link'); -icofontCss.href = '[[url]]/magic/system/openai/include-style?file=' + encodeURIComponent(ainiroChatbotCssFile) + '&v=16.9.8'; +icofontCss.href = '[[url]]/magic/system/openai/include-style?file=' + encodeURIComponent(ainiroChatbotCssFile) + '&v=[[ainiro_version]]'; icofontCss.rel = 'stylesheet'; window.document.getElementsByTagName('head')[0].appendChild(icofontCss); diff --git a/backend/files/system/openai/include-javascript.get.hl b/backend/files/system/openai/include-javascript.get.hl index 08fbbb175e..b63c4d153c 100644 --- a/backend/files/system/openai/include-javascript.get.hl +++ b/backend/files/system/openai/include-javascript.get.hl @@ -18,6 +18,9 @@ submit_button:bool stream:bool + // Not used, but allows embedders to do a hard refresh to reload JavaScript. + v:string + // Legacy parameter, ignore, no longer in use. gpt:bool .description:Returns the JavaScript required to embed a ChatGPT based chatbot on some website to caller. @@ -111,6 +114,10 @@ set-value:x:@.result get-first-value config.get:"magic:watermark" .:"Powered by AINIRO.IO" +set-value:x:@.result + strings.replace:x:@.result + .:[[ainiro_version]] + version set-value:x:@.result strings.replace:x:@.result .:[[recaptcha]] diff --git a/backend/files/system/openai/include-style.get.hl b/backend/files/system/openai/include-style.get.hl index 1da8863d30..76945f7d33 100644 --- a/backend/files/system/openai/include-style.get.hl +++ b/backend/files/system/openai/include-style.get.hl @@ -45,8 +45,8 @@ else // Making sure we return correct Content-Type to caller, and applying some cache. response.headers.set - Content-Type:text/css - Cache-Control:public, max-age=3600 + Content-Type:text/css; charset=utf-8 + Cache-Control:public, max-age=31536000 // Returning result to caller. return:x:@.result diff --git a/backend/slots/Version.cs b/backend/slots/Version.cs index e5d9cb4aff..88103d6e31 100644 --- a/backend/slots/Version.cs +++ b/backend/slots/Version.cs @@ -20,7 +20,7 @@ public class Version : ISlot /// Parameters passed from signaler public void Signal(ISignaler signaler, Node input) { - input.Value = "v16.9.7"; + input.Value = "v16.10.0"; } } }