|
@@ -73,6 +73,7 @@ const inputText = ref('');
|
|
|
let chatlist = ref([]);
|
|
|
let session_hash = Math.random().toString(36).substring(2);
|
|
|
|
|
|
+let index = 0;
|
|
|
if (!userData.value.UserId) {
|
|
|
chat.value.push(
|
|
|
...[
|
|
@@ -107,23 +108,26 @@ function saveText() {
|
|
|
text: '',
|
|
|
type: 'robot',
|
|
|
});
|
|
|
- const idnex = chatlist.value.length === 0 ? 0 : chatlist.value.length - 1;
|
|
|
const t = inputText.value;
|
|
|
inputText.value = '';
|
|
|
+// index++;
|
|
|
+ if (chatlist.value.length > 3) {
|
|
|
+ chatlist.value.shift();
|
|
|
+ }
|
|
|
createSocket(
|
|
|
ws => {
|
|
|
const data = ws.data || {};
|
|
|
if (data.msg == 'send_hash')
|
|
|
ws.ws.send(
|
|
|
JSON.stringify({
|
|
|
- fn_index: idnex,
|
|
|
+ fn_index: index,
|
|
|
session_hash,
|
|
|
})
|
|
|
);
|
|
|
if (data.msg == 'send_data')
|
|
|
ws.ws.send(
|
|
|
JSON.stringify({
|
|
|
- fn_index: idnex,
|
|
|
+ fn_index: index,
|
|
|
data: [t, chatlist.value, 2048, 0.7, 0.95, null],
|
|
|
event_data: null,
|
|
|
session_hash,
|