Use local Whisper compose stack
This commit is contained in:
+8
-8
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
telegram:
|
telegram:
|
||||||
bot_token: ${FLYNN_TELEGRAM_TOKEN}
|
bot_token: ${FLYNN_TELEGRAM_TOKEN}
|
||||||
allowed_chat_ids: [] # Add your Telegram chat ID
|
allowed_chat_ids: [-1003673132186]
|
||||||
|
require_mention: false
|
||||||
|
|
||||||
server:
|
server:
|
||||||
tailscale_only: true
|
tailscale_only: true
|
||||||
@@ -167,10 +168,9 @@ hooks:
|
|||||||
# --host 0.0.0.0 --port 8080 --convert --language en \
|
# --host 0.0.0.0 --port 8080 --convert --language en \
|
||||||
# --inference-path /v1/audio/transcriptions
|
# --inference-path /v1/audio/transcriptions
|
||||||
#
|
#
|
||||||
# audio:
|
audio:
|
||||||
# enabled: true
|
enabled: true
|
||||||
# provider:
|
provider:
|
||||||
# type: custom # openai, groq, ollama, llamacpp, custom
|
type: custom
|
||||||
# endpoint: "http://localhost:18801/v1/audio/transcriptions"
|
endpoint: "http://whisper-server:8080/v1/audio/transcriptions"
|
||||||
# api_key: "${WHISPER_API_KEY}" # Optional Bearer token
|
model: "whisper-1"
|
||||||
# model: "whisper-1" # Model name (default: whisper-1)
|
|
||||||
|
|||||||
+33
-20
@@ -1,3 +1,5 @@
|
|||||||
|
version: '3.9'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
flynn:
|
flynn:
|
||||||
build: .
|
build: .
|
||||||
@@ -29,28 +31,39 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
start_period: 15s
|
start_period: 15s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
depends_on:
|
||||||
|
whisper-server:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- flynn-net
|
||||||
|
|
||||||
# Optional: Whisper server for audio transcription
|
# Optional: Whisper server for audio transcription
|
||||||
# Uncomment and adjust as needed for voice message support
|
whisper-server:
|
||||||
# whisper-server:
|
image: ghcr.io/ggml-org/whisper.cpp:main
|
||||||
# image: ghcr.io/ggml-org/whisper.cpp:main
|
container_name: whisper-server
|
||||||
# container_name: whisper-server
|
restart: unless-stopped
|
||||||
# restart: unless-stopped
|
ports:
|
||||||
# ports:
|
- "18801:8080"
|
||||||
# - "18801:8080"
|
command: >
|
||||||
# command: whisper-server
|
whisper-server
|
||||||
# --model /app/models/ggml-base.en.bin
|
--model /app/models/ggml-base.en.bin
|
||||||
# --host 0.0.0.0
|
--host 0.0.0.0
|
||||||
# --port 8080
|
--port 8080
|
||||||
# --convert
|
--convert
|
||||||
# --language en
|
--language en
|
||||||
# --inference-path /v1/audio/transcriptions
|
--inference-path /v1/audio/transcriptions
|
||||||
# healthcheck:
|
volumes:
|
||||||
# test: ["CMD-SHELL", "curl", "-f", "http://localhost:8080/"]
|
- ./whisper-models:/app/models:ro
|
||||||
# interval: 30s
|
healthcheck:
|
||||||
# timeout: 5s
|
test: ["CMD-SHELL", "curl", "-f", "http://localhost:8080/"]
|
||||||
# start_period: 15s
|
interval: 30s
|
||||||
# retries: 3
|
timeout: 5s
|
||||||
|
start_period: 15s
|
||||||
|
retries: 3
|
||||||
|
networks:
|
||||||
|
- flynn-net
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
flynn-data:
|
flynn-data:
|
||||||
|
networks:
|
||||||
|
flynn-net:
|
||||||
|
|||||||
@@ -56,7 +56,10 @@ export class SessionStore {
|
|||||||
const stmt = this.db.prepare(
|
const stmt = this.db.prepare(
|
||||||
'INSERT INTO messages (session_id, role, content, metadata) VALUES (?, ?, ?, ?)',
|
'INSERT INTO messages (session_id, role, content, metadata) VALUES (?, ?, ?, ?)',
|
||||||
);
|
);
|
||||||
stmt.run(sessionId, message.role, message.content, metadata ? JSON.stringify(metadata) : null);
|
const contentString = typeof message.content === 'string'
|
||||||
|
? message.content
|
||||||
|
: JSON.stringify(message.content);
|
||||||
|
stmt.run(sessionId, message.role, contentString, metadata ? JSON.stringify(metadata) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMessages(sessionId: string): Message[] {
|
getMessages(sessionId: string): Message[] {
|
||||||
@@ -84,7 +87,10 @@ export class SessionStore {
|
|||||||
'INSERT INTO messages (session_id, role, content, metadata) VALUES (?, ?, ?, ?)',
|
'INSERT INTO messages (session_id, role, content, metadata) VALUES (?, ?, ?, ?)',
|
||||||
);
|
);
|
||||||
for (const msg of messages) {
|
for (const msg of messages) {
|
||||||
insert.run(sessionId, msg.role, msg.content, null);
|
const contentString = typeof msg.content === 'string'
|
||||||
|
? msg.content
|
||||||
|
: JSON.stringify(msg.content);
|
||||||
|
insert.run(sessionId, msg.role, contentString, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
transaction();
|
transaction();
|
||||||
|
|||||||
Reference in New Issue
Block a user