summaryrefslogtreecommitdiff
path: root/Live2dHistoire/live2d
diff options
context:
space:
mode:
authormayx <mayx@outlook.com>2024-10-21 13:16:17 +0200
committermayx <mayx@outlook.com>2024-10-21 13:16:17 +0200
commit85aa9652185aceeae0f320fe8a4a7248514c49a3 (patch)
tree8dcb6c3eb2e2229b7570f51027554fe826aaa1ea /Live2dHistoire/live2d
parent0e065bf28214b7414d87252c6c53ea2483a36228 (diff)
Update 3 files
- /Live2dHistoire/live2d/js/message.js - /Live2dHistoire/live2d/css/live2d.css - /_layouts/default.html
Diffstat (limited to 'Live2dHistoire/live2d')
-rw-r--r--Live2dHistoire/live2d/css/live2d.css2
-rw-r--r--Live2dHistoire/live2d/js/message.js24
2 files changed, 17 insertions, 9 deletions
diff --git a/Live2dHistoire/live2d/css/live2d.css b/Live2dHistoire/live2d/css/live2d.css
index 3ce12d2..7154b49 100644
--- a/Live2dHistoire/live2d/css/live2d.css
+++ b/Live2dHistoire/live2d/css/live2d.css
@@ -79,7 +79,7 @@
background-color: rgba(74, 59, 114,0.9);
}
.live_talk_input_name_body{
- width:70px;
+ width:100px;
box-sizing:border-box;
height:24px;
border: 2px solid rgb(223, 179, 241);
diff --git a/Live2dHistoire/live2d/js/message.js b/Live2dHistoire/live2d/js/message.js
index 7bffeb5..39a0851 100644
--- a/Live2dHistoire/live2d/js/message.js
+++ b/Live2dHistoire/live2d/js/message.js
@@ -189,13 +189,17 @@ if(!norunFlag){
//console.log('showMessage', text);
$('.message').stop();
if(text instanceof EventSource){
- var outputContainer = $('.message')[0]
- outputContainer.textContent = "";
+ var outputContainer = $('.message')[0];
+ var eventFlag = false;
text.onmessage = (event) => {
if (event.data == "[DONE]") {
text.close();
return;
} else {
+ if(!eventFlag){
+ outputContainer.textContent = "";
+ eventFlag = true;
+ }
const data = JSON.parse(event.data);
outputContainer.textContent += data.response;
}
@@ -290,6 +294,10 @@ if(!norunFlag){
$('#talk_send').on('click',function(){
var info_ = $('#AIuserText').val();
// var userid_ = $('#AIuserName').val();
+ let add_id = "";
+ if($('#load_this').prop("checked")){
+ add_id = "&id="+encodeURIComponent($('#post_id').val());
+ }
if(info_ == "" ){
showMessage('写点什么吧!',0);
return;
@@ -299,7 +307,7 @@ if(!norunFlag){
// return;
// }
showMessage('思考中~', 0);
- const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_));
+ const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id);
showMessage(evSource);
// $.ajax({
// type: 'POST',
@@ -395,11 +403,11 @@ if(!norunFlag){
showMessage('音乐似乎加载不出来了呢!',0);
});
}
- //获取用户名
- var live2dUser = sessionStorage.getItem("live2duser");
- if(live2dUser !== null){
- $('#AIuserName').val(live2dUser);
- }
+ // //获取用户名
+ // var live2dUser = sessionStorage.getItem("live2duser");
+ // if(live2dUser !== null){
+ // $('#AIuserName').val(live2dUser);
+ // }
//获取位置
var landL = sessionStorage.getItem("historywidth");
var landB = sessionStorage.getItem("historyheight");