Refactor AI summarizer client initialization to include MongoDB manager and add statistics endpoint

- Updated `InitAISummarizerClient` to accept `mongoManager` for tracking translation success.
- Introduced new `Statistics` endpoint in the dashboard to fetch scraping and translation statistics.
- Enhanced `TranslationWorker` to utilize the new success counter for tracking successful translations.
- Added necessary data structures and query forms for statistics reporting.

This refactor improves the tracking of AI translation success and provides new insights through the dashboard statistics.
This commit is contained in:
Mazyar
2026-06-06 21:20:53 +03:30
parent 5af3bfaa1a
commit 68b170126d
17 changed files with 507 additions and 44 deletions
+5
View File
@@ -1,6 +1,7 @@
package ai_summarizer
import (
"context"
"errors"
"fmt"
"time"
@@ -15,6 +16,10 @@ type Config struct {
APIRetryCount int // Number of retry attempts for failed API requests
APIRetryDelay time.Duration // Delay between retry attempts
// OnSuccessfulTranslation is called after a successful POST /ai/translate request.
// source identifies the caller (daily_job or manual_trigger).
OnSuccessfulTranslation func(ctx context.Context, source string) error
// MinIO storage settings
MinioEndpoint string // MinIO endpoint, e.g. "ai-host:9000"
MinioAccessKey string // MinIO access key ID