Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tend into feature/wenigpt
  • Loading branch information
luishsf committed Dec 21, 2023
2 parents 385bf7c + 9e7a5a2 commit 2c34604
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 89 deletions.
71 changes: 8 additions & 63 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,77 +1,22 @@
FROM node:12-alpine as builder

ENV WORKDIR /home/app
WORKDIR $WORKDIR
WORKDIR /app

RUN apk update && apk add git yarn
RUN apk add --no-cache git

COPY package.json .
COPY yarn.lock .

RUN yarn install --network-timeout 1000000
COPY package.json yarn.lock .
RUN yarn install

COPY . .

ARG VUE_APP_API_BASE_URL
ARG VUE_APP_BOTHUB_NLP_BASE_URL
ARG VUE_APP_BOTHUB_WEBAPP_BASE_URL
ARG VUE_APP_SUPPORTED_LANGUAGES
ARG VUE_APP_MAILCHIMP_LOGIN
ARG VUE_APP_MAILCHIMP_DATACENTER
ARG VUE_APP_MAILCHIMP_USER_ID
ARG VUE_APP_MAILCHIMP_LIST_ID
ARG VUE_APP_VERSION_ENABLED
ARG VUE_APP_BOTHUB_WEBAPP_USE_SENTRY
ARG VUE_APP_BOTHUB_WEBAPP_SENTRY
ARG VUE_APP_BOTHUB_WEBAPP_USE_HOTJAR
ARG VUE_APP_BOTHUB_WEBAPP_HOTJAR_ID
ARG VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_KEY
ARG VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_ALGORITHM_ARTICLE_ID
ARG VUE_APP_BOTHUB_WEBAPP_PAYMENT_ENABLED
ARG VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED
ARG VUE_APP_HELPHERO_ID
ARG VUE_APP_HELPHERO_TOUR
ARG VUE_APP_QA_FLOW_CHANNEL
ARG VUE_APP_LOGROCKET_ID
ARG VUE_APP_LOGROCKET_PARENT_DOMAIN
ARG SENTRY_ENVIRONMENT

ENV VUE_APP_API_BASE_URL "${VUE_APP_API_BASE_URL}"
ENV VUE_APP_BOTHUB_NLP_BASE_URL "${VUE_APP_BOTHUB_NLP_BASE_URL}"
ENV VUE_APP_BOTHUB_WEBAPP_BASE_URL "${VUE_APP_BOTHUB_WEBAPP_BASE_URL}"
ENV VUE_APP_SUPPORTED_LANGUAGES "${VUE_APP_SUPPORTED_LANGUAGES}"
ENV VUE_APP_MAILCHIMP_LOGIN "${VUE_APP_MAILCHIMP_LOGIN}"
ENV VUE_APP_MAILCHIMP_DATACENTER "${VUE_APP_MAILCHIMP_DATACENTER}"
ENV VUE_APP_MAILCHIMP_USER_ID "${VUE_APP_MAILCHIMP_USER_ID}"
ENV VUE_APP_MAILCHIMP_LIST_ID "${VUE_APP_MAILCHIMP_LIST_ID}"
ENV VUE_APP_VERSION_ENABLED "${VUE_APP_VERSION_ENABLED}"
ENV VUE_APP_BOTHUB_WEBAPP_USE_SENTRY "${VUE_APP_BOTHUB_WEBAPP_USE_SENTRY}"
ENV VUE_APP_BOTHUB_WEBAPP_SENTRY "${VUE_APP_BOTHUB_WEBAPP_SENTRY}"
ENV VUE_APP_BOTHUB_WEBAPP_USE_HOTJAR "${VUE_APP_BOTHUB_WEBAPP_USE_HOTJAR}"
ENV VUE_APP_BOTHUB_WEBAPP_HOTJAR_ID "${VUE_APP_BOTHUB_WEBAPP_HOTJAR_ID}"
ENV VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_KEY "${VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_KEY}"
ENV VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_ALGORITHM_ARTICLE_ID "${VUE_APP_BOTHUB_WEBAPP_LIGHTHOUSE_ALGORITHM_ARTICLE_ID}"
ENV VUE_APP_BOTHUB_WEBAPP_PAYMENT_ENABLED "${VUE_APP_BOTHUB_WEBAPP_PAYMENT_ENABLED}"
ENV VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED "${VUE_APP_BOTHUB_WEBAPP_TUTORIAL_ENABLED}"
ENV VUE_APP_HELPHERO_ID "${VUE_APP_HELPHERO_ID}"
ENV VUE_APP_HELPHERO_TOUR "${VUE_APP_HELPHERO_TOUR}"
ENV VUE_APP_QA_FLOW_CHANNEL "${VUE_APP_QA_FLOW_CHANNEL}"
ENV VUE_APP_LOGROCKET_ID "${VUE_APP_LOGROCKET_ID}"
ENV VUE_APP_LOGROCKET_PARENT_DOMAIN "${VUE_APP_LOGROCKET_PARENT_DOMAIN}"
ENV SENTRY_ENVIRONMENT "${SENTRY_ENVIRONMENT}"

