fix(whatsapp_native): thread VoiceConfig to fix EchoTranscription compile error

WhatsAppNativeChannel was referencing c.config.EchoTranscription but
EchoTranscription belongs to VoiceConfig, not WhatsAppConfig. Add
voiceConfig field to the struct and pass cfg.Voice through the
constructor so the field resolves correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
github-actions[bot] 2026-04-11 16:07:33 +02:00
parent 09a9a091f4
commit 1c6874fa74
3 changed files with 6 additions and 2 deletions

View file

@ -15,6 +15,6 @@ func init() {
if storePath == "" { if storePath == "" {
storePath = filepath.Join(cfg.WorkspacePath(), "whatsapp") storePath = filepath.Join(cfg.WorkspacePath(), "whatsapp")
} }
return NewWhatsAppNativeChannel(waCfg, b, storePath) return NewWhatsAppNativeChannel(waCfg, cfg.Voice, b, storePath)
}) })
} }

View file

@ -51,6 +51,7 @@ const (
type WhatsAppNativeChannel struct { type WhatsAppNativeChannel struct {
*channels.BaseChannel *channels.BaseChannel
config config.WhatsAppConfig config config.WhatsAppConfig
voiceConfig config.VoiceConfig
storePath string storePath string
client *whatsmeow.Client client *whatsmeow.Client
container *sqlstore.Container container *sqlstore.Container
@ -67,6 +68,7 @@ type WhatsAppNativeChannel struct {
// storePath is the directory for the SQLite session store (e.g. workspace/whatsapp). // storePath is the directory for the SQLite session store (e.g. workspace/whatsapp).
func NewWhatsAppNativeChannel( func NewWhatsAppNativeChannel(
cfg config.WhatsAppConfig, cfg config.WhatsAppConfig,
voiceCfg config.VoiceConfig,
bus *bus.MessageBus, bus *bus.MessageBus,
storePath string, storePath string,
) (channels.Channel, error) { ) (channels.Channel, error) {
@ -80,6 +82,7 @@ func NewWhatsAppNativeChannel(
c := &WhatsAppNativeChannel{ c := &WhatsAppNativeChannel{
BaseChannel: base, BaseChannel: base,
config: cfg, config: cfg,
voiceConfig: voiceCfg,
storePath: storePath, storePath: storePath,
} }
return c, nil return c, nil
@ -428,7 +431,7 @@ func (c *WhatsAppNativeChannel) handleIncoming(evt *events.Message) {
metadata["peer_kind"] = "direct" metadata["peer_kind"] = "direct"
metadata["peer_id"] = senderID metadata["peer_id"] = senderID
} }
if len(mediaPaths) > 0 && c.config.EchoTranscription { if len(mediaPaths) > 0 && c.voiceConfig.EchoTranscription {
metadata["echo_transcription"] = "true" metadata["echo_transcription"] = "true"
} }

View file

@ -14,6 +14,7 @@ import (
// Build with: go build -tags whatsapp_native ./cmd/... // Build with: go build -tags whatsapp_native ./cmd/...
func NewWhatsAppNativeChannel( func NewWhatsAppNativeChannel(
cfg config.WhatsAppConfig, cfg config.WhatsAppConfig,
voiceCfg config.VoiceConfig,
bus *bus.MessageBus, bus *bus.MessageBus,
storePath string, storePath string,
) (channels.Channel, error) { ) (channels.Channel, error) {