Роутер работает нормально в process v2
This commit is contained in:
@@ -2,20 +2,20 @@ from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
from app.modules.agent.runtime import (
|
||||
from app.core.agent.runtime import (
|
||||
AgentRuntimeExecutor,
|
||||
DocsQAPipelineRunner,
|
||||
RuntimeRepoContextFactory,
|
||||
RuntimeRetrievalAdapter,
|
||||
)
|
||||
from app.modules.agent.llm import AgentLlmService
|
||||
from app.modules.agent.llm.prompt_loader import PromptLoader
|
||||
from app.modules.agent.runtime.steps.context import build_retrieval_request, build_retrieval_result
|
||||
from app.modules.agent.intent_router_v2 import ConversationState, IntentRouterV2
|
||||
from app.modules.agent.intent_router_v2.factory import GigaChatIntentRouterFactory
|
||||
from app.modules.shared.gigachat.client import GigaChatClient
|
||||
from app.modules.shared.gigachat.settings import GigaChatSettings
|
||||
from app.modules.shared.gigachat.token_provider import GigaChatTokenProvider
|
||||
from app.core.agent.llm import AgentLlmService
|
||||
from app.core.agent.llm.prompt_loader import PromptLoader
|
||||
from app.core.agent.runtime.steps.context import build_retrieval_request, build_retrieval_result
|
||||
from app.core.agent.intent_router import ConversationState, IntentRouterV2
|
||||
from app.core.agent.intent_router.factory import GigaChatIntentRouterFactory
|
||||
from app.core.shared.gigachat.client import GigaChatClient
|
||||
from app.core.shared.gigachat.settings import GigaChatSettings
|
||||
from app.core.shared.gigachat.token_provider import GigaChatTokenProvider
|
||||
from tests.pipeline_setup_v3.core.models import ExecutionPayload, V3Case
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ class AgentRuntimeAdapter:
|
||||
) -> dict:
|
||||
route_dump = route.model_dump(mode="json") if route else {}
|
||||
return {
|
||||
"domain": route_dump.get("routing_domain") or route_dump.get("domain") or _infer_domain(route_dump.get("intent")),
|
||||
"intent": route_dump.get("intent"),
|
||||
"sub_intent": dict(route_dump.get("query_plan") or {}).get("sub_intent"),
|
||||
"graph_id": route_dump.get("graph_id"),
|
||||
@@ -262,6 +263,7 @@ class AgentRuntimeAdapter:
|
||||
entity_candidates = tuple(diagnostics.query_entity_candidates or self._docs_entity_candidates(result.raw_rows))
|
||||
doc_scope = tuple(diagnostics.doc_ids or self._docs_scope(result.raw_rows))
|
||||
return {
|
||||
"domain": getattr(route, "routing_domain", None) or getattr(route, "domain", None) or _infer_domain(route.intent),
|
||||
"intent": route.intent,
|
||||
"sub_intent": route.query_plan.sub_intent,
|
||||
"graph_id": route.graph_id,
|
||||
@@ -287,6 +289,7 @@ class AgentRuntimeAdapter:
|
||||
|
||||
def _stubbed_code_payload(self, case: V3Case, route) -> ExecutionPayload:
|
||||
actual = {
|
||||
"domain": _infer_domain(route.intent),
|
||||
"intent": route.intent,
|
||||
"sub_intent": route.query_plan.sub_intent,
|
||||
"graph_id": route.graph_id,
|
||||
@@ -493,3 +496,12 @@ def _input_step(query: str) -> dict:
|
||||
"input": {"query": query},
|
||||
"output": {"query": query},
|
||||
}
|
||||
|
||||
|
||||
def _infer_domain(intent: str | None) -> str | None:
|
||||
value = str(intent or "").strip()
|
||||
if value == "GENERAL_QA":
|
||||
return "GENERAL"
|
||||
if value in {"DOCUMENTATION_EXPLAIN", "DOC_EXPLAIN"}:
|
||||
return "DOCS"
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user