Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 57 additions & 1 deletion public/styles/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ html {

.ai-message {
align-self: flex-start;
background-color: #6FAF9B;
padding: 8px 12px;
border-radius: 12px;
max-width: 90%;
Expand Down Expand Up @@ -1019,3 +1018,60 @@ body.buddy-modal-open {

}

#send{
border-radius: 12px;
background-color: white;
color: black;
animation: page-load 1s ease-out forwards;
}

.my-ai-message{
display: flex;
align-items: start;
}

.user-message{
display: flex;
align-self: end;
background-color: #F4A261;
padding: 8px 12px;
}

.ai-message-content{
display: flex;
background-color: #6FAF9B;
padding: 8px 12px;
}

.ai-icon{
text-align: left;
padding-right: 15px;
width: 5vh;
height: 5vh;

}

.user-message {
align-self: flex-end;
padding: 8px 12px;
border-radius: 12px;
max-width: 80%;
opacity: 100%;
}

.ai-message {
display: flex;
align-items: start;
}

h1 {
font-weight: 600;
margin-bottom: 4px;
}

h3 {
font-weight: 600;
margin-top: 2px;
margin-bottom: 6px;
}

12 changes: 10 additions & 2 deletions views/home.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,16 @@
aiEl.classList.add("message", "ai-message");

const aiElContent = document.createElement("div");
aiElContent.classList.add("message", "ai-message-content");
const aiIcon = document.createElement("img");
aiIcon.src = getBuddySprite(buddyProfile.buddyType, petMood);


aiIcon.classList.add("ai-icon");
aiElContent.classList.add("ai-message", "ai-message-content");

petMessagesDiv.insertBefore(aiEl, petLoadingEl);
aiEl.appendChild(aiIcon);
aiEl.appendChild(aiElContent);

const reader = resp.body.getReader();
const decoder = new TextDecoder("utf-8");
Expand All @@ -425,14 +432,15 @@
aiText += data;
const formatted = formatAiText(aiText);
aiElContent.textContent = formatted;
aiEl.appendChild(aiElContent);
//aiEl.appendChild(aiElContent);
});
}
petLoadingEl.style.visibility = "hidden";
petConversation.push({ role: "assistant", content: aiText });
petMessagesDiv.scrollTop = petMessagesDiv.scrollHeight;
}


petSendBtn.onclick = sendPetMessage;
petPromptInput.onkeydown = (e) => {
if (e.key === "Enter") sendPetMessage();
Expand Down