mirror of
https://github.com/Mabbs/mabbs.github.io
synced 2025-07-20 08:12:02 +00:00
Update 3 files
- /Live2dHistoire/live2d/js/message.js - /Live2dHistoire/live2d/css/live2d.css - /_layouts/default.html
This commit is contained in:
parent
0e065bf282
commit
85aa965218
@ -79,7 +79,7 @@
|
|||||||
background-color: rgba(74, 59, 114,0.9);
|
background-color: rgba(74, 59, 114,0.9);
|
||||||
}
|
}
|
||||||
.live_talk_input_name_body{
|
.live_talk_input_name_body{
|
||||||
width:70px;
|
width:100px;
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
height:24px;
|
height:24px;
|
||||||
border: 2px solid rgb(223, 179, 241);
|
border: 2px solid rgb(223, 179, 241);
|
||||||
|
@ -189,13 +189,17 @@ if(!norunFlag){
|
|||||||
//console.log('showMessage', text);
|
//console.log('showMessage', text);
|
||||||
$('.message').stop();
|
$('.message').stop();
|
||||||
if(text instanceof EventSource){
|
if(text instanceof EventSource){
|
||||||
var outputContainer = $('.message')[0]
|
var outputContainer = $('.message')[0];
|
||||||
outputContainer.textContent = "";
|
var eventFlag = false;
|
||||||
text.onmessage = (event) => {
|
text.onmessage = (event) => {
|
||||||
if (event.data == "[DONE]") {
|
if (event.data == "[DONE]") {
|
||||||
text.close();
|
text.close();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
if(!eventFlag){
|
||||||
|
outputContainer.textContent = "";
|
||||||
|
eventFlag = true;
|
||||||
|
}
|
||||||
const data = JSON.parse(event.data);
|
const data = JSON.parse(event.data);
|
||||||
outputContainer.textContent += data.response;
|
outputContainer.textContent += data.response;
|
||||||
}
|
}
|
||||||
@ -290,6 +294,10 @@ if(!norunFlag){
|
|||||||
$('#talk_send').on('click',function(){
|
$('#talk_send').on('click',function(){
|
||||||
var info_ = $('#AIuserText').val();
|
var info_ = $('#AIuserText').val();
|
||||||
// var userid_ = $('#AIuserName').val();
|
// var userid_ = $('#AIuserName').val();
|
||||||
|
let add_id = "";
|
||||||
|
if($('#load_this').prop("checked")){
|
||||||
|
add_id = "&id="+encodeURIComponent($('#post_id').val());
|
||||||
|
}
|
||||||
if(info_ == "" ){
|
if(info_ == "" ){
|
||||||
showMessage('写点什么吧!',0);
|
showMessage('写点什么吧!',0);
|
||||||
return;
|
return;
|
||||||
@ -299,7 +307,7 @@ if(!norunFlag){
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
showMessage('思考中~', 0);
|
showMessage('思考中~', 0);
|
||||||
const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_));
|
const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id);
|
||||||
showMessage(evSource);
|
showMessage(evSource);
|
||||||
// $.ajax({
|
// $.ajax({
|
||||||
// type: 'POST',
|
// type: 'POST',
|
||||||
@ -395,11 +403,11 @@ if(!norunFlag){
|
|||||||
showMessage('音乐似乎加载不出来了呢!',0);
|
showMessage('音乐似乎加载不出来了呢!',0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//获取用户名
|
// //获取用户名
|
||||||
var live2dUser = sessionStorage.getItem("live2duser");
|
// var live2dUser = sessionStorage.getItem("live2duser");
|
||||||
if(live2dUser !== null){
|
// if(live2dUser !== null){
|
||||||
$('#AIuserName').val(live2dUser);
|
// $('#AIuserName').val(live2dUser);
|
||||||
}
|
// }
|
||||||
//获取位置
|
//获取位置
|
||||||
var landL = sessionStorage.getItem("historywidth");
|
var landL = sessionStorage.getItem("historywidth");
|
||||||
var landB = sessionStorage.getItem("historyheight");
|
var landB = sessionStorage.getItem("historyheight");
|
||||||
|
@ -112,8 +112,12 @@
|
|||||||
<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" style="display:none;">
|
<div class="live_talk_input_name_body" {% unless page.layout == "post" %}style="display:none;"{% endif %}>
|
||||||
<input name="name" type="hidden" class="live_talk_name white_input" id="AIuserName" value="Mayx_Blog_Talk" />
|
<input name="name" type="checkbox" id="load_this">
|
||||||
|
<input type="hidden" id="post_id" value="{{ page.url }}">
|
||||||
|
<label for="load_this">
|
||||||
|
<span style="font-size: 11px; color: #fff;"> 想问这篇文章</span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="live_talk_input_text_body">
|
<div class="live_talk_input_text_body">
|
||||||
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?"/>
|
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user