mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-28 03:20:58 +01:00
160bf915aa
Closes #40097 When multiple files are added sequentially to the agent panel, the request JSON incorrectly includes "text" elements containing only spaces. These empty elements cause the Zhipu AI API to return a "text cannot be empty" error. The fix filters out any "text" elements that are empty or contain only whitespaces. UI state when the error occurs: <img width="300" alt="Image" src="https://github.com/user-attachments/assets/c55e5272-3f03-42c0-b412-fa24be2b0043" /> Request JSON (causing the error): ``` { "model": "glm-4.6", "messages": [ { "role": "system", "content": "<<CUT>>" }, { "role": "user", "content": [ { "type": "text", "text": "[@1.txt](zed:///agent/file?path=C%3A%5CTemp%5CTest%5C1.txt)" }, { "type": "text", "text": " " }, { "type": "text", "text": "[@2.txt](zed:///agent/file?path=C%3A%5CTemp%5CTest%5C2.txt)" }, { "type": "text", "text": " describe" }, ``` Release Notes: - Fixed an issue when an OpenAI request contained whitespace-only text content Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>