Skip to content

Commit 98384b4

Browse files
author
Eithan
committedJul 12, 2024·
chore: publishing server
1 parent 8856f21 commit 98384b4

File tree

4 files changed

+118
-1
lines changed

4 files changed

+118
-1
lines changed
 

‎.github/workflows/publish-client.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
images: eithan1231/gerald-assistant-client
4141
tags: |
42-
type=raw,value={{date 'YYYY'}}-{{date 'MM'}}-{{date 'DD'}}-{{sha}}
42+
type=raw,value={{date 'YYYY'}}-{{date 'MM'}}-{{date 'DD'}}-commit-{{sha}}
4343
type=raw,value=latest
4444
4545

‎.github/workflows/publish-server.yaml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Publish Docker Server image"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
push_to_registry:
10+
name: Push Docker image to Docker Hub
11+
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
packages: write
16+
contents: read
17+
attestations: write
18+
id-token: write
19+
20+
steps:
21+
- name: Check out the repo
22+
uses: actions/checkout@v4
23+
24+
- name: Log in to Docker Hub
25+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
26+
with:
27+
username: ${{ secrets.DOCKER_USERNAME }}
28+
password: ${{ secrets.DOCKER_PASSWORD }}
29+
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v3
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v4
39+
with:
40+
images: eithan1231/gerald-assistant-server
41+
tags: |
42+
type=raw,value={{date 'YYYY'}}-{{date 'MM'}}-{{date 'DD'}}-commit-{{sha}}
43+
type=raw,value=latest
44+
45+
46+
- name: Build and push Docker image
47+
id: push
48+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
49+
with:
50+
context: server
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: ${{ steps.meta.outputs.tags }}
54+
labels: ${{ steps.meta.outputs.labels }}

‎server/docker-compose.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: "3.8"
2+
3+
services:
4+
server:
5+
container_name: ga-server
6+
image: eithan1231/gerald-assistant-server
7+
restart: unless-stopped
8+
environment:
9+
# Listen words. Can be used for changing the name of your agent, configured to
10+
# "jeff,jeffery,gerald" by default.
11+
#
12+
# Uncommon or rare names might be harder for the speach-to-text engine to pick up.
13+
# Gerald is often picked up as "joe", which is not ideal, but hence the "Jeff"
14+
- LISTEN_WORDS=jeff,jeffery,gerald
15+
16+
# Your OpenAI key geerated by OpenAI. This is required.
17+
- OPENAI_KEY=SECRET_OPENAI_KEY
18+
19+
# mimic3, used for text-to-speach.
20+
- ENDPOINT_TTS=http://mimic3:59125/api/tts
21+
22+
# faster-whisper-server, used for speach-to-text.
23+
- ENDPOINT_TRANSCRIBE=http://faster-whisper-server:8000/v1/audio/transcriptions
24+
25+
volumes:
26+
- /dev/snd:/dev/snd
27+
28+
faster-whisper-server:
29+
container_name: faster-whisper-server
30+
# To run model on GPU, utilise the tag "latest-cuda", for cpu use "latest-cpu".
31+
# Most models will run sufficiently on CPU.
32+
image: fedirz/faster-whisper-server:latest-cpu
33+
restart: always
34+
volumes:
35+
# Mounting this volume will vastly improve startup times, and will avoid
36+
# the model being re-downloaded
37+
- ./cache/faster-whisper/huggingface:/root/.cache/huggingface
38+
environment:
39+
# faster-whisper models for speach-to-text. I have found the base-en model to be a great
40+
# compromise between speed and performance. Hallucinations for "okay okay okay", or "please
41+
# subscribe to xyz" are not entirely uncommon, but rare enough to not be impactful.
42+
#
43+
# 789MB - Systran/faster-distil-whisper-medium.en
44+
# 322MB - Systran/faster-distil-whisper-small.en
45+
# 145MB - Systran/faster-whisper-base.en
46+
# 75MB - Systran/faster-whisper-tiny.en
47+
#
48+
# More can be found here:
49+
# https://huggingface.co/Systran
50+
- WHISPER_MODEL=Systran/faster-whisper-base.en
51+
52+
mimic3:
53+
container_name: mimic3
54+
image: mycroftai/mimic3
55+
restart: always
56+
volumes:
57+
- ./cache/mimic3:/home/mimic3/.local/share/mycroft/mimic3

‎server/src/text-to-speech.ts

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export const createTextToSpeech = async (
3131
const response = await fetch(`${endpoint}?${params.toString()}`);
3232

3333
if (response.status !== 200) {
34+
console.log(`[createTextToSpeech] Failed to TTS ${response.status}`);
35+
36+
return {
37+
success: false,
38+
message: "Failed to convert text to speech",
39+
};
3440
}
3541

3642
const responseContent: Buffer[] = [];

0 commit comments

Comments
 (0)
Please sign in to comment.