show_transcript in telegram voice input

This commit is contained in:
afjcjsbx 2026-02-19 22:54:00 +01:00
parent f332509443
commit 484b19ce33
3 changed files with 24 additions and 19 deletions

View file

@ -16,7 +16,8 @@
"proxy": "",
"allow_from": [
"YOUR_USER_ID"
]
],
"show_transcript": true
},
"discord": {
"enabled": false,

View file

@ -276,20 +276,22 @@ func (c *TelegramChannel) handleMessage(ctx context.Context, message *telego.Mes
"text": result.Text,
})
if c.config.Channels.Telegram.ShowTranscript {
replyText := fmt.Sprintf("<b>Transcript: </b><i>%s</i>", escapeHTML(result.Text))
replyMsg := tu.Message(tu.ID(chatID), replyText)
replyMsg.ReplyParameters = &telego.ReplyParameters{
MessageID: message.MessageID,
}
replyMsg.ParseMode = telego.ModeHTML
if _, err := c.bot.SendMessage(ctx, replyMsg); err != nil {
_, replyErr := c.bot.SendMessage(ctx, replyMsg)
if replyErr != nil {
logger.ErrorCF("telegram", "Failed to send transcription reply", map[string]interface{}{
"error": err.Error(),
"error": replyErr.Error(),
})
}
}
}
} else {
transcribedText = "[voice]"
}

View file

@ -175,6 +175,7 @@ type TelegramConfig struct {
Token string `json:"token" env:"PICOCLAW_CHANNELS_TELEGRAM_TOKEN"`
Proxy string `json:"proxy" env:"PICOCLAW_CHANNELS_TELEGRAM_PROXY"`
AllowFrom FlexibleStringSlice `json:"allow_from" env:"PICOCLAW_CHANNELS_TELEGRAM_ALLOW_FROM"`
ShowTranscript bool `json:"show_transcript" env:"PICOCLAW_CHANNELS_TELEGRAM_SHOW_TRANSCRIPT"`
}
type FeishuConfig struct {
@ -344,6 +345,7 @@ func DefaultConfig() *Config {
Enabled: false,
Token: "",
AllowFrom: FlexibleStringSlice{},
ShowTranscript: true,
},
Feishu: FeishuConfig{
Enabled: false,