RUN yarn build

FROM nginx

COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /home/app/dist /usr/share/nginx/html/bothub-webapp
FROM nginxinc/nginx-unprivileged:1.25

COPY --chown=nginx:root nginx.conf /etc/nginx/nginx.conf
COPY --from=builder --chown=nginx:nginx /app/dist /app/config.js.tmpl /usr/share/nginx/html/bothub-webapp
COPY docker-entrypoint.sh /

EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]

CMD ["nginx", "-g", "daemon off;"]

COPY config.js.tmpl /usr/share/nginx/html/bothub-webapp/

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
build:
context: .
dockerfile: Dockerfile
args:
environment:
- VUE_APP_API_BASE_URL=${VUE_APP_API_BASE_URL:-http://localhost:8000}
- VUE_APP_BOTHUB_NLP_BASE_URL=${VUE_APP_BOTHUB_NLP_BASE_URL:-http://localhost:2657/}
- VUE_APP_BOTHUB_WEBAPP_BASE_URL=${VUE_APP_BOTHUB_WEBAPP_BASE_URL:-http://localhost:8080/}
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if [ ! -f /usr/share/nginx/html/bothub-webapp/config.js ] ; then
envsubst < /usr/share/nginx/html/bothub-webapp/config.js.tmpl > /usr/share/nginx/html/bothub-webapp/config.js
fi

exec "$@"
exec "$@"
17 changes: 11 additions & 6 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
error_log /dev/stdout warn;
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}

http {
proxy_temp_path /tmp/proxy_temp;
client_body_temp_path /tmp/client_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

include /etc/nginx/mime.types;
default_type application/octet-stream;
charset UTF-8;
sendfile on;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
access_log /dev/stdout main;

server {
listen 80;
listen 8080;
server_name localhost;
client_max_body_size 32m;

Expand All @@ -44,4 +49,4 @@ http {
root /var/lib/nginx/html;
}
}
}
}
52 changes: 34 additions & 18 deletions src/views/repository/content/BasesForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@
</template>

<script>
import { get } from 'lodash';
import RepositoryViewBase from '@/components/repository/RepositoryViewBase';
import RepositoryBase from '../Base';
import { mapActions } from 'vuex';
import { LANGUAGES } from '@/utils/index';
import router from '@/router/index';
import Tests from './Tests';
import { unnnicCallAlert } from '@weni/unnnic-system';
export default {
name: 'RepositoryBaseEdit',
Expand Down Expand Up @@ -135,6 +137,11 @@ export default {
'updateQAText',
'editQAKnowledgeBase'
]),
alertError(title) {
unnnicCallAlert({ props: { title, scheme: 'feedback-red', icon: 'alert-circle-1', }, seconds: 5 });
},
onTitleChange(event) {
this.knowledgeBase.title = event.srcElement.textContent;
},
Expand Down Expand Up @@ -173,32 +180,41 @@ export default {
language: this.knowledgeBase.text.language
};
this.submitting = true;
const responseEditKnowledgeBase = await this.editQAKnowledgeBase({
repositoryUUID: this.repositoryUUID,
id: this.$route.params.id,
title: this.knowledgeBase.title
});
try {
this.submitting = true;
this.knowledgeBase.oldTitle = responseEditKnowledgeBase.data.title;
const responseEditKnowledgeBase = await this.editQAKnowledgeBase({
repositoryUUID: this.repositoryUUID,
id: this.$route.params.id,
title: this.knowledgeBase.title
});
if (data.text) {
const action = data.id ? this.updateQAText : this.createQAText;
this.knowledgeBase.oldTitle = responseEditKnowledgeBase.data.title;
const responseText = await action(data);
if (data.text) {
const action = data.id ? this.updateQAText : this.createQAText;
if (!this.knowledgeBase.text.id) {
this.knowledgeBase.text.id = responseText.data.id;
}
const responseText = await action(data);
if (!this.knowledgeBase.text.id) {
this.knowledgeBase.text.id = responseText.data.id;
}
this.knowledgeBase.text.oldValue = responseText.data.text;
this.knowledgeBase.text.oldLanguage = responseText.data.language;
this.knowledgeBase.text.lastUpdate = responseText.data.last_update;
this.knowledgeBase.text.oldValue = responseText.data.text;
this.knowledgeBase.text.oldLanguage = responseText.data.language;
this.knowledgeBase.text.lastUpdate = responseText.data.last_update;
}
this.isAlertOpen = true;
}
} catch (error) {
const errorMessage = get(error, 'response.data.text.0', '');
this.submitting = false;
if (errorMessage) {
this.alertError(errorMessage);
}
} finally {
this.submitting = false;
}
},
discardUpdate() {
this.openModal = false;
Expand Down

0 comments on commit 2c34604

Please sign in to comment.