- Introduced `Groq_AI_Provider_Google` and `Groq_AI_Provider_Groq` classes for handling AI interactions with Google and Groq respectively. - Enhanced `Groq_AI_Provider_Manager` to register and manage multiple AI providers. - Implemented `Groq_AI_Conversation_Manager` for managing conversation IDs and context hashes. - Added `Groq_AI_Generation_Logger` for logging AI generation events and managing log tables. - Developed `Groq_AI_Prompt_Builder` for constructing prompts and processing AI responses. - Established `Groq_AI_Settings_Manager` for managing plugin settings, including context fields and module configurations.
25 lines
653 B
PHP
25 lines
653 B
PHP
<?php
|
|
|
|
class Groq_AI_Provider_Manager {
|
|
/** @var Groq_AI_Provider_Interface[] */
|
|
private $providers = [];
|
|
|
|
public function __construct() {
|
|
$this->register_provider( new Groq_AI_Provider_Groq() );
|
|
$this->register_provider( new Groq_AI_Provider_OpenAI() );
|
|
$this->register_provider( new Groq_AI_Provider_Google() );
|
|
}
|
|
|
|
public function register_provider( Groq_AI_Provider_Interface $provider ) {
|
|
$this->providers[ $provider->get_key() ] = $provider;
|
|
}
|
|
|
|
public function get_providers() {
|
|
return $this->providers;
|
|
}
|
|
|
|
public function get_provider( $key ) {
|
|
return isset( $this->providers[ $key ] ) ? $this->providers[ $key ] : null;
|
|
}
|
|
}
|