Skip to content
Snippets Groups Projects
Commit 28f3b1f4 authored by Konrad Völkel's avatar Konrad Völkel
Browse files

stylistic changes

parent efbc330e
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,6 @@ inputElement.addEventListener('input', function (event) { ...@@ -90,7 +90,6 @@ inputElement.addEventListener('input', function (event) {
window.focus(); window.focus();
/** open the answer field in chat view for selected panel */ /** open the answer field in chat view for selected panel */
console.log("inside", output.question);
resultLink.onclick = function () { resultLink.onclick = function () {
linkAndClick(output.question); linkAndClick(output.question);
}; };
......
...@@ -15,22 +15,25 @@ export function submitFeedback(query, bestAnswers, feedback) { ...@@ -15,22 +15,25 @@ export function submitFeedback(query, bestAnswers, feedback) {
.join("\n\n"); .join("\n\n");
if (feedback === 'up') { if (feedback === 'good') {
subject = 'Positive Feedback: FAQ Search Feature'; subject = 'Positive Feedback: FAQ Search Feature';
message = `Hello, message = `Hello,
\nI used your FAQ search feature and was pleased with the result. \nI used your FAQ search feature and was pleased with the result.
\nI also have some additional suggestions: ... \nI also have some additional suggestions: ...
\nBest Tokens:\n\n${bestAnswersAsString}\nFeedback: ${feedback}\nTimestamp: ${timestamp}\nQuery: ${query} \nDetails below:
\nYou asked: ${query}
\nMost fitting responses:\n\n${bestAnswersAsString}\nFeedback: ${feedback}\nTimestamp: ${timestamp}
\nKeep it up! \nKeep it up!
\nBest regards`; \nBest regards`;
} else if (feedback === 'down') { } else if (feedback === 'bad') {
subject = 'Negative Feedback: FAQ Search Feature'; subject = 'Negative Feedback: FAQ Search Feature';
message = `Hello, message = `Hello,
\nI tried used FAQ search feature, and unfortunately, I was not satisfied with this result. \nI tried used FAQ search feature, and unfortunately, I was not satisfied with this result.
\nI also have some additional suggestions: ... \nI also have some additional suggestions: ...
Detail below: \nDetails below:
\nBest Tokens: ${bestAnswersAsString}\nFeedback: ${feedback}\nTimestamp: ${timestamp}\nQuery: ${query} \nYou asked: ${query}
\nMost fitting responses: ${bestAnswersAsString}\nFeedback: ${feedback}\nTimestamp: ${timestamp}
\nI hope this feedback lets you improve the experience. \nI hope this feedback lets you improve the experience.
\nBest regards`; \nBest regards`;
} }
......
...@@ -15,7 +15,6 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n ...@@ -15,7 +15,6 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n
messageContainer.className = 'bot-message-container'; messageContainer.className = 'bot-message-container';
const numberBox = document.createElement('div'); const numberBox = document.createElement('div');
numberBox.textContent = "⦿";
numberBox.className = 'number-box'; numberBox.className = 'number-box';
const messageDiv = document.createElement('div'); const messageDiv = document.createElement('div');
...@@ -23,14 +22,15 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n ...@@ -23,14 +22,15 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n
messageDiv.className = className; messageDiv.className = className;
const panelDiv = document.createElement('div'); const panelDiv = document.createElement('div');
panelDiv.textContent = ''; panelDiv.innerHTML = '<i class="fa-solid fa-down-long"></i>';
panelDiv.className = 'info-panel'; panelDiv.className = 'info-panel';
panelDiv.setAttribute('data-question', encodeURIComponent(content)); panelDiv.setAttribute('data-question', encodeURIComponent(content));
messageDiv.onclick = function () { messageDiv.onclick = function(event) {
copyToClipboard(content); event.stopPropagation();
}; panelDiv.click();
}
panelDiv.onclick = function (event) { panelDiv.onclick = function (event) {
...@@ -39,9 +39,12 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n ...@@ -39,9 +39,12 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n
let nextElem = messageContainer.nextElementSibling; let nextElem = messageContainer.nextElementSibling;
if (nextElem && nextElem.classList.contains('answer-container')) { if (nextElem && nextElem.classList.contains('answer-container')) {
nextElem.remove(); nextElem.remove();
panelDiv.innerHTML = '<i class="fa-solid fa-down-long"></i>';
panelDiv.classList.remove('active'); panelDiv.classList.remove('active');
return; return;
} }
panelDiv.innerHTML = '<i class="fa-solid fa-up-long"></i>';
let highlightToken = answer.replace(bestToken, `<span class="highlight">${bestToken}</span>`); let highlightToken = answer.replace(bestToken, `<span class="highlight">${bestToken}</span>`);
...@@ -52,6 +55,10 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n ...@@ -52,6 +55,10 @@ export function appendMessage(content, className, linkId = null, akkordeonId = n
messageContainer.parentNode.insertBefore(answerContainer, messageContainer.nextSibling); messageContainer.parentNode.insertBefore(answerContainer, messageContainer.nextSibling);
panelDiv.classList.add('active'); panelDiv.classList.add('active');
setTimeout(() => {
answerContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
}, 250);
} }
...@@ -99,48 +106,6 @@ export function sendMessage(worker) { ...@@ -99,48 +106,6 @@ export function sendMessage(worker) {
} }
} }
window.copyToClipboard = copyToClipboard;
export function copyToClipboard(text) {
window.navigator.clipboard.writeText(text)
.then(() => {
copySuccsess();
})
}
/** show user that clipboard action was successful */
let currentConfirm = null;
let showTimeoutId = null;
let hideTimeoutId = null;
let removeTimeoutId = null;
function copySuccsess() {
if (currentConfirm) {
clearTimeout(showTimeoutId);
clearTimeout(hideTimeoutId);
clearTimeout(removeTimeoutId);
currentConfirm.remove();
}
currentConfirm = document.createElement('div');
currentConfirm.innerText = 'Question copied to clipboard!';
currentConfirm.classList.add('confirm');
document.body.appendChild(currentConfirm);
showTimeoutId = setTimeout(() => {
currentConfirm.classList.add('visible');
}, 10);
hideTimeoutId = setTimeout(() => {
currentConfirm.classList.remove('visible');
removeTimeoutId = setTimeout(() => {
currentConfirm.remove();
currentConfirm = null;
}, 500);
}, 2000);
}
/** new feedback buttons with font-awesome style */ /** new feedback buttons with font-awesome style */
export function drawFeedbackButtons(query, bestTokens) { export function drawFeedbackButtons(query, bestTokens) {
...@@ -155,7 +120,7 @@ export function drawFeedbackButtons(query, bestTokens) { ...@@ -155,7 +120,7 @@ export function drawFeedbackButtons(query, bestTokens) {
plusButton.innerHTML = '<i class="fa-solid fa-thumbs-up"></i>'; plusButton.innerHTML = '<i class="fa-solid fa-thumbs-up"></i>';
plusButton.className = 'feedback-button thumbs-up'; plusButton.className = 'feedback-button thumbs-up';
plusButton.onclick = function () { plusButton.onclick = function () {
submitFeedback(query, bestTokens, 'up'); submitFeedback(query, bestTokens, 'good');
}; };
...@@ -164,7 +129,7 @@ export function drawFeedbackButtons(query, bestTokens) { ...@@ -164,7 +129,7 @@ export function drawFeedbackButtons(query, bestTokens) {
minusButton.className = 'feedback-button thumbs-down'; minusButton.className = 'feedback-button thumbs-down';
minusButton.onclick = function () { minusButton.onclick = function () {
submitFeedback(query, bestTokens, 'down'); submitFeedback(query, bestTokens, 'bad');
}; };
feedbackContainer.appendChild(plusButton); feedbackContainer.appendChild(plusButton);
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
align-self: flex-start; align-self: flex-start;
background-color: #003865; background-color: #003865;
color: white; color: white;
margin-left: 52px; margin-left: 40px;
margin: 10px 2; margin: 10px 2;
max-width: 60%; max-width: 60%;
word-wrap: break-word; word-wrap: break-word;
...@@ -175,7 +175,6 @@ ...@@ -175,7 +175,6 @@
display: flex; display: flex;
align-items: stretch; align-items: stretch;
} }
.bot-message:hover { .bot-message:hover {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment