v3.9.5: sync
This commit is contained in:
@@ -4346,9 +4346,12 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|||||||
except Exception:
|
except Exception:
|
||||||
args = {}
|
args = {}
|
||||||
fc_part = {"functionCall": {"name": fname, "args": args, "id": call_id}}
|
fc_part = {"functionCall": {"name": fname, "args": args, "id": call_id}}
|
||||||
stored_sig = _gemini_get_sig(f"fc:{call_id}")
|
stored_sig = _gemini_get_sig(f"fc:{call_id}") or _gemini_get_sig(f"fc:{fname}")
|
||||||
if stored_sig:
|
if stored_sig:
|
||||||
fc_part["thoughtSignature"] = stored_sig
|
fc_part["thoughtSignature"] = stored_sig
|
||||||
|
fc_part["thought_signature"] = stored_sig
|
||||||
|
else:
|
||||||
|
fc_part["thought_signature"] = "skip_thought_signature_validator"
|
||||||
contents.append({"role": "model", "parts": [fc_part]})
|
contents.append({"role": "model", "parts": [fc_part]})
|
||||||
elif t == "function_call_output":
|
elif t == "function_call_output":
|
||||||
call_id = item.get("call_id", item.get("id", ""))
|
call_id = item.get("call_id", item.get("id", ""))
|
||||||
@@ -4451,9 +4454,11 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|||||||
break
|
break
|
||||||
if latest_user:
|
if latest_user:
|
||||||
serialized = json.dumps(contents, ensure_ascii=False)
|
serialized = json.dumps(contents, ensure_ascii=False)
|
||||||
needle = latest_user.strip()[:120]
|
needle = latest_user.strip().replace("\n", " ")[:120]
|
||||||
if needle and needle not in serialized:
|
escaped_serialized = serialized.replace("\\n", " ")
|
||||||
print(f"[antigravity] WARNING: latest user instruction missing from contents! needle={needle[:60]}...", file=sys.stderr)
|
if needle and needle not in escaped_serialized:
|
||||||
|
print(f"[antigravity] latest user instruction missing from contents, appending", file=sys.stderr)
|
||||||
|
contents.append({"role": "user", "parts": [{"text": latest_user}]})
|
||||||
|
|
||||||
request_body = {"contents": contents}
|
request_body = {"contents": contents}
|
||||||
if system_parts:
|
if system_parts:
|
||||||
@@ -4597,10 +4602,16 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
|||||||
if sig:
|
if sig:
|
||||||
if part.get("functionCall"):
|
if part.get("functionCall"):
|
||||||
fc_id = part["functionCall"].get("id") or part["functionCall"].get("name")
|
fc_id = part["functionCall"].get("id") or part["functionCall"].get("name")
|
||||||
|
fc_name = part["functionCall"].get("name")
|
||||||
if fc_id:
|
if fc_id:
|
||||||
_gemini_store_sig(f"fc:{fc_id}", sig)
|
_gemini_store_sig(f"fc:{fc_id}", sig)
|
||||||
|
if fc_name:
|
||||||
|
_gemini_store_sig(f"fc:{fc_name}", sig)
|
||||||
_gemini_store_sig(f"turn:{resp_id}", sig)
|
_gemini_store_sig(f"turn:{resp_id}", sig)
|
||||||
if part.get("thought"):
|
if part.get("thought"):
|
||||||
|
sig_from_thought = _extract_gemini_sig(part)
|
||||||
|
if sig_from_thought:
|
||||||
|
_gemini_store_sig(f"turn:{resp_id}", sig_from_thought)
|
||||||
continue
|
continue
|
||||||
if "text" in part and not part.get("functionCall"):
|
if "text" in part and not part.get("functionCall"):
|
||||||
text_delta = part["text"]
|
text_delta = part["text"]
|
||||||
|
|||||||
Reference in New Issue
Block a user