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" ) ;
23const 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