feat: remote worker GPU support with nllb-1.3B

- Update Dockerfile.remote-worker with CUDA support
- Update docker-compose.yml with GPU settings
- Update remote_translator_worker.py to use nllb-200-1.3B
- Update worker_ws.go with model URL handler
This commit is contained in:
lordpietre 2026-04-01 03:55:40 +00:00
parent 8093cc1e40
commit 98e0cd0e46
4 changed files with 65 additions and 26 deletions

View file

@ -294,4 +294,46 @@ func StartJobAssigner() {
}
}
}()
}
func GetModelDownloadURL(c *gin.Context) {
apiKey := c.Query("api_key")
if apiKey == "" {
apiKey = c.GetHeader("X-API-Key")
}
if apiKey == "" {
c.JSON(http.StatusUnauthorized, gin.H{"error": "API key required"})
return
}
ctx := c.Request.Context()
var workerID int
err := db.GetPool().QueryRow(ctx, `
SELECT id FROM remote_workers WHERE api_key = $1
`, apiKey).Scan(&workerID)
if err != nil {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Invalid API key"})
return
}
var modelURL, modelPath string
db.GetPool().QueryRow(ctx, `
SELECT value FROM config WHERE key = 'remote_worker_model_url'
`).Scan(&modelURL)
db.GetPool().QueryRow(ctx, `
SELECT value FROM config WHERE key = 'remote_worker_model_path'
`).Scan(&modelPath)
if modelPath == "" {
modelPath = "/app/models/nllb-ct2"
}
c.JSON(http.StatusOK, gin.H{
"model_download_url": modelURL,
"model_path": modelPath,
})
}