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:
parent
09a9a091f4
commit
1c6874fa74
3 changed files with 6 additions and 2 deletions
|
|
@ -15,6 +15,6 @@ func init() {
|
|||
if storePath == "" {
|
||||
storePath = filepath.Join(cfg.WorkspacePath(), "whatsapp")
|
||||
}
|
||||
return NewWhatsAppNativeChannel(waCfg, b, storePath)
|
||||
return NewWhatsAppNativeChannel(waCfg, cfg.Voice, b, storePath)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ const (
|
|||
type WhatsAppNativeChannel struct {
|
||||
*channels.BaseChannel
|
||||
config config.WhatsAppConfig
|
||||
voiceConfig config.VoiceConfig
|
||||
storePath string
|
||||
client *whatsmeow.Client
|
||||
container *sqlstore.Container
|
||||
|
|
@ -67,6 +68,7 @@ type WhatsAppNativeChannel struct {
|
|||
// storePath is the directory for the SQLite session store (e.g. workspace/whatsapp).
|
||||
func NewWhatsAppNativeChannel(
|
||||
cfg config.WhatsAppConfig,
|
||||
voiceCfg config.VoiceConfig,
|
||||
bus *bus.MessageBus,
|
||||
storePath string,
|
||||
) (channels.Channel, error) {
|
||||
|
|
@ -80,6 +82,7 @@ func NewWhatsAppNativeChannel(
|
|||
c := &WhatsAppNativeChannel{
|
||||
BaseChannel: base,
|
||||
config: cfg,
|
||||
voiceConfig: voiceCfg,
|
||||
storePath: storePath,
|
||||
}
|
||||
return c, nil
|
||||
|
|
@ -428,7 +431,7 @@ func (c *WhatsAppNativeChannel) handleIncoming(evt *events.Message) {
|
|||
metadata["peer_kind"] = "direct"
|
||||
metadata["peer_id"] = senderID
|
||||
}
|
||||
if len(mediaPaths) > 0 && c.config.EchoTranscription {
|
||||
if len(mediaPaths) > 0 && c.voiceConfig.EchoTranscription {
|
||||
metadata["echo_transcription"] = "true"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
// Build with: go build -tags whatsapp_native ./cmd/...
|
||||
func NewWhatsAppNativeChannel(
|
||||
cfg config.WhatsAppConfig,
|
||||
voiceCfg config.VoiceConfig,
|
||||
bus *bus.MessageBus,
|
||||
storePath string,
|
||||
) (channels.Channel, error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue