feat(telegram-remote): show transcript in Telegram only, not to AI
This commit is contained in:
@@ -9,7 +9,7 @@ Turn any Telegram chat into a pocket terminal for your harness: chat with your A
|
|||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
- 💬 **Chat from Telegram** — send a message, get a live-streamed structured reply (thinking, tools, final answer) edited in place
|
- 💬 **Chat from Telegram** — send a message, get a live-streamed structured reply (thinking, tools, final answer) edited in place
|
||||||
- 🎙️ **Voice & audio** — send a voice message or audio file; it is transcribed through your home-lab Whisper server (default `large-v2` on CUDA GPU) and the text is sent to your AI
|
- 🎙️ **Voice & audio** — send a voice message or audio file; it is transcribed through your home-lab Whisper server (default `large-v2` on CUDA GPU) and the text is shown in Telegram (not sent to the AI agent)
|
||||||
- 🎛 **Full harness control** — 49 commands: chats, models, sessions, subagents, goals, jobs, files, PowerShell, exports, presets, skills, settings, credentials, permissions, and more
|
- 🎛 **Full harness control** — 49 commands: chats, models, sessions, subagents, goals, jobs, files, PowerShell, exports, presets, skills, settings, credentials, permissions, and more
|
||||||
- 📡 **Live state** — status, running turns, queued messages (steer / edit / remove), background jobs
|
- 📡 **Live state** — status, running turns, queued messages (steer / edit / remove), background jobs
|
||||||
- 🔐 **Permission-aware** — sandbox read/write/full control per chat, approval buttons for risky tools
|
- 🔐 **Permission-aware** — sandbox read/write/full control per chat, approval buttons for risky tools
|
||||||
|
|||||||
@@ -505,8 +505,8 @@ function pickAudioFilename(audio, mimeType) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Transcribe a voice message / audio file / audio document via the home-lab
|
* Transcribe a voice message / audio file / audio document via the home-lab
|
||||||
* Whishper server, show the transcript, and queue it into the chat session
|
* Whishper server and show the transcript in Telegram. The transcript is
|
||||||
* like a normal user message.
|
* deliberately NOT sent to the AI agent as a prompt.
|
||||||
*/
|
*/
|
||||||
async function handleAudio(state, chatId, userId, audio, messageId) {
|
async function handleAudio(state, chatId, userId, audio, messageId) {
|
||||||
let statusMessageId = null;
|
let statusMessageId = null;
|
||||||
@@ -550,27 +550,7 @@ async function handleAudio(state, chatId, userId, audio, messageId) {
|
|||||||
state.log("audio transcript edit failed: " + editError.message);
|
state.log("audio transcript edit failed: " + editError.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cs = state.chatState(chatId);
|
state.log("audio transcribed (" + state.config.whisperModel + ") for chat " + chatId + " by " + userId);
|
||||||
if (messageId != null) cs.lastUserMessageId = messageId;
|
|
||||||
if (!cs.sessionId) {
|
|
||||||
try {
|
|
||||||
const created = await callApi(state.ctx, "sessions", "create", { cwd: state.config.workspaceRoot || process.cwd() });
|
|
||||||
cs.sessionId = created.sessionId;
|
|
||||||
state.saveState();
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
if (!cs.sessionId) {
|
|
||||||
await state.bot.send(chatId, "No chat is open yet — tap 💬 New chat first.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await callApi(state.ctx, "sessions", "prompt", {
|
|
||||||
sessionId: cs.sessionId,
|
|
||||||
mode: "queue",
|
|
||||||
content: [{ type: "text", text: trimmed }],
|
|
||||||
clientTimeZone: (() => { try { return Intl.DateTimeFormat().resolvedOptions().timeZone; } catch { return "UTC"; } })(),
|
|
||||||
});
|
|
||||||
state.notePrompt(cs.sessionId, trimmed);
|
|
||||||
state.log("audio transcribed (" + state.config.whisperModel + ") and sent to " + cs.sessionId + " by " + userId);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
state.log("audio handling failed: " + (error.stack ?? error.message));
|
state.log("audio handling failed: " + (error.stack ?? error.message));
|
||||||
const message = "⚠️ Couldn't transcribe the audio: " + esc(error.message);
|
const message = "⚠️ Couldn't transcribe the audio: " + esc(error.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user