Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c20a2f8097 | |||
| 0df27901c9 | |||
| a5b66c09c3 | |||
| c668802b15 |
@@ -9,8 +9,8 @@ on:
|
|||||||
env:
|
env:
|
||||||
NTFY_URL: http://ntfy.observability.svc.cluster.local:80
|
NTFY_URL: http://ntfy.observability.svc.cluster.local:80
|
||||||
GOPRIVATE: git.daviestechlabs.io
|
GOPRIVATE: git.daviestechlabs.io
|
||||||
REGISTRY: gitea-http.gitea.svc.cluster.local:3000/daviestechlabs
|
REGISTRY: registry.lab.daviestechlabs.io/daviestechlabs
|
||||||
REGISTRY_HOST: gitea-http.gitea.svc.cluster.local:3000
|
REGISTRY_HOST: registry.lab.daviestechlabs.io
|
||||||
IMAGE_NAME: stt-module
|
IMAGE_NAME: stt-module
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -123,11 +123,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Gitea Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
buildkitd-config-inline: |
|
registry: ${{ env.REGISTRY_HOST }}
|
||||||
[registry."gitea-http.gitea.svc.cluster.local:3000"]
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
http = true
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
insecure = true
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: vars.DOCKERHUB_USERNAME != ''
|
if: vars.DOCKERHUB_USERNAME != ''
|
||||||
@@ -136,28 +138,6 @@ jobs:
|
|||||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Configure Docker for insecure registry
|
|
||||||
run: |
|
|
||||||
sudo mkdir -p /etc/docker
|
|
||||||
echo '{"insecure-registries": ["${{ env.REGISTRY_HOST }}"]}' | sudo tee /etc/docker/daemon.json
|
|
||||||
sudo systemctl restart docker || sudo service docker restart || true
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
|
||||||
run: |
|
|
||||||
AUTH=$(echo -n "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_TOKEN }}" | base64 -w0)
|
|
||||||
mkdir -p ~/.docker
|
|
||||||
cat > ~/.docker/config.json << EOF
|
|
||||||
{
|
|
||||||
"auths": {
|
|
||||||
"${{ env.REGISTRY_HOST }}": {
|
|
||||||
"auth": "$AUTH"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
echo "Auth configured for ${{ env.REGISTRY_HOST }}"
|
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@@ -175,8 +155,7 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
name: Notify
|
name: Notify
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ FROM golang:1.25-alpine AS builder
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates git
|
||||||
|
|
||||||
|
ENV GOPRIVATE=git.daviestechlabs.io
|
||||||
|
ENV GONOSUMCHECK=git.daviestechlabs.io
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN --mount=type=secret,id=netrc,target=/root/.netrc go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -3,9 +3,9 @@ module git.daviestechlabs.io/daviestechlabs/stt-module
|
|||||||
go 1.25.1
|
go 1.25.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.daviestechlabs.io/daviestechlabs/handler-base v0.1.3
|
git.daviestechlabs.io/daviestechlabs/handler-base v1.0.0
|
||||||
github.com/nats-io/nats.go v1.48.0
|
github.com/nats-io/nats.go v1.48.0
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.1
|
google.golang.org/protobuf v1.36.11
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -19,7 +19,6 @@ require (
|
|||||||
github.com/klauspost/compress v1.18.0 // indirect
|
github.com/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/nats-io/nkeys v0.4.11 // indirect
|
github.com/nats-io/nkeys v0.4.11 // indirect
|
||||||
github.com/nats-io/nuid v1.0.1 // indirect
|
github.com/nats-io/nuid v1.0.1 // indirect
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||||
go.opentelemetry.io/otel v1.40.0 // indirect
|
go.opentelemetry.io/otel v1.40.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.40.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.40.0 // indirect
|
||||||
@@ -37,5 +36,4 @@ require (
|
|||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
|
||||||
google.golang.org/grpc v1.78.0 // indirect
|
google.golang.org/grpc v1.78.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.11 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
8
go.sum
8
go.sum
@@ -1,5 +1,5 @@
|
|||||||
git.daviestechlabs.io/daviestechlabs/handler-base v0.1.3 h1:uYog8B839ulqrWoht3qqCvT7CnR3e2skpaLZc2Pg3GI=
|
git.daviestechlabs.io/daviestechlabs/handler-base v1.0.0 h1:pB3ehOKaDYQfbyRBKQXrB9curqSFteLrDveoElRKnBY=
|
||||||
git.daviestechlabs.io/daviestechlabs/handler-base v0.1.3/go.mod h1:M3HgvUDWnRn7cX3BE8l+HvoCUYtmRr5OoumB+hnRHoE=
|
git.daviestechlabs.io/daviestechlabs/handler-base v1.0.0/go.mod h1:zocOHFt8yY3cW4+Xi37sNr5Tw7KcjGFSZqgWYxPWyqA=
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
@@ -33,10 +33,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms=
|
go.opentelemetry.io/otel v1.40.0 h1:oA5YeOcpRTXq6NN7frwmwFR0Cn3RhTVZvXsP4duvCms=
|
||||||
|
|||||||
24
main.go
24
main.go
@@ -20,7 +20,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
"github.com/vmihailenco/msgpack/v5"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
"git.daviestechlabs.io/daviestechlabs/handler-base/config"
|
"git.daviestechlabs.io/daviestechlabs/handler-base/config"
|
||||||
"git.daviestechlabs.io/daviestechlabs/handler-base/health"
|
"git.daviestechlabs.io/daviestechlabs/handler-base/health"
|
||||||
@@ -324,17 +324,17 @@ func main() {
|
|||||||
|
|
||||||
if transcript != "" {
|
if transcript != "" {
|
||||||
result := &messages.STTTranscription{
|
result := &messages.STTTranscription{
|
||||||
SessionID: sessionID,
|
SessionId: sessionID,
|
||||||
Transcript: transcript,
|
Transcript: transcript,
|
||||||
Sequence: seq,
|
Sequence: int32(seq),
|
||||||
IsPartial: !complete,
|
IsPartial: !complete,
|
||||||
IsFinal: complete,
|
IsFinal: complete,
|
||||||
Timestamp: time.Now().Unix(),
|
Timestamp: time.Now().Unix(),
|
||||||
SpeakerID: speakerID,
|
SpeakerId: speakerID,
|
||||||
HasVoiceActivity: hasVoice,
|
HasVoiceActivity: hasVoice,
|
||||||
State: state,
|
State: state,
|
||||||
}
|
}
|
||||||
packed, _ := msgpack.Marshal(result)
|
packed, _ := proto.Marshal(result)
|
||||||
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
|
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
|
||||||
slog.Info("published transcription", "session", sessionID, "seq", seq)
|
slog.Info("published transcription", "session", sessionID, "seq", seq)
|
||||||
}
|
}
|
||||||
@@ -378,8 +378,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
sessionID := parts[3]
|
sessionID := parts[3]
|
||||||
|
|
||||||
streamMsg, err := natsutil.Decode[messages.STTStreamMessage](natMsg.Data)
|
var streamMsg messages.STTStreamMessage
|
||||||
if err != nil {
|
if err := natsutil.Decode(natMsg.Data, &streamMsg); err != nil {
|
||||||
slog.Error("decode error", "error", err)
|
slog.Error("decode error", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -391,8 +391,8 @@ func main() {
|
|||||||
if streamMsg.State != "" {
|
if streamMsg.State != "" {
|
||||||
buf.setState(streamMsg.State)
|
buf.setState(streamMsg.State)
|
||||||
}
|
}
|
||||||
if streamMsg.SpeakerID != "" {
|
if streamMsg.SpeakerId != "" {
|
||||||
buf.speakerID = streamMsg.SpeakerID
|
buf.speakerID = streamMsg.SpeakerId
|
||||||
}
|
}
|
||||||
sessionsMu.Lock()
|
sessionsMu.Lock()
|
||||||
sessions[sessionID] = buf
|
sessions[sessionID] = buf
|
||||||
@@ -442,12 +442,12 @@ func main() {
|
|||||||
// Check for interrupt
|
// Check for interrupt
|
||||||
if buffer.checkInterrupt(streamMsg.Audio, enableInterrupt, audioLevelThreshold, interruptDuration) {
|
if buffer.checkInterrupt(streamMsg.Audio, enableInterrupt, audioLevelThreshold, interruptDuration) {
|
||||||
interruptMsg := &messages.STTInterrupt{
|
interruptMsg := &messages.STTInterrupt{
|
||||||
SessionID: sessionID,
|
SessionId: sessionID,
|
||||||
Type: "interrupt",
|
Type: "interrupt",
|
||||||
Timestamp: time.Now().Unix(),
|
Timestamp: time.Now().Unix(),
|
||||||
SpeakerID: buffer.speakerID,
|
SpeakerId: buffer.speakerID,
|
||||||
}
|
}
|
||||||
packed, _ := msgpack.Marshal(interruptMsg)
|
packed, _ := proto.Marshal(interruptMsg)
|
||||||
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
|
_ = nc.Conn().Publish(fmt.Sprintf("%s.%s", transcriptionSubjectPrefix, sessionID), packed)
|
||||||
slog.Info("published interrupt", "session", sessionID)
|
slog.Info("published interrupt", "session", sessionID)
|
||||||
buffer.setState(stateListening)
|
buffer.setState(stateListening)
|
||||||
|
|||||||
Reference in New Issue
Block a user