atlasbot: avoid namespace-only workload matches
This commit is contained in:
parent
3f159c6c83
commit
354275f3ad
@ -16,7 +16,7 @@ spec:
|
||||
labels:
|
||||
app: atlasbot
|
||||
annotations:
|
||||
checksum/atlasbot-configmap: manual-atlasbot-50
|
||||
checksum/atlasbot-configmap: manual-atlasbot-51
|
||||
vault.hashicorp.com/agent-inject: "true"
|
||||
vault.hashicorp.com/role: "comms"
|
||||
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"
|
||||
|
||||
@ -1071,11 +1071,17 @@ def workload_answer(prompt: str, workloads: list[dict[str, Any]]) -> str:
|
||||
q = normalize_query(prompt)
|
||||
if not any(word in q for word in ("where", "which", "node", "run", "running", "host", "located")):
|
||||
return ""
|
||||
target = _workload_query_target(prompt)
|
||||
entry = _select_workload(prompt, workloads)
|
||||
if not entry:
|
||||
return ""
|
||||
workload = entry.get("workload") or ""
|
||||
namespace = entry.get("namespace") or ""
|
||||
if target:
|
||||
workload_l = str(workload).lower()
|
||||
namespace_l = str(namespace).lower()
|
||||
if workload_l != target and namespace_l == target and "namespace" not in q and "workload" not in q:
|
||||
return ""
|
||||
nodes = entry.get("nodes") if isinstance(entry.get("nodes"), dict) else {}
|
||||
primary = entry.get("primary_node") or ""
|
||||
if not workload or not nodes:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user