fix: NameError hashlib in _antigravity_normalize_context, use string comparison instead
This commit is contained in:
@@ -4385,19 +4385,19 @@ def _antigravity_normalize_context(input_data):
|
||||
if msg_item is not input_data[latest_user_idx]:
|
||||
result.append(msg_item)
|
||||
|
||||
latest_hash = hashlib.sha256(" ".join(latest_user.strip().split()).encode()).hexdigest()
|
||||
latest_norm = " ".join(latest_user.strip().split())[:200].lower()
|
||||
already_present = False
|
||||
for r in result:
|
||||
if isinstance(r, dict) and r.get("type") == "message" and r.get("role") == "user":
|
||||
c = r.get("content", "")
|
||||
if isinstance(c, str):
|
||||
rh = hashlib.sha256(" ".join(c.strip().split()).encode()).hexdigest()
|
||||
rn = " ".join(c.strip().split())[:200].lower()
|
||||
elif isinstance(c, list):
|
||||
combined = " ".join(p.get("text", p.get("input_text", "")) for p in c if isinstance(p, dict))
|
||||
rh = hashlib.sha256(" ".join(combined.strip().split()).encode()).hexdigest()
|
||||
rn = " ".join(combined.strip().split())[:200].lower()
|
||||
else:
|
||||
rh = ""
|
||||
if rh == latest_hash:
|
||||
rn = ""
|
||||
if rn == latest_norm:
|
||||
already_present = True
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user