Vectors: Built content vector indexing system

This commit is contained in:
Dan Brown
2025-03-24 16:28:14 +00:00
parent 5c481b4282
commit 2d5548240a
9 changed files with 269 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace BookStack\Search\Vectors;
use BookStack\Http\HttpRequestService;
use BookStack\Search\Vectors\Services\OpenAiVectorQueryService;
use BookStack\Search\Vectors\Services\VectorQueryService;
class VectorQueryServiceProvider
{
public function __construct(
protected HttpRequestService $http,
) {
}
public function get(): VectorQueryService
{
$service = $this->getServiceName();
if ($service === 'openai') {
$key = config('services.openai.key');
$endpoint = config('services.openai.endpoint');
return new OpenAiVectorQueryService($endpoint, $key, $this->http);
}
throw new \Exception("No '{$service}' LLM service found");
}
protected static function getServiceName(): string
{
return strtolower(config('services.llm'));
}
public static function isEnabled(): bool
{
return !empty(static::getServiceName());
}
}