From 64506c1dba53b6ca353c532e8ff2802416b59e45 Mon Sep 17 00:00:00 2001 From: Aldemylla Date: Tue, 26 Mar 2024 15:50:37 -0300 Subject: [PATCH 01/12] fix: Dockerfile, docker-entrypoint and log of env variables --- docker-entrypoint.sh | 2 +- docker/Dockerfile | 30 ++++++++++++------------------ src/services/api/resources/GPT.js | 2 ++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index cbe8e51f..8fb881a5 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,6 +3,6 @@ export JSON_STRING='window.configs = { \ "VITE_GPT_URL":"'${VITE_GPT_URL}'", \ "VITE_GPT_AUTH":"'${VITE_GPT_AUTH}'", \ }' -sed "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/insights/index.html.tmpl > /tmp/index.html +sed -i "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/index.html exec "$@" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 982eaca2..f3b78aba 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ ARG BASE_VERSION="alpine3.17" FROM node:${NODE_VERSION}-${BASE_VERSION} as builder -WORKDIR /app +WORKDIR /home/app ARG VITE_GPT_URL ARG VITE_GPT_AUTH @@ -13,26 +13,20 @@ ARG VITE_GPT_AUTH ENV VITE_GPT_URL $VITE_GPT_URL ENV VITE_GPT_AUTH $VITE_GPT_AUTH -RUN apk --no-cache add git - -COPY package.json yarn.lock ./ - -RUN --mount=type=cache,target=/root/.yarn \ - YARN_CACHE_FOLDER=/root/.yarn yarn install - -COPY . ./ - +COPY package.json . +COPY yarn.lock . +RUN yarn install +COPY . . RUN yarn build -FROM nginxinc/nginx-unprivileged:1.25-alpine +FROM nginx + +COPY --from=builder /home/app/dist /usr/share/nginx/html -COPY --chown=nginx:nginx docker/nginx/nginx.conf /etc/nginx/nginx.conf -COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html/insights/ -COPY docker-entrypoint.sh / -RUN mv /usr/share/nginx/html/insights/index.html /usr/share/nginx/html/insights/index.html.tmpl \ - && cd /usr/share/nginx/html/insights/ \ - && ln -s /tmp/index.html +COPY ./docker/nginx/nginx.conf /etc/nginx +COPY docker-entrypoint.sh /usr/share/nginx/ +RUN chmod +x /usr/share/nginx/docker-entrypoint.sh EXPOSE 8080 -ENTRYPOINT ["/docker-entrypoint.sh"] +ENTRYPOINT [ "/usr/share/nginx/docker-entrypoint.sh" ] CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/src/services/api/resources/GPT.js b/src/services/api/resources/GPT.js index b5bf3aca..244c44ba 100644 --- a/src/services/api/resources/GPT.js +++ b/src/services/api/resources/GPT.js @@ -9,6 +9,8 @@ const http = axios.create({ export default { async getInsights(prompt) { + console.log('VITE_GPT_AUTH:', env('VITE_GPT_AUTH')); + console.log('VITE_GPT_URL:', env('VITE_GPT_URL')); const response = await http.post(env('VITE_GPT_URL'), { input: { prompt: `[INST] ${prompt} [/INST]`, From ca6f0ac1a720fd31650de3c3262c048029da1a3c Mon Sep 17 00:00:00 2001 From: aldemylla Date: Wed, 27 Mar 2024 09:11:52 -0300 Subject: [PATCH 02/12] Revert "fix: Dockerfile, docker-entrypoint and log of env variables" This reverts commit 64506c1dba53b6ca353c532e8ff2802416b59e45. --- docker-entrypoint.sh | 2 +- docker/Dockerfile | 30 ++++++++++++++++++------------ src/services/api/resources/GPT.js | 2 -- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8fb881a5..cbe8e51f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,6 +3,6 @@ export JSON_STRING='window.configs = { \ "VITE_GPT_URL":"'${VITE_GPT_URL}'", \ "VITE_GPT_AUTH":"'${VITE_GPT_AUTH}'", \ }' -sed -i "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/index.html +sed "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/insights/index.html.tmpl > /tmp/index.html exec "$@" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index f3b78aba..982eaca2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ ARG BASE_VERSION="alpine3.17" FROM node:${NODE_VERSION}-${BASE_VERSION} as builder -WORKDIR /home/app +WORKDIR /app ARG VITE_GPT_URL ARG VITE_GPT_AUTH @@ -13,20 +13,26 @@ ARG VITE_GPT_AUTH ENV VITE_GPT_URL $VITE_GPT_URL ENV VITE_GPT_AUTH $VITE_GPT_AUTH -COPY package.json . -COPY yarn.lock . -RUN yarn install -COPY . . -RUN yarn build +RUN apk --no-cache add git + +COPY package.json yarn.lock ./ + +RUN --mount=type=cache,target=/root/.yarn \ + YARN_CACHE_FOLDER=/root/.yarn yarn install -FROM nginx +COPY . ./ + +RUN yarn build -COPY --from=builder /home/app/dist /usr/share/nginx/html +FROM nginxinc/nginx-unprivileged:1.25-alpine -COPY ./docker/nginx/nginx.conf /etc/nginx -COPY docker-entrypoint.sh /usr/share/nginx/ -RUN chmod +x /usr/share/nginx/docker-entrypoint.sh +COPY --chown=nginx:nginx docker/nginx/nginx.conf /etc/nginx/nginx.conf +COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html/insights/ +COPY docker-entrypoint.sh / +RUN mv /usr/share/nginx/html/insights/index.html /usr/share/nginx/html/insights/index.html.tmpl \ + && cd /usr/share/nginx/html/insights/ \ + && ln -s /tmp/index.html EXPOSE 8080 -ENTRYPOINT [ "/usr/share/nginx/docker-entrypoint.sh" ] +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/src/services/api/resources/GPT.js b/src/services/api/resources/GPT.js index 244c44ba..b5bf3aca 100644 --- a/src/services/api/resources/GPT.js +++ b/src/services/api/resources/GPT.js @@ -9,8 +9,6 @@ const http = axios.create({ export default { async getInsights(prompt) { - console.log('VITE_GPT_AUTH:', env('VITE_GPT_AUTH')); - console.log('VITE_GPT_URL:', env('VITE_GPT_URL')); const response = await http.post(env('VITE_GPT_URL'), { input: { prompt: `[INST] ${prompt} [/INST]`, From 08e256f8c4d94be51c4c37a9a6e390150a1d0f3e Mon Sep 17 00:00:00 2001 From: aldemylla Date: Tue, 2 Apr 2024 13:12:49 -0300 Subject: [PATCH 03/12] feat: Remade ResizableBar resize behavior --- src/components/ResizableBarNext.vue | 149 +++++++++++++++++++++++++++ src/layouts/InsightsLayout/index.vue | 2 +- 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 src/components/ResizableBarNext.vue diff --git a/src/components/ResizableBarNext.vue b/src/components/ResizableBarNext.vue new file mode 100644 index 00000000..96677dc2 --- /dev/null +++ b/src/components/ResizableBarNext.vue @@ -0,0 +1,149 @@ + + + + + diff --git a/src/layouts/InsightsLayout/index.vue b/src/layouts/InsightsLayout/index.vue index ec35d1ae..ad5d2ad5 100644 --- a/src/layouts/InsightsLayout/index.vue +++ b/src/layouts/InsightsLayout/index.vue @@ -13,7 +13,7 @@ - - diff --git a/src/components/insights/ResizableBar/ResizableBarCards.vue b/src/components/insights/ResizableBar/ResizableBarCards.vue new file mode 100644 index 00000000..ccc49834 --- /dev/null +++ b/src/components/insights/ResizableBar/ResizableBarCards.vue @@ -0,0 +1,224 @@ + + + + + diff --git a/src/components/ResizableBarNext.vue b/src/components/insights/ResizableBar/index.vue similarity index 85% rename from src/components/ResizableBarNext.vue rename to src/components/insights/ResizableBar/index.vue index 96677dc2..bcddcf01 100644 --- a/src/components/ResizableBarNext.vue +++ b/src/components/insights/ResizableBar/index.vue @@ -26,12 +26,19 @@ height: `${contentHeight}vh`, transition: resizeTransition, }" - > + > + + + From c9890354dbc658a0b1ed46a1b5005a57c8163442 Mon Sep 17 00:00:00 2001 From: aldemylla Date: Tue, 9 Apr 2024 17:45:01 -0300 Subject: [PATCH 07/12] feat: ResibleBar start with content scroll at 0 --- .../insights/ResizableBar/ResizableBarCards.vue | 12 ------------ src/components/insights/ResizableBar/index.vue | 6 ++++++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/insights/ResizableBar/ResizableBarCards.vue b/src/components/insights/ResizableBar/ResizableBarCards.vue index f1e71ab0..f5f3f693 100644 --- a/src/components/insights/ResizableBar/ResizableBarCards.vue +++ b/src/components/insights/ResizableBar/ResizableBarCards.vue @@ -78,18 +78,6 @@
- - - - - - - - Date: Tue, 9 Apr 2024 17:46:04 -0300 Subject: [PATCH 08/12] feat: Increasing ResizableBar drag activation space --- src/components/insights/ResizableBar/index.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/insights/ResizableBar/index.vue b/src/components/insights/ResizableBar/index.vue index 341a0456..9093815f 100644 --- a/src/components/insights/ResizableBar/index.vue +++ b/src/components/insights/ResizableBar/index.vue @@ -108,9 +108,11 @@ export default { watch: { isResizing(newIsResizing) { if (newIsResizing) { + document.body.style.cursor = 'ns-resize'; window.addEventListener('mousemove', this.handleResizing); window.addEventListener('mouseup', this.stopResizing); } else { + document.body.style.cursor = 'default'; window.removeEventListener('mousemove', this.handleResizing); window.removeEventListener('mouseup', this.stopResizing); } @@ -147,13 +149,15 @@ $insightsLayoutPadding: ($unnnic-spacing-sm * 2); background: $unnnic-color-background-white; + cursor: ns-resize; + .handler__separator { width: 100%; + margin: $unnnic-spacing-xs 0; + border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean; border-radius: $unnnic-border-radius-pill; - - cursor: ns-resize; } .handler__button { From cbe75dbee5e46d55e627bf736cd750e8b58a502f Mon Sep 17 00:00:00 2001 From: aldemylla Date: Wed, 10 Apr 2024 12:11:22 -0300 Subject: [PATCH 09/12] fix: Adjusted the click reference to the ResizableBar handler --- .../insights/ResizableBar/index.vue | 50 ++++++++++++------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/components/insights/ResizableBar/index.vue b/src/components/insights/ResizableBar/index.vue index 9093815f..c98ce120 100644 --- a/src/components/insights/ResizableBar/index.vue +++ b/src/components/insights/ResizableBar/index.vue @@ -45,11 +45,14 @@ export default { data() { return { - startY: 0, - maxContentHeight: 60, - contentHeight: 24, isResizing: false, resizeTransition: 'none', + + startHandlerY: null, + startContentHeight: null, + + contentHeightMax: 60, + contentHeight: 24, }; }, @@ -61,48 +64,61 @@ export default { computed: { handlerIcon() { - return this.contentHeight === this.maxContentHeight + return this.contentHeight === this.contentHeightMax ? 'expand_circle_down' : 'expand_circle_up'; }, }, methods: { + pxToVh(px) { + const vh = window.innerHeight; + const pxAsVh = (px / vh) * 100; + return pxAsVh; + }, + handleResizeClick() { - this.resizeTransition = 'height ease-in-out 0.3s'; + const { contentHeight, contentHeightMax } = this; + if ( - (this.contentHeight > 0 && - this.contentHeight !== this.maxContentHeight) || - this.contentHeight === 0 + (contentHeight > 0 && contentHeight !== contentHeightMax) || + contentHeight === 0 ) { - this.contentHeight = this.maxContentHeight; + this.resizeHeightWithTransition(contentHeightMax); } else { - this.contentHeight = 0; + this.resizeHeightWithTransition(0); } }, startResizing(event) { this.isResizing = true; - this.startY = event.clientY; + this.startHandlerY = event.clientY; + this.startContentHeight = this.contentHeight; this.resizeTransition = 'none'; }, handleResizing(event) { if (this.isResizing) { - const relativeVHFromClick = (event.clientY * 100) / window.innerHeight; - const remainingRelativeVHFromClick = 100 - relativeVHFromClick; - const adjustedcontentHeight = Math.min( - remainingRelativeVHFromClick, - this.maxContentHeight, + const deltaY = -(event.clientY - this.startHandlerY); + const remainingContentHeight = + this.startContentHeight + this.pxToVh(deltaY); + const adjustedContentHeight = Math.min( + remainingContentHeight, + this.contentHeightMax, ); - this.contentHeight = adjustedcontentHeight; + this.contentHeight = adjustedContentHeight; } }, stopResizing() { this.isResizing = false; }, + + resizeHeightWithTransition(height) { + this.resizeTransition = 'height ease-in-out 0.3s'; + this.contentHeight = height; + }, }, watch: { From 8fc1763f09596f2a4acdf5d8b923baa68f552139 Mon Sep 17 00:00:00 2001 From: aldemylla Date: Wed, 10 Apr 2024 12:16:46 -0300 Subject: [PATCH 10/12] fix: Adjusted the align end of content, adding the flex direction column reverse --- src/components/insights/ResizableBar/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/insights/ResizableBar/index.vue b/src/components/insights/ResizableBar/index.vue index c98ce120..4f2ef55a 100644 --- a/src/components/insights/ResizableBar/index.vue +++ b/src/components/insights/ResizableBar/index.vue @@ -26,8 +26,9 @@ }" >
- + +
@@ -201,7 +202,8 @@ $insightsLayoutPadding: ($unnnic-spacing-sm * 2); .content__section { overflow: auto; - display: grid; + display: flex; + flex-direction: column-reverse; gap: $unnnic-spacing-xl; } From 01ac13942c1f40924ddb033ea82908efaf989628 Mon Sep 17 00:00:00 2001 From: aldemylla Date: Wed, 10 Apr 2024 15:36:15 -0300 Subject: [PATCH 11/12] feat: Standard height of the ResizableBar to refer to the first prompt suggestion and close automatically if the height is close to the end --- .../ResizableBar/ResizableBarCards.vue | 192 ++---------------- .../ResizableBar/ResizableBarDoris.vue | 39 ++++ .../ResizableBarPromptsSuggestions.vue | 124 +++++++++++ .../insights/ResizableBar/index.vue | 109 +++++++++- 4 files changed, 278 insertions(+), 186 deletions(-) create mode 100644 src/components/insights/ResizableBar/ResizableBarDoris.vue create mode 100644 src/components/insights/ResizableBar/ResizableBarPromptsSuggestions.vue diff --git a/src/components/insights/ResizableBar/ResizableBarCards.vue b/src/components/insights/ResizableBar/ResizableBarCards.vue index f5f3f693..105458dc 100644 --- a/src/components/insights/ResizableBar/ResizableBarCards.vue +++ b/src/components/insights/ResizableBar/ResizableBarCards.vue @@ -1,118 +1,29 @@ + + diff --git a/src/components/insights/ResizableBar/ResizableBarPromptsSuggestions.vue b/src/components/insights/ResizableBar/ResizableBarPromptsSuggestions.vue new file mode 100644 index 00000000..6feb154d --- /dev/null +++ b/src/components/insights/ResizableBar/ResizableBarPromptsSuggestions.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/src/components/insights/ResizableBar/index.vue b/src/components/insights/ResizableBar/index.vue index 4f2ef55a..e815fb74 100644 --- a/src/components/insights/ResizableBar/index.vue +++ b/src/components/insights/ResizableBar/index.vue @@ -1,8 +1,12 @@ @@ -38,10 +52,18 @@ + + + + + + diff --git a/src/views/dashboards/Home/index.vue b/src/views/dashboards/Home/index.vue index 8c8f81fc..1268aa97 100644 --- a/src/views/dashboards/Home/index.vue +++ b/src/views/dashboards/Home/index.vue @@ -1,54 +1,51 @@