All checks were successful
Deploy / Deploy to Production (push) Successful in 22s
- Ajout de tobimori/kirby-seo via Composer
- snippet('seo/head') dans header.php (remplace les meta manuels)
- snippet('seo/schemas') dans footer.php pour JSON-LD
- Onglet SEO ajouté dans site.yml et tous les blueprints de pages
- Configuration SEO dans config.php (sitemap, robots, canonicalBase TODO)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1,011 B
PHP
40 lines
1,011 B
PHP
<?php
|
|
|
|
namespace tobimori\Seo\Ai;
|
|
|
|
use Generator;
|
|
use Kirby\Exception\InvalidArgumentException;
|
|
use tobimori\Seo\Seo;
|
|
|
|
abstract class Driver
|
|
{
|
|
public function __construct(protected string $providerId)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Streams a response for the given content.
|
|
*
|
|
* @param array<Content> $content Array of Content messages forming a conversation.
|
|
* @param string|null $model Model override.
|
|
*
|
|
* @return Generator<int, Chunk, mixed, void>
|
|
*/
|
|
abstract public function stream(array $content, string|null $model = null): Generator;
|
|
|
|
/**
|
|
* Returns a configuration value or throws when required.
|
|
*/
|
|
protected function config(string $key, mixed $default = null, bool $required = false): mixed
|
|
{
|
|
$value = Seo::option("ai.providers.{$this->providerId}.config.{$key}", $default);
|
|
|
|
if ($required === true && ($value === null || $value === '')) {
|
|
throw new InvalidArgumentException(
|
|
"Missing required \"{$key}\" configuration for driver " . static::class . '.'
|
|
);
|
|
}
|
|
|
|
return $value;
|
|
}
|
|
}
|