Integrated AI summary
This commit is contained in:
@@ -3,6 +3,7 @@ package bootstrap
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
ai_summarizer "tm/pkg/ai_summarizer"
|
||||
"tm/pkg/authorization"
|
||||
"tm/pkg/config"
|
||||
"tm/pkg/filestore"
|
||||
@@ -333,3 +334,75 @@ func InitFileStore(mongoManager *mongo.ConnectionManager, log logger.Logger) (*f
|
||||
|
||||
return fileStoreService, nil
|
||||
}
|
||||
|
||||
// InitAISummarizerClient initializes the AI summarizer HTTP client for on-demand summarization
|
||||
func InitAISummarizerClient(conf AISummarizerConfig, log logger.Logger) *ai_summarizer.Client {
|
||||
if conf.APIBaseURL == "" {
|
||||
log.Warn("AI Summarizer API base URL not configured, on-demand summarization will be unavailable", map[string]interface{}{})
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := &ai_summarizer.Config{
|
||||
APIBaseURL: conf.APIBaseURL,
|
||||
APITimeout: conf.APITimeout,
|
||||
APIRetryCount: conf.APIRetryCount,
|
||||
APIRetryDelay: conf.APIRetryDelay,
|
||||
MinioEndpoint: conf.MinioEndpoint,
|
||||
MinioAccessKey: conf.MinioAccessKey,
|
||||
MinioSecretKey: conf.MinioSecretKey,
|
||||
MinioUseSSL: conf.MinioUseSSL,
|
||||
MinioRegion: conf.MinioRegion,
|
||||
MinioBucket: conf.MinioBucket,
|
||||
}
|
||||
|
||||
client, err := ai_summarizer.NewClient(cfg, log)
|
||||
if err != nil {
|
||||
log.Error("Failed to initialize AI Summarizer client", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Info("AI Summarizer HTTP client initialized successfully", map[string]interface{}{
|
||||
"base_url": conf.APIBaseURL,
|
||||
"timeout": conf.APITimeout,
|
||||
})
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
// InitAISummarizerStorage initializes the AI summarizer MinIO storage client
|
||||
func InitAISummarizerStorage(conf AISummarizerConfig, log logger.Logger) *ai_summarizer.StorageClient {
|
||||
if conf.MinioEndpoint == "" {
|
||||
log.Warn("AI Summarizer MinIO endpoint not configured, storage-based summaries will be unavailable", map[string]interface{}{})
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := &ai_summarizer.Config{
|
||||
APIBaseURL: conf.APIBaseURL,
|
||||
APITimeout: conf.APITimeout,
|
||||
APIRetryCount: conf.APIRetryCount,
|
||||
APIRetryDelay: conf.APIRetryDelay,
|
||||
MinioEndpoint: conf.MinioEndpoint,
|
||||
MinioAccessKey: conf.MinioAccessKey,
|
||||
MinioSecretKey: conf.MinioSecretKey,
|
||||
MinioUseSSL: conf.MinioUseSSL,
|
||||
MinioRegion: conf.MinioRegion,
|
||||
MinioBucket: conf.MinioBucket,
|
||||
}
|
||||
|
||||
storage, err := ai_summarizer.NewStorageClient(cfg, log)
|
||||
if err != nil {
|
||||
log.Error("Failed to initialize AI Summarizer storage client", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Info("AI Summarizer storage client initialized successfully", map[string]interface{}{
|
||||
"endpoint": conf.MinioEndpoint,
|
||||
"bucket": conf.MinioBucket,
|
||||
})
|
||||
|
||||
return storage
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user