deploy: auto commit server changes 2026-06-12 17:18:58
This commit is contained in:
@@ -33,7 +33,7 @@ class AiAssistantContextService
|
||||
$hits = self::retrieveKnowledge($message, $userId, $sessionId, $topK, $plan);
|
||||
$matchItems = self::searchMatches($message, $plan);
|
||||
$cryptoItems = self::resolveCryptoContext($message, $plan);
|
||||
$payload = self::composePayload($hits, $matchItems, $cryptoItems, $plan);
|
||||
$payload = self::composePayload($hits, $matchItems, $cryptoItems, [], $plan);
|
||||
|
||||
return array_merge($payload, [
|
||||
'knowledge_hits' => $hits,
|
||||
@@ -42,9 +42,18 @@ class AiAssistantContextService
|
||||
]);
|
||||
}
|
||||
|
||||
public static function composePayload(array $hits, array $matchItems, array $cryptoItems, array $plan = []): array
|
||||
public static function composePayload(
|
||||
array $hits,
|
||||
array $matchItems,
|
||||
array $cryptoItems,
|
||||
array $webNewsItems = [],
|
||||
array $plan = []
|
||||
): array
|
||||
{
|
||||
$sources = [];
|
||||
foreach ($webNewsItems as $item) {
|
||||
$sources[] = $item['source'];
|
||||
}
|
||||
foreach ($hits as $hit) {
|
||||
$sources[] = self::sourceFromKbHit($hit);
|
||||
}
|
||||
@@ -58,6 +67,7 @@ class AiAssistantContextService
|
||||
$sources = self::uniqueSources($sources);
|
||||
$context = [
|
||||
'query_plan' => self::compactPlan($plan),
|
||||
'web_news_context' => array_column($webNewsItems, 'context'),
|
||||
'knowledge_hits' => array_map([self::class, 'compactHit'], $hits),
|
||||
'match_context' => array_column($matchItems, 'context'),
|
||||
'crypto_realtime' => array_column($cryptoItems, 'context'),
|
||||
@@ -66,7 +76,7 @@ class AiAssistantContextService
|
||||
return [
|
||||
'context_text' => json_encode($context, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT),
|
||||
'sources' => array_values($sources),
|
||||
'has_context' => !empty($hits) || !empty($matchItems) || !empty($cryptoItems),
|
||||
'has_context' => !empty($webNewsItems) || !empty($hits) || !empty($matchItems) || !empty($cryptoItems),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user