From b7cecb2a8be7d19270d411fa0d6b362ad0c1dea7 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Sun, 29 Mar 2026 14:24:13 +0200 Subject: [PATCH] fixed double message the second, fixed no own message from diagnotic to aria --- android/src/screens/ChatScreen.tsx | 18 ++++++++++++++++-- diagnostic/index.html | 8 +++++--- diagnostic/server.js | 9 +++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/android/src/screens/ChatScreen.tsx b/android/src/screens/ChatScreen.tsx index 842e2ea..dffeab2 100644 --- a/android/src/screens/ChatScreen.tsx +++ b/android/src/screens/ChatScreen.tsx @@ -204,8 +204,22 @@ const ChatScreen: React.FC = () => { return; } - // Eigene Nachrichten ignorieren (werden lokal hinzugefuegt) - if (sender === 'user' || sender === 'diagnostic') return; + // Eigene App-Nachrichten ignorieren (werden lokal hinzugefuegt) + if (sender === 'user') return; + + // Diagnostic-Nachrichten als User-Nachricht anzeigen + if (sender === 'diagnostic') { + const diagText = (message.payload.text as string) || ''; + if (diagText) { + setMessages(prev => [...prev, { + id: nextId(), + sender: 'user', + text: diagText, + timestamp: message.timestamp, + }]); + } + return; + } const text = (message.payload.text as string) || ''; const ts = message.timestamp; diff --git a/diagnostic/index.html b/diagnostic/index.html index 52d76c7..7485d89 100644 --- a/diagnostic/index.html +++ b/diagnostic/index.html @@ -217,7 +217,7 @@
- +
@@ -519,7 +519,9 @@ if (msg.type === 'rvs_chat') { const p = msg.msg.payload || {}; const sender = p.sender || '?'; - const chatType = (sender === 'aria') ? 'received' : 'sent'; + // ARIA-Antworten kommen schon via Gateway (chat:final) — nicht nochmal via RVS anzeigen + if (sender === 'aria') return; + const chatType = 'sent'; const label = sender === 'stt' ? '\uD83C\uDFA4 Spracheingabe' : `via RVS (${sender})`; addChat(chatType, p.text || '?', label); return; @@ -997,7 +999,7 @@ // Enter-Taste sendet via Gateway document.getElementById('chat-input').addEventListener('keydown', (e) => { - if (e.key === 'Enter') testGateway(); + if (e.key === 'Enter') testRVS(); }); // Escape schliesst Lightbox diff --git a/diagnostic/server.js b/diagnostic/server.js index 9bce775..0fb1d4e 100644 --- a/diagnostic/server.js +++ b/diagnostic/server.js @@ -412,6 +412,15 @@ function sendToGateway(text, isPipeline) { gatewayWs.send(payload); log("info", "gateway", `chat.send [${reqId}]: "${text}"`); if (isPipeline) plog(`chat.send [${reqId}] an Gateway gesendet — warte auf ACK...`); + + // Nachricht auch an RVS senden damit die App sie sieht + if (rvsWs && rvsWs.readyState === WebSocket.OPEN) { + rvsWs.send(JSON.stringify({ + type: "chat", + payload: { text, sender: "diagnostic" }, + timestamp: Date.now(), + })); + } return true; }