Skip to content

Commit dea3f13

Browse files
committed
ensure students can send message during sync chat
1 parent 06b5b8d commit dea3f13

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

  • bases/rsptx/web2py_server/applications/runestone/static/js

bases/rsptx/web2py_server/applications/runestone/static/js/peer.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Configuration for the PI steps and helper functions to handle step progression in the instructor's interface
2+
console.log("PEER JS VERSION TEST 12345");
23
const STEP_CONFIG = {
34
vote1: {
45
next: ['makep', 'facechat', 'makeabgroups'],
@@ -485,15 +486,17 @@ async function sendMessage(event) {
485486
input.value = "";
486487
input.focus();
487488

488-
// Disable the send button after sending a message
489-
sendButton.classList.add("disabled");
490-
llmMessageCount += 1;
491-
console.log("LLM message count:", llmMessageCount);
489+
// Only apply LLM restrictions in async mode
490+
if (window.PI_LLM_MODE === true) {
491+
sendButton.classList.add("disabled");
492+
llmMessageCount += 1;
493+
console.log("LLM message count:", llmMessageCount);
492494

493-
if (llmMessageCount >= REQUIRED_LLM_MESSAGES) {
494-
const btn = document.getElementById("readyVote2Btn");
495-
if (btn) {
496-
btn.style.display = "inline-block";
495+
if (llmMessageCount >= REQUIRED_LLM_MESSAGES) {
496+
const btn = document.getElementById("readyVote2Btn");
497+
if (btn) {
498+
btn.style.display = "inline-block";
499+
}
497500
}
498501
}
499502
}
@@ -857,6 +860,11 @@ function insertReadyVote2Button() {
857860

858861
if (!container) return;
859862

863+
const btn = document.createElement("button");
864+
btn.id = "readyVote2Btn";
865+
btn.className = "btn btn-info";
866+
btn.style.display = "none";
867+
btn.innerText = "Ready for Vote 2";
860868

861869
btn.addEventListener("click", enableSecondVoteAsync);
862870

@@ -868,11 +876,16 @@ $(function () {
868876

869877
let tinput = document.getElementById("messageText");
870878
let sendButton = document.getElementById("sendpeermsg");
871-
if (tinput && sendButton) {
879+
if (window.PI_LLM_MODE !== true && sendButton) {
880+
sendButton.classList.remove("disabled");
881+
}
882+
883+
if (tinput && sendButton && window.PI_LLM_MODE === true) {
872884
tinput.addEventListener("input", function () {
873885
let message = this.value.trim();
874-
if (message !== "") {
886+
if (window.PI_LLM_MODE !== true && sendButton) {
875887
sendButton.classList.remove("disabled");
888+
sendButton.disabled = false;
876889
} else {
877890
sendButton.classList.add("disabled");
878891
}

0 commit comments

Comments
 (0)