add new md files
This commit is contained in:
@@ -13,6 +13,7 @@ parameters:
|
||||
|
||||
mto.vector.python_bin: '/var/www/html/.venv/bin/python3'
|
||||
mto.vector.ingest_script: '/src/Vector/vector_ingest.py'
|
||||
mto.vector.search_script: '%kernel.project_dir%/src/Vector/vector_search.py'
|
||||
|
||||
mto.vector.data.path: '%kernel.project_dir%/var/knowledge'
|
||||
mto.vector.data.upload.path: '%mto.vector.data.path%/uploads'
|
||||
@@ -104,7 +105,8 @@ services:
|
||||
|
||||
App\Vector\VectorSearchClient:
|
||||
arguments:
|
||||
$vectorDir: '%kernel.project_dir%/var/knowledge'
|
||||
$binPythonDir: '%mto.vector.python_bin%'
|
||||
$vectorSearchPyPath: '%mto.vector.search_script%'
|
||||
|
||||
App\Vector\VectorIndexBuilder:
|
||||
arguments:
|
||||
|
||||
@@ -9,14 +9,15 @@ use Psr\Log\LoggerInterface;
|
||||
final class VectorSearchClient
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $vectorDir,
|
||||
private readonly string $binPythonDir,
|
||||
private readonly string $vectorSearchPyPath,
|
||||
private LoggerInterface $agentLogger,
|
||||
) {
|
||||
}
|
||||
|
||||
public function search(string $query, int $limit = 5): array
|
||||
{
|
||||
$script = rtrim($this->vectorDir, '/') . '/vector_search.py';
|
||||
$script = $this->vectorSearchPyPath;
|
||||
$this->agentLogger->info("Run vector search script $script");
|
||||
if (!is_file($script)) {
|
||||
return [];
|
||||
@@ -25,7 +26,7 @@ final class VectorSearchClient
|
||||
// -------------------------------------------------
|
||||
// Determine Python interpreter (venv preferred)
|
||||
// -------------------------------------------------
|
||||
$venvPython = $this->vectorDir . '/.venv/bin/python';
|
||||
$venvPython = $this->binPythonDir;
|
||||
$pythonBin = is_file($venvPython) ? $venvPython : 'python3';
|
||||
|
||||
$cmd = sprintf(
|
||||
|
||||
@@ -16,7 +16,7 @@ limit = int(sys.argv[2])
|
||||
|
||||
vector_dir = Path(__file__).resolve().parent
|
||||
index_path = vector_dir / "vector.index"
|
||||
meta_path = vector_dir / "vector_meta.json"
|
||||
meta_path = vector_dir / "vector.index.meta.json"
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Dependency checks (controlled)
|
||||
|
||||
Reference in New Issue
Block a user