rss2/backend/internal/models/remote_worker.go
lordpietre 8093cc1e40 feat: add remote worker system for distributed translation
- Add remote translator worker (Docker) that connects via WebSocket
- Add backend Go handlers for remote worker CRUD (REST + WebSocket)
- Add frontend Admin panel for managing remote workers
- Add ProtectedRoute component to secure admin routes
- Add PostgreSQL schema for remote_workers table
- Fix duplicate Load function in config.go
- Fix frontend duplicate fetchStatus function
- Fix Dockerfiles missing go.sum (use go mod download + tidy)

Features:
- Workers connect to server via WebSocket (no ports needed)
- API key authentication per worker
- Job assigner automatically distributes translation jobs
- Worker status tracking (online/offline/disabled)
- Timeout handling for stuck jobs
2026-04-01 03:29:09 +00:00

41 lines
No EOL
1.2 KiB
Go

package models
import "time"
type RemoteWorker struct {
ID int `json:"id"`
Name string `json:"name"`
APIKey string `json:"api_key,omitempty"`
Capabilities string `json:"capabilities"`
Status string `json:"status"`
LastSeen *time.Time `json:"last_seen,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type TranslationJob struct {
ID int64 `json:"id"`
NewsID int64 `json:"noticia_id"`
LangFrom string `json:"lang_from"`
LangTo string `json:"lang_to"`
Title string `json:"title"`
Summary string `json:"summary"`
}
type TranslationResult struct {
JobID int64 `json:"job_id"`
TitleTr string `json:"title_trad"`
SummaryTr string `json:"resumen_trad"`
Error string `json:"error,omitempty"`
}
type WSClientMessage struct {
Type string `json:"type"`
Capabilities string `json:"capabilities,omitempty"`
WorkerName string `json:"worker_name,omitempty"`
Result *TranslationResult `json:"result,omitempty"`
}
type WSServerMessage struct {
Type string `json:"type"`
Job *TranslationJob `json:"job,omitempty"`
}