@5minds/node-red-dashboard-2-processcube-chat 0.1.3-develop-949973-mfeevugh → 0.1.3-develop-7a3c44-mff0zplx
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
data() {
|
|
28
28
|
return {
|
|
29
29
|
conversation: [],
|
|
30
|
+
signals: undefined,
|
|
30
31
|
};
|
|
31
32
|
},
|
|
32
33
|
|
|
@@ -61,9 +62,7 @@ export default {
|
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
64
|
mounted() {
|
|
64
|
-
console.log('mounted');
|
|
65
65
|
this.$socket.on('msg-input:' + this.id, (msg) => {
|
|
66
|
-
console.log(JSON.stringify(msg));
|
|
67
66
|
this.handleNodeREDResponse(msg);
|
|
68
67
|
});
|
|
69
68
|
},
|
|
@@ -73,6 +72,7 @@ export default {
|
|
|
73
72
|
|
|
74
73
|
methods: {
|
|
75
74
|
async handleConnection(body, signals) {
|
|
75
|
+
this.signals = signals;
|
|
76
76
|
try {
|
|
77
77
|
// Extract messages and files from FormData
|
|
78
78
|
let newMessages = [];
|
|
@@ -358,11 +358,17 @@ export default {
|
|
|
358
358
|
role: 'ai',
|
|
359
359
|
});
|
|
360
360
|
} else if (fullResponse.message?.content || fullResponse.content) {
|
|
361
|
-
|
|
362
|
-
this.$refs.deepChat.addMessage({
|
|
361
|
+
const message = {
|
|
363
362
|
text: fullResponse.message?.content || fullResponse.content,
|
|
364
363
|
role: 'ai',
|
|
365
|
-
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// Normal text response
|
|
367
|
+
if (msg.payload.intermediateMessage) {
|
|
368
|
+
this.$refs.deepChat.addMessage(message);
|
|
369
|
+
} else {
|
|
370
|
+
this.signals.onResponse(message);
|
|
371
|
+
}
|
|
366
372
|
}
|
|
367
373
|
} catch (error) {
|
|
368
374
|
console.error('Error handling response:', error);
|
|
@@ -374,7 +380,7 @@ export default {
|
|
|
374
380
|
this.$refs.deepChat.addMessage({
|
|
375
381
|
text: message,
|
|
376
382
|
role: 'ai',
|
|
377
|
-
});
|
|
383
|
+
}, true);
|
|
378
384
|
},
|
|
379
385
|
},
|
|
380
386
|
};
|