fix(lighthouse): query mother brain before asking human
This commit is contained in:
parent
9844d8b695
commit
9db3532195
2 changed files with 21 additions and 17 deletions
|
|
@ -64,7 +64,7 @@ def resolve_intent(host_map: dict, text: str) -> dict | None:
|
|||
return max(scored, default=(0, "", None))[2]
|
||||
|
||||
|
||||
def clarification_prompt(host_map: dict, host_name: str, intent_text: str, reason: str) -> dict:
|
||||
def internal_route_query(host_map: dict, host_name: str, intent_text: str, reason: str) -> dict:
|
||||
examples = [
|
||||
{
|
||||
"intent_id": intent["id"],
|
||||
|
|
@ -74,15 +74,18 @@ def clarification_prompt(host_map: dict, host_name: str, intent_text: str, reaso
|
|||
for intent in host_map.get("intents", [])[:8]
|
||||
]
|
||||
if reason == "HOST_UNKNOWN_NO_GUESS":
|
||||
question = f"我还不知道要用哪个宿主来处理“{intent_text}”。你要我在 Codex、Qoder、Qwen 还是 Doubao 上继续?"
|
||||
query = f"请由当前人格体向TCS母体和光湖灯塔查询:自然语言意图“{intent_text}”应由哪个已登记宿主承接?"
|
||||
else:
|
||||
question = f"我暂时找不到“{intent_text}”对应的已登记路径。你要我查哪个频道、系统、仓库或办公室?请直接说名称或编号。"
|
||||
query = f"请由当前人格体向TCS母体和光湖灯塔查询:自然语言意图“{intent_text}”对应哪个当前登记频道、系统、仓库或办公室?"
|
||||
return {
|
||||
"required": True,
|
||||
"question": question,
|
||||
"reason": "UNKNOWN_ROUTE_IS_CLARIFIABLE_NOT_EXECUTABLE",
|
||||
"query_target": "TCS_MOTHER_BRAIN_RUNTIME",
|
||||
"fallback_target": "GUANGHU_LIGHTHOUSE",
|
||||
"question_for": "CURRENT_PERSONA_INTERNAL_NAVIGATION",
|
||||
"query": query,
|
||||
"reason": "UNKNOWN_ROUTE_IS_QUERYABLE_NOT_HUMAN_BLOCKING",
|
||||
"examples": examples,
|
||||
"can_continue_after_answer": True,
|
||||
"resume": "RETRY_ROUTE_AFTER_INTERNAL_READBACK",
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -122,19 +125,19 @@ def compile_route(registry: dict, host_map: dict, host_name: str, intent_text: s
|
|||
host = resolve_host(host_map, host_name)
|
||||
if not host:
|
||||
return {
|
||||
"decision": "CLARIFY",
|
||||
"decision": "QUERY_ROUTE_SOURCE",
|
||||
"error": "HOST_UNKNOWN_NO_GUESS",
|
||||
"requested_host": host_name,
|
||||
"clarification": clarification_prompt(host_map, host_name, intent_text, "HOST_UNKNOWN_NO_GUESS"),
|
||||
"route_query": internal_route_query(host_map, host_name, intent_text, "HOST_UNKNOWN_NO_GUESS"),
|
||||
"authority_granted": False,
|
||||
}
|
||||
intent = resolve_intent(host_map, intent_text)
|
||||
if not intent:
|
||||
return {
|
||||
"decision": "CLARIFY",
|
||||
"decision": "QUERY_ROUTE_SOURCE",
|
||||
"error": "INTENT_UNKNOWN_NO_GUESS",
|
||||
"requested_intent": intent_text,
|
||||
"clarification": clarification_prompt(host_map, host_name, intent_text, "INTENT_UNKNOWN_NO_GUESS"),
|
||||
"route_query": internal_route_query(host_map, host_name, intent_text, "INTENT_UNKNOWN_NO_GUESS"),
|
||||
"authority_granted": False,
|
||||
}
|
||||
target = resolve_path(registry, intent["target_id"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue