From fa2aafa9dd24457020b2bd1808e881b0152f3182 Mon Sep 17 00:00:00 2001 From: Carlo Baratto Date: Sat, 12 Sep 2026 13:49:20 +0200 Subject: [PATCH] fix(autosend): invio dettatura robusto e visibile (v0.3.1) L'auto-invio poteva non scattare senza alcun segnale. Cause eliminate: - il testo viene passato esplicitamente (sendText) invece di rileggerlo dal campo; il focus tastiera non viene piu' forzato prima dell'invio - l'opzione vale "on" salvo disattivazione esplicita (undefined -> on) - ChatModel::send non rifiuta piu' in silenzio: avviso a schermo ("No session open" / "Wait for the current reply") + log [chat] - log [hermes] sul percorso trascrizione/auto-invio per la diagnosi dal terminale --- README.md | 2 +- docs/BUILD.md | 6 +++--- qml/pages/ChatPage.qml | 41 +++++++++++++++++++++++++++++------------ rpm/harbour-hermes.spec | 7 ++++++- src/chatmodel.cpp | 16 +++++++++++++++- src/main.cpp | 4 ++-- 6 files changed, 56 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 943b2a1..807af00 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,6 @@ speaks (validated live against a real instance). ## Status -Version 0.3.0 — protocol and C++ core validated against a real `hermes-webui` +Version 0.3.1 — protocol and C++ core validated against a real `hermes-webui` (login, sessions, streaming chat, TTS, STT, voice dialog); on-device testing still ongoing. diff --git a/docs/BUILD.md b/docs/BUILD.md index 1e1bb3f..9342718 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -76,12 +76,12 @@ richiede il probe WebUI su :8899). Esito 12/09/2026: unit 9/9, live completo OK. ```bash cd ~/workspace -tar czf harbour-hermes-0.3.0.tar.gz \ - --transform 's,^harbour-hermes,harbour-hermes-0.3.0,' \ +tar czf harbour-hermes-0.3.1.tar.gz \ + --transform 's,^harbour-hermes,harbour-hermes-0.3.1,' \ --exclude='.git' harbour-hermes ``` -Lo spec si aspetta la directory `harbour-hermes-0.3.0/` (pattern degli altri +Lo spec si aspetta la directory `harbour-hermes-0.3.1/` (pattern degli altri progetti: cercato in modo robusto anche per i sorgenti live di sfdk). ## 5. Dipendenze lato server (WebUI) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 0b75987..941cbf6 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -227,7 +227,10 @@ Page { } return } - if (appSettings.ttsAutoRead) + var autoRead = appSettings.ttsAutoRead + if (autoRead === undefined || autoRead === null) + autoRead = false + if (autoRead) page.readLast() } onNotice: page.showNotice(text) @@ -237,20 +240,28 @@ Page { target: api onTranscriptionReady: { page.voiceErrors = 0 + var t = (text === undefined || text === null) ? "" : String(text) + var autoSend = appSettings.dictationAutoSend + if (autoSend === undefined || autoSend === null) + autoSend = true + console.log("[hermes] trascrizione: " + t.length + " char, voiceMode=" + + page.voiceMode + ", autoSend=" + autoSend) if (page.voiceMode) { - if (text.trim().length === 0) { + if (t.trim().length === 0) { voiceRetry.restart() return } - input.text = text page.voiceState = "sending" - page.doSend() + page.sendText(t) return } - input.text = text - input.focus = true - if (appSettings.dictationAutoSend) - page.doSend() + input.text = t + if (autoSend) { + console.log("[hermes] auto-invio dettatura") + page.sendText(t) + } else { + input.focus = true + } } onTranscriptionFailed: { page.showNotice(error) @@ -372,15 +383,21 @@ Page { return qsTr("Voice mode on") } - function doSend() { - var t = input.text - if (t.trim().length === 0) + // Invio del testo esplicito (non rilegge il campo: nessuna race con la UI). + function sendText(t) { + var s = String(t).trim() + if (s.length === 0) return input.text = "" - chat.send(t) + console.log("[hermes] sendText: " + s.length + " char, chat.busy=" + chat.busy) + chat.send(s) scrollDebounce.restart() } + function doSend() { + sendText(input.text) + } + function readLast() { var t = chat.lastAssistantText() if (t.length === 0) { diff --git a/rpm/harbour-hermes.spec b/rpm/harbour-hermes.spec index 9f2b9a8..eb4ec81 100644 --- a/rpm/harbour-hermes.spec +++ b/rpm/harbour-hermes.spec @@ -1,6 +1,6 @@ Name: harbour-hermes Summary: Client for the Hermes Web UI with voice -Version: 0.3.0 +Version: 0.3.1 Release: 1 Group: Qt/Qt License: MIT @@ -24,6 +24,11 @@ Sessions list, chat with live streaming replies, voice dictation (server-side TTS), plus a hands-free conversation mode. %changelog +* Sat Sep 12 2026 Carlo Baratto - 0.3.1-1 +- Auto-invio dettatura piu' robusto: il testo viene passato esplicitamente + (niente rilettura del campo), l'opzione vale "on" salvo disattivazione + esplicita, niente focus tastiera prima dell'invio; i rifiuti di invio + ora sono visibili (avviso a schermo + log [chat]/[hermes]) * Sat Sep 12 2026 Carlo Baratto - 0.3.0-1 - Nessuna configurazione cablata nel binario: indirizzo server, voce, engine e preset sono impostazioni dell'app (default neutri; vuoto = diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 05f1da7..f926fa7 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -1,5 +1,6 @@ #include "chatmodel.h" +#include #include ChatModel::ChatModel(ApiClient *api, QObject *parent) @@ -81,8 +82,21 @@ void ChatModel::resync() void ChatModel::send(const QString &text) { const QString trimmed = text.trimmed(); - if (trimmed.isEmpty() || m_sessionId.isEmpty() || m_busy) + if (trimmed.isEmpty()) return; + // Rifiuti VISIBILI: prima erano silenziosi, e l'invio automatico poteva + // "non fare nulla" senza che si capisse il perché. + if (m_sessionId.isEmpty()) { + qDebug() << "[chat] send rifiutato: nessuna sessione aperta"; + emit notice(QStringLiteral("No session open")); + return; + } + if (m_busy) { + qDebug() << "[chat] send rifiutato: un turno e' gia' in corso"; + emit notice(QStringLiteral("Wait for the current reply")); + return; + } + qDebug() << "[chat] invio:" << trimmed.size() << "caratteri"; m_finalizedThisRun = false; appendMessage(QStringLiteral("user"), trimmed, false); beginAssistant(); diff --git a/src/main.cpp b/src/main.cpp index 119d53f..c9edf60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,9 +19,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) // AppConfigLocation = ~/.config/harbour/hermes (zona persistente della sandbox). app->setOrganizationName(QStringLiteral("harbour")); app->setApplicationName(QStringLiteral("hermes")); - app->setApplicationVersion(QStringLiteral("0.3.0")); + app->setApplicationVersion(QStringLiteral("0.3.1")); - qDebug() << "harbour-hermes v0.3.0 build" << __DATE__ << __TIME__; + qDebug() << "harbour-hermes v0.3.1 build" << __DATE__ << __TIME__; Settings settings; ApiClient api(&settings);