ci: enforce code formatting checks for backend and frontend (#1536)

This commit is contained in:
greatmengqi
2026-03-29 15:34:38 +08:00
committed by GitHub
parent 06a623f9c8
commit 084dc7e748
105 changed files with 8253 additions and 7369 deletions
@@ -162,10 +162,7 @@ class ClaudeChatModel(ChatAnthropic):
system = payload.get("system")
if isinstance(system, list):
# Remove any existing billing blocks, then insert a single one at index 0.
filtered = [
b for b in system
if not (isinstance(b, dict) and OAUTH_BILLING_HEADER in b.get("text", ""))
]
filtered = [b for b in system if not (isinstance(b, dict) and OAUTH_BILLING_HEADER in b.get("text", ""))]
payload["system"] = [billing_block] + filtered
elif isinstance(system, str):
if OAUTH_BILLING_HEADER in system:
@@ -183,11 +180,13 @@ class ClaudeChatModel(ChatAnthropic):
hostname = socket.gethostname()
device_id = hashlib.sha256(f"deerflow-{hostname}".encode()).hexdigest()
session_id = str(uuid.uuid4())
payload["metadata"]["user_id"] = json.dumps({
"device_id": device_id,
"account_uuid": "deerflow",
"session_id": session_id,
})
payload["metadata"]["user_id"] = json.dumps(
{
"device_id": device_id,
"account_uuid": "deerflow",
"session_id": session_id,
}
)
def _apply_prompt_caching(self, payload: dict) -> None:
"""Apply ephemeral cache_control to system and recent messages."""
@@ -84,9 +84,7 @@ class PatchedChatOpenAI(ChatOpenAI):
else:
# Fallback: match assistant-role entries positionally against AIMessages.
ai_messages = [m for m in original_messages if isinstance(m, AIMessage)]
assistant_payloads = [
(i, m) for i, m in enumerate(payload_messages) if m.get("role") == "assistant"
]
assistant_payloads = [(i, m) for i, m in enumerate(payload_messages) if m.get("role") == "assistant"]
for (_, payload_msg), ai_msg in zip(assistant_payloads, ai_messages):
_restore_tool_call_signatures(payload_msg, ai_msg)