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