Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliza #18

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5cdcd52
Adding chat demo WIP.
zoltan-dulac Sep 19, 2022
274b227
Adding Eliza to the codebase and setting up the sample page.
zoltan-dulac Sep 19, 2022
2ed33a4
Added Eliza into its own Enable page (WIP)
zoltan-dulac Sep 20, 2022
00dcb3f
Updates from main
zoltan-dulac Feb 1, 2023
19ff491
Merge branch 'main' of github.com:PublicisSapient/enable-a11y into eliza
zoltan-dulac Feb 27, 2023
72aef41
Removing orig files.
zoltan-dulac Feb 27, 2023
247efd6
Adding buttons for responses (WIP)
zoltan-dulac Mar 8, 2023
92dc22b
Merge branch 'main' into eliza
EleazarVillarreal Jul 11, 2024
d308065
Merge branch 'main' into eliza
EleazarVillarreal Jul 19, 2024
a677325
Merge branch 'main' into eliza
EleazarVillarreal Jul 19, 2024
081bde6
Merge branch 'main' into eliza
EleazarVillarreal Jul 23, 2024
6408059
Merge branch 'main' into eliza
EleazarVillarreal Jul 29, 2024
88eb7f1
fix duplicate id error
Jul 29, 2024
110ea30
Merge branch 'main' into eliza
EleazarVillarreal Aug 8, 2024
d58ac94
New UI for chatbot
Aug 13, 2024
1b0d22c
test
EleazarVillarreal Aug 13, 2024
f0ef908
Basic chat response functionality.
EleazarVillarreal Aug 13, 2024
71779d9
Fix alt attribute error on img element.
EleazarVillarreal Aug 13, 2024
7c4fc11
Fixed screen reader issues with the open/close chat dialogue button.
EleazarVillarreal Aug 14, 2024
5901c48
Fixed chat form accessibility issues.
EleazarVillarreal Aug 14, 2024
d612ece
Fixed p tag in button erorr.
EleazarVillarreal Aug 14, 2024
7c3ef51
Made chat dialogue an aria-live region and tabbable.
EleazarVillarreal Aug 14, 2024
2f19ce5
Merge branch 'main' into eliza
zoltan-dulac Aug 15, 2024
910a3eb
Merge branch 'main' into eliza
EleazarVillarreal Aug 20, 2024
b9f58fb
New changed files on npm start
EleazarVillarreal Aug 22, 2024
d87ca67
Added additional screen reader announcements for chatbot interactions
EleazarVillarreal Aug 22, 2024
222c55f
Merge branch 'main' into eliza
EleazarVillarreal Aug 27, 2024
966a8bd
Merge branch 'main' into eliza
EleazarVillarreal Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding buttons for responses (WIP)
zoltan-dulac committed Mar 8, 2023
commit 247efd69df33df20a222faad939214aaff131d09
4 changes: 4 additions & 0 deletions content/body/chat.php
Original file line number Diff line number Diff line change
@@ -63,4 +63,8 @@
<template id="screen-reader-message-template">
<div>${user}: ${message}</div>
</template>

<template id="button-template">
<button class="eliza__response-button">${label}</button>
</template>
</div>
34 changes: 32 additions & 2 deletions js/enable-libs/eliza/js/actions.js
Original file line number Diff line number Diff line change
@@ -127,10 +127,17 @@ const elizaActions = new function () {
for (var i = 0; i < chatHistory.length; i++) {

var currentMessage = chatHistory[i];
// console.log("loop");
console.log("ping", currentMessage);

if (currentMessage.isEliza) {
html = getElizaMessageHTML(currentMessage.content);
const {content, buttons} = currentMessage;
let buttonHTML = '';

if (buttons && buttons.length && buttons.length > 0) {
buttonHTML = getButtonHTML(buttons);
}
console.log('content', currentMessage.content)
html = getElizaMessageHTML(currentMessage.content) + buttonHTML;
srAnnouncement = getMessageAlert('Eliza', currentMessage.content);
} else {
html = getUserMessageHTML(currentMessage.content);
@@ -175,6 +182,29 @@ const elizaActions = new function () {
);
}

function getButtonHTML(buttons) {
const r = [];
const length = {buttons};



for (let i=0; i<length; i++) {
r.push(
interpolate(
buttonTemplate,
{
label: buttons[i]
}
)
);
}
if (length > 0) {
return `<div class="eliza__button-list">${r.join('')}</div>`;
} else {
return '';
}
}

function getMessageAlert(user, message) {
return interpolate(
screenReaderMessageTemplate,
7 changes: 6 additions & 1 deletion js/enable-libs/eliza/js/eliza.js
Original file line number Diff line number Diff line change
@@ -51,7 +51,12 @@ const eliza = new function () {
},
"no": {
"weight": 1,
"responses": ["Why not?", "Are you sure? Answers: <button>Yes</button>, <button>No</button>"]
"responses": ["Why not?", "Are you sure?"]
},
"agent": {
"weight": 1,
"responses": ["Okay. Does this have to do with the quality of therapy you are receiving from me?"],
"buttons": ["Yes", "No", "I'd rather not say."]
},
"i am": {
"weight": 1,