mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-08-22 07:32:27 +02:00
- Add LLM executor supporting OpenAI vision, tool calling, embeddings, and structured outputs - Introduce event emitter/receiver workflows with deduplication and filtering (generate_event functions) - Add workflow extends/override system enabling inheritance chains and step merge modes - Update function naming to snake_case across all testdata (fileExists→file_exists, etc.) - Add comprehensive test fixtures for linter, events, CDN, step dependencies, and extends workflows
45 lines
943 B
Go
45 lines
943 B
Go
package distributed
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/j3ssie/osmedeus/v5/internal/config"
|
|
)
|
|
|
|
var (
|
|
sharedClient *Client
|
|
sharedOnce sync.Once
|
|
sharedErr error
|
|
)
|
|
|
|
// GetSharedClient returns a singleton Redis client for distributed mode.
|
|
// Returns nil if Redis is not configured.
|
|
func GetSharedClient() (*Client, error) {
|
|
cfg := config.Get()
|
|
if cfg == nil || !cfg.IsRedisConfigured() {
|
|
return nil, nil
|
|
}
|
|
|
|
sharedOnce.Do(func() {
|
|
sharedClient, sharedErr = NewClientFromConfig(cfg)
|
|
})
|
|
|
|
return sharedClient, sharedErr
|
|
}
|
|
|
|
// ResetSharedClient resets the shared client (useful for testing)
|
|
func ResetSharedClient() {
|
|
if sharedClient != nil {
|
|
sharedClient.Close()
|
|
}
|
|
sharedClient = nil
|
|
sharedOnce = sync.Once{}
|
|
sharedErr = nil
|
|
}
|
|
|
|
// SetSharedClient sets the shared client (useful for testing or custom initialization)
|
|
func SetSharedClient(client *Client) {
|
|
sharedClient = client
|
|
sharedOnce.Do(func() {}) // Mark as initialized
|
|
}
|