fix: replace AiGateway.embedBatch with direct LiteLLM cURL for upload indexing
AiGateway uses getenv(LITELLM_MASTER_KEY) + stream_context HTTP which was failing on the chloe virtualhost process. New dbnToolsLiteLLMEmbedBatch() helper mirrors dbnToolsCallGpuLlm — hardcoded URL + key, cURL-first, same pattern already proven for LLM calls. Removes AiGateway dependency from DeepResearchAgent entirely. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,6 @@ final class DbnDeepResearchAgent
|
||||
private const POOL_CAP = 30;
|
||||
|
||||
private DbnAzureOpenAiGateway $azure;
|
||||
private ?AiGateway $ai = null;
|
||||
private array $uploadVecs = [];
|
||||
private array $stepTimings = [];
|
||||
|
||||
@@ -50,9 +49,7 @@ final class DbnDeepResearchAgent
|
||||
dbnToolsBootCaveau();
|
||||
$aiPortalRoot = dbnToolsAiPortalRoot();
|
||||
require_once $aiPortalRoot . '/platform/includes/dbn_v6.php';
|
||||
require_once $aiPortalRoot . '/lib/ai/AiGateway.php';
|
||||
|
||||
$this->ai = new AiGateway();
|
||||
$this->uploadVecs = [];
|
||||
$this->stepTimings = [];
|
||||
|
||||
@@ -141,7 +138,7 @@ final class DbnDeepResearchAgent
|
||||
if ($uploadChunks) {
|
||||
try {
|
||||
$texts = array_map(fn(array $c) => $c['text'], $uploadChunks);
|
||||
$vecs = $this->ai->embedBatch($texts, 'nomic-embed-text');
|
||||
$vecs = dbnToolsLiteLLMEmbedBatch($texts);
|
||||
if (count($vecs) === count($uploadChunks)) {
|
||||
foreach ($uploadChunks as $i => $chunk) {
|
||||
$this->uploadVecs[] = [
|
||||
@@ -531,7 +528,7 @@ PROMPT;
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
$qVec = $this->ai->embed($question, 'nomic-embed-text');
|
||||
$qVec = dbnToolsLiteLLMEmbedBatch([$question])[0] ?? [];
|
||||
} catch (Throwable $e) {
|
||||
error_log('DBN deep research sub-Q embed failed: ' . $e->getMessage());
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user