mirror of
				https://github.com/Mabbs/mabbs.github.io
				synced 2025-11-04 16:59:13 +08:00 
			
		
		
		
	Update 2 files
- /Live2dHistoire/live2d/js/message.js - /_layouts/default.html
This commit is contained in:
		
							parent
							
								
									d10e960a8d
								
							
						
					
					
						commit
						7ea27ffbda
					
				@ -192,7 +192,7 @@ if (!norunFlag) {
 | 
				
			|||||||
		if (text instanceof EventSource) {
 | 
							if (text instanceof EventSource) {
 | 
				
			||||||
			var outputContainer = $('.message')[0];
 | 
								var outputContainer = $('.message')[0];
 | 
				
			||||||
			var eventFlag = false;
 | 
								var eventFlag = false;
 | 
				
			||||||
			text.onmessage = (event) => {
 | 
								text.onmessage = function(event) {
 | 
				
			||||||
				if (event.data == "[DONE]") {
 | 
									if (event.data == "[DONE]") {
 | 
				
			||||||
					text.close();
 | 
										text.close();
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
@ -202,7 +202,7 @@ if (!norunFlag) {
 | 
				
			|||||||
						outputContainer.textContent = "";
 | 
											outputContainer.textContent = "";
 | 
				
			||||||
						eventFlag = true;
 | 
											eventFlag = true;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					const data = JSON.parse(event.data);
 | 
										var data = JSON.parse(event.data);
 | 
				
			||||||
					outputContainer.textContent += data.response;
 | 
										outputContainer.textContent += data.response;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -272,7 +272,7 @@ if (!norunFlag) {
 | 
				
			|||||||
				$('body').addClass(dataType);
 | 
									$('body').addClass(dataType);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		if (talkAPI !== "") {
 | 
							if (talkAPI !== "" && typeof EventSource !== 'undefined') {
 | 
				
			||||||
			$('#showInfoBtn').on('click', function () {
 | 
								$('#showInfoBtn').on('click', function () {
 | 
				
			||||||
				var live_statu = $('#live_statu_val').val();
 | 
									var live_statu = $('#live_statu_val').val();
 | 
				
			||||||
				if (live_statu == "0") {
 | 
									if (live_statu == "0") {
 | 
				
			||||||
@ -299,7 +299,8 @@ if (!norunFlag) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
			$('#talk_send').on('click', function () {
 | 
								$('#live_talk_input_form').on('submit', function (e) {
 | 
				
			||||||
 | 
									e.preventDefault();
 | 
				
			||||||
				var info_ = $('#AIuserText').val();
 | 
									var info_ = $('#AIuserText').val();
 | 
				
			||||||
				// var userid_ = $('#AIuserName').val();
 | 
									// var userid_ = $('#AIuserName').val();
 | 
				
			||||||
				let add_id = "";
 | 
									let add_id = "";
 | 
				
			||||||
@ -311,8 +312,7 @@ if (!norunFlag) {
 | 
				
			|||||||
					return;
 | 
										return;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				showMessage('思考中~', 0);
 | 
									showMessage('思考中~', 0);
 | 
				
			||||||
				const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id);
 | 
									showMessage(new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id));
 | 
				
			||||||
				showMessage(evSource);
 | 
					 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			$('#showInfoBtn').hide();
 | 
								$('#showInfoBtn').hide();
 | 
				
			||||||
 | 
				
			|||||||
@ -96,17 +96,19 @@
 | 
				
			|||||||
      <div class="message" style="opacity:0"></div>
 | 
					      <div class="message" style="opacity:0"></div>
 | 
				
			||||||
      <canvas id="live2d" width="500" height="560" class="live2d"></canvas>
 | 
					      <canvas id="live2d" width="500" height="560" class="live2d"></canvas>
 | 
				
			||||||
      <div class="live_talk_input_body">
 | 
					      <div class="live_talk_input_body">
 | 
				
			||||||
        <div class="live_talk_input_name_body" {% unless page.layout == "post" %}style="display:none;"{% endunless %}>
 | 
					        <form id="live_talk_input_form">
 | 
				
			||||||
          <input type="checkbox" id="load_this" />
 | 
					          <div class="live_talk_input_name_body" {% unless page.layout == "post" %}style="display:none;"{% endunless %}>
 | 
				
			||||||
          <input type="hidden" id="post_id" value="{{ page.url }}" />
 | 
					            <input type="checkbox" id="load_this" />
 | 
				
			||||||
          <label for="load_this">
 | 
					            <input type="hidden" id="post_id" value="{{ page.url }}" />
 | 
				
			||||||
            <span style="font-size: 11px; color: #fff;"> 想问这篇文章</span>
 | 
					            <label for="load_this">
 | 
				
			||||||
          </label>
 | 
					              <span style="font-size: 11px; color: #fff;"> 想问这篇文章</span>
 | 
				
			||||||
        </div>
 | 
					            </label>
 | 
				
			||||||
        <div class="live_talk_input_text_body">
 | 
					          </div>
 | 
				
			||||||
          <input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
 | 
					          <div class="live_talk_input_text_body">
 | 
				
			||||||
          <button type="button" class="live_talk_send_btn" id="talk_send">发送</button>
 | 
					            <input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
 | 
				
			||||||
        </div>
 | 
					            <button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
 | 
				
			||||||
 | 
					          </div>
 | 
				
			||||||
 | 
					        </form>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      <input name="live_talk" id="live_talk" value="1" type="hidden" />
 | 
					      <input name="live_talk" id="live_talk" value="1" type="hidden" />
 | 
				
			||||||
      <div class="live_ico_box" style="display:none;">
 | 
					      <div class="live_ico_box" style="display:none;">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user