Skip to content

Commit

Permalink
Merge pull request #13 from dvonthenen/fix-logging-google
Browse files Browse the repository at this point in the history
Fix logging google
  • Loading branch information
dvonthenen authored Dec 5, 2023
2 parents f4796e1 + 71c4200 commit b398656
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmd/monty-python/impl/monty-python.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (a *MyAssistant) Response(text string) error {

if percent := matchr.JaroWinkler(key, text, false); percent > 0.95 {
klog.V(5).Infof("\n\n--------------------------------\n")
klog.V(3).Infof("MATCH (%f): %s = %s\n", percent, key, text)
klog.V(4).Infof("MATCH (%f): %s = %s\n", percent, key, text)
klog.V(5).Infof("\n--------------------------------\n\n")

klog.V(2).Infof("Heard:\nMATCH (%f): %s = %s\n\n", percent, key, text)
Expand Down
2 changes: 1 addition & 1 deletion pkg/assistant/assistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func New(assistantImpl *ainterfaces.AssistantImpl, opts *AssistantOptions) (*Ass
// which transcriber?
var transcriberStr string
if v := os.Getenv("ASSISTANT_TRANSCRIBER"); v != "" {
klog.V(2).Infof("ASSISTANT_TRANSCRIBER found")
klog.V(2).Infof("ASSISTANT_TRANSCRIBER found\n")
transcriberStr = v
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/speech/speech.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func New(ctx context.Context, opts *SpeechOptions) (*Client, error) {
googleCredentials: googleCredentials,
}

klog.V(3).Infof("speech.New Succeeded\n")
klog.V(4).Infof("speech.New Succeeded\n")
klog.V(6).Infof("speech.New LEAVE\n")

return client, nil
Expand Down Expand Up @@ -102,7 +102,7 @@ func (sc *Client) TextToSpeech(ctx context.Context, text string) ([]byte, error)
return []byte{}, err
}

klog.V(3).Infof("Client.TextToSpeech Succeeded\n")
klog.V(4).Infof("Client.TextToSpeech Succeeded\n")
klog.V(6).Infof("Client.TextToSpeech LEAVE\n")
return resp.AudioContent, nil
}
Expand Down Expand Up @@ -145,7 +145,7 @@ func (sc *Client) PlayAudio(stream []byte) error {
// wait until done... blocking!
<-done

klog.V(3).Infof("PlayAudio Succeeded\n")
klog.V(4).Infof("PlayAudio Succeeded\n")
klog.V(6).Infof("Client.PlayAudio LEAVE\n")

return nil
Expand All @@ -168,7 +168,7 @@ func (sc *Client) Play(ctx context.Context, text string) error {
return err
}

klog.V(3).Infof("Play Succeeded\n")
klog.V(4).Infof("Play Succeeded\n")
klog.V(6).Infof("Client.Play LEAVE\n")
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/transcriber/deepgram/deepgram.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func New(ctx context.Context, opts *config.TranscribeOptions) (*Transcribe, erro
Channels: opts.InputChannels,
SampleRate: opts.SamplingRate,
Punctuate: true,
// Keywords: []string{"Hey Kitt:32", "Hey Kit:16", "Hey:16", "Hello:16", "Hey:16", "Kitt:16", "Kit:16"},
Keywords: []string{"Hey Kitt:32", "Hey Kit:16", "Hey:16", "Hello:16", "Hey:16", "Kitt:16", "Kit:16"},
// Endpointing: "500",
}
// klog.V(2).Infof("options: %v\n", options)
Expand All @@ -87,7 +87,7 @@ func New(ctx context.Context, opts *config.TranscribeOptions) (*Transcribe, erro
mic: mic,
}

klog.V(3).Infof("transcribe.New Succeeded\n")
klog.V(4).Infof("transcribe.New Succeeded\n")
klog.V(6).Infof("transcribe.New LEAVE\n")

return transcribe, nil
Expand Down Expand Up @@ -119,7 +119,7 @@ func (a *Transcribe) Start() error {
a.mic.Stream(a.client)
}()

klog.V(3).Infof("transcribe.Start Succeeded\n")
klog.V(4).Infof("transcribe.Start Succeeded\n")
klog.V(6).Infof("transcribe.Start LEAVE\n")
return nil
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/transcriber/deepgram/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ func (i *Insights) Message(mr *api.MessageResponse) error {
sentence := strings.TrimSpace(mr.Channel.Alternatives[0].Transcript)

if len(mr.Channel.Alternatives) == 0 || len(sentence) == 0 {
// klog.V(7).Infof("DEEPGRAM - no transcript")
klog.V(7).Infof("DEEPGRAM - no transcript\n")
return nil
}

isFinal := mr.SpeechFinal
sentence = strings.ToLower(sentence)
i.sb.WriteString(sentence)

// // debug
// klog.V(4).Infof("transcription result: text = %s, final = %t", i.sb.String(), isFinal)
// debug
klog.V(7).Infof("transcription result: text = %s, final = %t\n", i.sb.String(), isFinal)

if !isFinal {
// klog.V(7).Infof("DEEPGRAM - not final")
klog.V(7).Infof("DEEPGRAM - not final\n")
return nil
}

// debug
klog.V(2).Infof("Deepgram transcription: text = %s, final = %t", i.sb.String(), isFinal)
klog.V(3).Infof("Deepgram transcription: text = %s, final = %t", i.sb.String(), isFinal)

// perform callback
i.options.Microphone.Mute()
Expand All @@ -75,9 +75,9 @@ func (i *Insights) Message(mr *api.MessageResponse) error {
}

func (i *Insights) Metadata(md *api.MetadataResponse) error {
klog.V(3).Infof("\nMetadata.RequestID: %s\n", strings.TrimSpace(md.RequestID))
klog.V(3).Infof("Metadata.Channels: %d\n", md.Channels)
klog.V(3).Infof("Metadata.Created: %s\n\n", strings.TrimSpace(md.Created))
klog.V(4).Infof("\nMetadata.RequestID: %s\n", strings.TrimSpace(md.RequestID))
klog.V(4).Infof("Metadata.Channels: %d\n", md.Channels)
klog.V(4).Infof("Metadata.Created: %s\n\n", strings.TrimSpace(md.Created))

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/transcriber/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (t *Transcribe) Start() error {
t.mic.Stream(t)
}()

klog.V(3).Infof("transcribe.Start Succeeded\n")
klog.V(4).Infof("transcribe.Start Succeeded\n")
klog.V(6).Infof("transcribe.Start LEAVE\n")
return nil
}
Expand Down Expand Up @@ -275,7 +275,7 @@ func (t *Transcribe) listen() {

// Debug... what is being said word for word
sentence := sb.String()
klog.V(2).Infof("google transcription: text=%s final=%t\n", sentence, result.IsFinal)
klog.V(3).Infof("google transcription: text=%s final=%t\n", sentence, result.IsFinal)

if t.options.Callback != nil {
t.mic.Mute()
Expand Down

0 comments on commit b398656

Please sign in to comment.