fix: drop remaining guessed-key fallback in cloud chat response parsing

The chat completions response is strictly OpenAI-shaped; top-level
'content'/'answer' keys never existed. Same cleanup as the tree/OCR
parsing fix.
This commit is contained in:
Ray 2026-07-21 16:39:42 +08:00
parent 1790e0cf2c
commit 4ffc6b5c0c

View file

@ -424,11 +424,10 @@ class CloudBackend:
"doc_id": doc_id,
"stream": False,
})
# Extract answer from response
choices = resp.get("choices", [])
if choices:
return choices[0].get("message", {}).get("content", "")
return resp.get("content", resp.get("answer", ""))
return ""
async def query_stream(self, collection: str, question: str,
doc_ids: str | list[str] | None = None) -> AsyncIterator[QueryEvent]: