File tree Expand file tree Collapse file tree 3 files changed +6
-17
lines changed
Expand file tree Collapse file tree 3 files changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -67,28 +67,15 @@ public static function get_block_content($args) {
6767 }
6868 $ assistantname = format_string ($ assistantname , true , ['context ' => $ context ]);
6969 $ username = format_string ($ username , true , ['context ' => $ context ]);
70- $ content = new \stdClass ;
71- $ content ->text = '
72- <script>
73- var assistantName = " ' . $ assistantname . '";
74- var userName = " ' . $ username . '";
75- </script>
76-
77- <style>
78- ' . $ showlabelscss . '
79- .openai_message.user:before {
80- content: " ' . $ username . '";
81- }
82- .openai_message.bot:before {
83- content: " ' . $ assistantname . '";
84- }
85- </style> ' ;
8670
8771 $ contextdata = [
8872 'logging_enabled ' => get_config ('block_openai_chat ' , 'logging ' ),
8973 'pix_popout ' => '/blocks/openai_chat/pix/arrow-up-right-from-square.svg ' ,
9074 'pix_arrow_right ' => '/blocks/openai_chat/pix/arrow-right.svg ' ,
9175 'pix_refresh ' => '/blocks/openai_chat/pix/refresh.svg ' ,
76+ 'username ' => $ username ,
77+ 'assistantname ' => $ assistantname ,
78+ 'showlabelscss ' => $ showlabelscss ,
9279 'contextid ' => $ context ->id ,
9380 ];
9481
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ this.update_history = function(msg) {
2424 let container = document . querySelector ( '#openai_chat_log' ) ;
2525 container . scrollTop = lq . offsetTop ;
2626 }
27- let newHtml = '<div class="openai_message bot"><span><p>' + msg + '</p></span></div>' ;
27+ let assistantname = document . getElementById ( 'openai_assistantname' ) ;
28+ let newHtml = '<span style="color: gray; margin-bottom: .2em">' + assistantname . innerHTML + '</span><div class="openai_message bot"><span><p>' + msg + '</p></span></div>' ;
2829
2930 document . querySelector ( '.chat-loading' ) . remove ( ) ;
3031 document . getElementById ( 'openai_chat_log' ) . insertAdjacentHTML ( 'beforeend' , newHtml ) ;
Original file line number Diff line number Diff line change 5050 <img style =" transform : scale (1.3 )" src =" <%config.wwwroot%><% pix_refresh %>" class =' openai_input_refresh_btn_icon' alt =" <%#str%>new_chat, block_openai_chat <%/str%>" />
5151 </ion-button >
5252</div >
53+ <span style =" display : none " id =" openai_assistantname" ><% assistantname %></span >
5354</div >
You can’t perform that action at this time.
0 commit comments