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
This commit is contained in:
+29
-12
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user