Fix long tool call id handling and add Chinese quick usage.
Build Status / build (push) Successful in 1m52s

Normalize tool call IDs to Azure's 64-char limit and document a Chinese quick setup flow for Cursor + Azure GPT-5.4 deployment.

Made-with: Cursor
This commit is contained in:
gongzhiyong
2026-04-26 15:43:09 +08:00
parent 45c5874712
commit 4e86e37202
2 changed files with 37 additions and 3 deletions
+28
View File
@@ -281,3 +281,31 @@ docker push your-tag
```
</details>
## Chinese Quick Usage (Cursor + Azure GPT-5.4)
1. Deploy and run service:
```bash
docker compose up -d flask-prod
```
2. Set `.env` key values:
```env
SERVICE_API_KEY=change-me
AZURE_BASE_URL=https://<your-resource>.cognitiveservices.azure.com
AZURE_API_KEY=<your-azure-api-key>
AZURE_DEPLOYMENT=gpt-5.4
```
3. In Cursor settings:
- Override OpenAI Base URL: your public URL, e.g. `https://<your-tunnel>.trycloudflare.com`
- OpenAI API Key: same as `SERVICE_API_KEY`
- Add custom models: `gpt-high`, `gpt-medium`, `gpt-low`, `gpt-minimal`
4. Optional quick tunnel:
```bash
cloudflared tunnel --url http://localhost:8080
```
+8 -2
View File
@@ -58,6 +58,12 @@ class RequestAdapter:
headers["api-key"] = api_key
return headers
def _normalize_call_id(self, call_id: Any) -> str:
"""Return an Azure-compatible call_id (max length 64)."""
if call_id is None:
return ""
return str(call_id)[:64]
def _messages_to_responses_input_and_instructions(
self, messages: List[Dict[str, Any]]
) -> Dict[str, Any]:
@@ -72,7 +78,7 @@ class RequestAdapter:
continue
# For user/assistant/tools as inputs
if role == "tool":
call_id = m.get("tool_call_id")
call_id = self._normalize_call_id(m.get("tool_call_id"))
item = {
"type": "function_call_output",
"output": self._content_to_text(content),
@@ -96,7 +102,7 @@ class RequestAdapter:
if tool_calls := m.get("tool_calls"):
for tool_call in tool_calls:
function = tool_call.get("function", {})
call_id = tool_call.get("id")
call_id = self._normalize_call_id(tool_call.get("id"))
item = {
"type": "function_call",
"name": function.get("name"),