Compare commits
2 Commits
e525120a15
...
34c5b35194
Author | SHA1 | Date | |
---|---|---|---|
34c5b35194 | |||
a07c269f15 |
13
main.js
13
main.js
@ -23,6 +23,15 @@ class Conversation {
|
||||
this.messages = initialMessages;
|
||||
}
|
||||
|
||||
addMessage(message) {
|
||||
this.messages.push(message);
|
||||
this.render();
|
||||
|
||||
var elements = document.getElementById("messages").children;
|
||||
var lastElement = elements[elements.length - 1];
|
||||
lastElement.scrollIntoView();
|
||||
}
|
||||
|
||||
// for the user to send their own messages
|
||||
sendUserMessage(text) {
|
||||
|
||||
@ -74,7 +83,7 @@ class Conversation {
|
||||
messageText = json.message;
|
||||
}
|
||||
|
||||
this.messages.push(new AgentMessage(messageText));
|
||||
this.addMessage(new AgentMessage(messageText));
|
||||
this.render();
|
||||
})
|
||||
.catch(error => {
|
||||
@ -91,7 +100,7 @@ class Conversation {
|
||||
// this.render();
|
||||
//}, 5000);
|
||||
}, 1000);
|
||||
this.messages.push(message);
|
||||
this.addMessage(message);
|
||||
}
|
||||
|
||||
// update the current HTML based on messages
|
||||
|
@ -72,6 +72,9 @@ body {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
#main-panel {
|
||||
width: calc(100% - 300px);
|
||||
}
|
||||
}
|
||||
|
||||
#side-panel .conversation {
|
||||
@ -105,7 +108,7 @@ body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
width: calc(100% - 300px);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#page {
|
||||
|
Loading…
x
Reference in New Issue
Block a user