From 5782b8df3f8321cecee4741f09fa7bd57b1ba546 Mon Sep 17 00:00:00 2001 From: zihanjian Date: Tue, 2 Dec 2025 14:57:14 +0800 Subject: [PATCH] fix(agent): handle newlines in image generation --- backend/src/agent/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/agent/app.py b/backend/src/agent/app.py index 5d6e644..a7493f6 100644 --- a/backend/src/agent/app.py +++ b/backend/src/agent/app.py @@ -46,9 +46,10 @@ def generate_image(req: ImageRequest): """Generate an image for a given prompt and return base64 data URLs.""" try: tools = [{"google_search": {}}] if req.use_search else [] + prompt = req.prompt.replace("\n", " ") response = image_client.models.generate_content( model=IMAGE_MODEL, - contents=req.prompt, + contents=prompt, config=types.GenerateContentConfig( tools=tools, image_config=types.ImageConfig(