summaryrefslogtreecommitdiff
path: root/noextra.go
blob: 2ad138ca50e4ad5d6c3da9bb3d44cb15b3717dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//go:build !extra
// +build !extra

package main

import (
	"gf-lt/config"
	"log/slog"
)

// Interfaces and implementations when extra modules are not included

type Orator interface {
	Speak(text string) error
	Stop()
	GetLogger() *slog.Logger
}

type STT interface {
	StartRecording() error
	StopRecording() (string, error)
	IsRecording() bool
}

// DefaultOrator is a no-op implementation when TTS is not available
type DefaultOrator struct {
	logger *slog.Logger
}

func NewOrator(logger *slog.Logger, cfg *config.Config) Orator {
	return &DefaultOrator{logger: logger}
}

func (d *DefaultOrator) Speak(text string) error {
	d.logger.Debug("TTS not available - extra modules disabled")
	return nil
}

func (d *DefaultOrator) Stop() {
	// No-op
}

func (d *DefaultOrator) GetLogger() *slog.Logger {
	return d.logger
}

// DefaultSTT is a no-op implementation when STT is not available
type DefaultSTT struct {
	logger *slog.Logger
}

func NewSTT(logger *slog.Logger, cfg *config.Config) STT {
	return &DefaultSTT{logger: logger}
}

func (d *DefaultSTT) StartRecording() error {
	d.logger.Debug("STT not available - extra modules disabled")
	return nil
}

func (d *DefaultSTT) StopRecording() (string, error) {
	d.logger.Debug("STT not available - extra modules disabled")
	return "", nil
}

func (d *DefaultSTT) IsRecording() bool {
	return false
}

// TTS channels - no-op when extra is not available
var TTSTextChan = make(chan string, 10000)
var TTSFlushChan = make(chan bool, 1)
var TTSDoneChan = make(chan bool, 1)