diff --git a/Dockerfile b/Dockerfile index 72e298e..bc38301 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,14 +49,23 @@ COPY --chmod=644 gswikichat gswikichat COPY --chmod=755 static static COPY --chmod=755 json_input json_input -# # Install node from upstream, ubuntu packages are too old -# RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -# RUN apt-get install -y nodejs && \ -# apt-get clean && \ -# rm -rf /var/lib/apt/lists/* - -# # Install node package manager yarn -# RUN npm install -g yarn + +# Install node from upstream, ubuntu packages are too old +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash + +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash +RUN apt-get install -y nodejs && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN npm cache clean -f +RUN npm install -g n +RUN n 18.17.1 + +# RUN node -v + +# Install node package manager yarn +RUN npm install -g yarn # # Install frontend dependencies and build it for production (into the frontend/dist folder) # RUN cd frontend && yarn install && yarn build diff --git a/frontend/package.json b/frontend/package.json index e3b9e99..58469f1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "vue": "^3.3.11", + "vue-i18n": "9", "vue-router": "^4.2.5" }, "devDependencies": { diff --git a/frontend/src/components/field/FieldAnswer.vue b/frontend/src/components/field/FieldAnswer.vue new file mode 100644 index 0000000..69124b5 --- /dev/null +++ b/frontend/src/components/field/FieldAnswer.vue @@ -0,0 +1,37 @@ + + + diff --git a/frontend/src/components/field/FieldQuestion.vue b/frontend/src/components/field/FieldQuestion.vue new file mode 100644 index 0000000..74093a5 --- /dev/null +++ b/frontend/src/components/field/FieldQuestion.vue @@ -0,0 +1,18 @@ + + + diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 9f91fad..4fdce6c 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,11 +1,36 @@ import './assets/tailwind.css' import { createApp } from 'vue' +import { createI18n } from 'vue-i18n' import App from './App.vue' import router from './router' +const i18n = createI18n({ + locale: window.navigator.language, + fallbackLocale: 'de', + messages: { + en: { + 'chat-prompt': 'Message ChatGSWiki...', + 'check-linked-wiki-pages-notice': + 'Please check the linked source to make sure that the information provided is correct.', + 'no-response-message': + 'Sorry, but no valid response was returned for your question. Please try rephrasing it.', + source: 'Source' + }, + de: { + 'chat-prompt': 'Schreib ChatGSWiki...', + 'check-linked-wiki-pages-notice': + 'Bitte überprüfen Sie die verlinkten Quellen, um sicherzustellen, dass die bereitgestellten Informationen korrekt sind.', + 'no-response-message': + 'Leider wurde auf Ihre Frage keine gültige Antwort zurückgegeben. Bitte versuchen Sie es umzuformulieren.', + source: 'Quelle' + } + } +}) + const app = createApp(App) +app.use(i18n) app.use(router) app.mount('#app') diff --git a/frontend/src/types/response-object.d.ts b/frontend/src/types/response-object.d.ts new file mode 100644 index 0000000..2fc7ffe --- /dev/null +++ b/frontend/src/types/response-object.d.ts @@ -0,0 +1,6 @@ +import type { Source } from './source.js' + +export interface ResponseObject { + answer: string + sources?: Source[] +} diff --git a/frontend/src/types/source.d.ts b/frontend/src/types/source.d.ts new file mode 100644 index 0000000..4e3cd7e --- /dev/null +++ b/frontend/src/types/source.d.ts @@ -0,0 +1,6 @@ +export type Source = { + id: number + src: string + content: string + score: number +} diff --git a/frontend/src/views/ChatView.vue b/frontend/src/views/ChatView.vue index ea3cfbc..58b6043 100644 --- a/frontend/src/views/ChatView.vue +++ b/frontend/src/views/ChatView.vue @@ -1,43 +1,50 @@