Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hainrich
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Konrad Völkel
hainrich
Commits
28f3b1f4
Commit
28f3b1f4
authored
4 months ago
by
Konrad Völkel
Browse files
Options
Downloads
Patches
Plain Diff
stylistic changes
parent
efbc330e
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
index.js
+0
-1
0 additions, 1 deletion
index.js
modules/feedback.js
+8
-5
8 additions, 5 deletions
modules/feedback.js
modules/ui.js
+14
-49
14 additions, 49 deletions
modules/ui.js
styles.css
+2
-3
2 additions, 3 deletions
styles.css
with
24 additions
and
58 deletions
index.js
+
0
−
1
View file @
28f3b1f4
...
@@ -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
);
};
};
...
...
This diff is collapsed.
Click to expand it.
modules/feedback.js
+
8
−
5
View file @
28f3b1f4
...
@@ -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`
;
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/ui.js
+
14
−
49
View file @
28f3b1f4
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
styles.css
+
2
−
3
View file @
28f3b1f4
...
@@ -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
:
52
px
;
margin-left
:
40
px
;
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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment