Files
handler-base/messages/messages.go
Billy D. f1dd96a42b
All checks were successful
CI / Test (push) Successful in 3m2s
CI / Lint (push) Successful in 3m7s
CI / Release (push) Successful in 1m55s
CI / Notify Downstream (stt-module) (push) Successful in 1s
CI / Notify Downstream (voice-assistant) (push) Successful in 1s
CI / Notify (push) Successful in 2s
CI / Notify Downstream (chat-handler) (push) Successful in 1s
CI / Notify Downstream (pipeline-bridge) (push) Successful in 1s
CI / Notify Downstream (tts-module) (push) Successful in 1s
style: gofmt + fix errcheck lint warning
2026-02-21 15:35:37 -05:00

70 lines
2.7 KiB
Go

// Package messages re-exports protobuf message types and provides NATS
// subject constants plus helper functions.
//
// The canonical type definitions live in the generated package
// gen/messagespb (from proto/messages/v1/messages.proto).
// This package provides type aliases so existing callers can keep using
// messages.ChatRequest, etc., while the wire format is now protobuf.
package messages
import (
"time"
pb "git.daviestechlabs.io/daviestechlabs/handler-base/gen/messagespb"
)
// ════════════════════════════════════════════════════════════════════════════
// Type aliases — use these or import gen/messagespb directly.
// ════════════════════════════════════════════════════════════════════════════
// Common
type ErrorResponse = pb.ErrorResponse
// Chat
type LoginEvent = pb.LoginEvent
type GreetingRequest = pb.GreetingRequest
type GreetingResponse = pb.GreetingResponse
type ChatRequest = pb.ChatRequest
type ChatResponse = pb.ChatResponse
type ChatStreamChunk = pb.ChatStreamChunk
// Voice
type VoiceRequest = pb.VoiceRequest
type VoiceResponse = pb.VoiceResponse
type DocumentSource = pb.DocumentSource
// TTS
type TTSRequest = pb.TTSRequest
type TTSAudioChunk = pb.TTSAudioChunk
type TTSFullResponse = pb.TTSFullResponse
type TTSStatus = pb.TTSStatus
type TTSVoiceInfo = pb.TTSVoiceInfo
type TTSVoiceListResponse = pb.TTSVoiceListResponse
type TTSVoiceRefreshResponse = pb.TTSVoiceRefreshResponse
// STT
type STTStreamMessage = pb.STTStreamMessage
type STTTranscription = pb.STTTranscription
type STTInterrupt = pb.STTInterrupt
// Pipeline
type PipelineTrigger = pb.PipelineTrigger
type PipelineStatus = pb.PipelineStatus
// ════════════════════════════════════════════════════════════════════════════
// Helpers
// ════════════════════════════════════════════════════════════════════════════
// EffectiveQuery returns Message or falls back to Query.
func EffectiveQuery(c *ChatRequest) string {
if c.GetMessage() != "" {
return c.GetMessage()
}
return c.GetQuery()
}
// Timestamp returns the current Unix timestamp.
func Timestamp() int64 {
return time.Now().Unix()
}