[PR #20794] 🐛 Fix(Gemini LLM): Support Gemini 0.2.x plugin on agent app #29500

Closed
opened 2026-02-21 20:45:41 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/20794

State: closed
Merged: Yes


Fixes #20204

Summary

Fixed chat agent app with Gemini plugin 0.2.x doesn't work.

Screenshots

image

Before After
None from Chat box. Any response from LLM.

On docker compose logs

api-1            | 2025-06-08 05:16:07.035 ERROR [Thread-5 (worker_with_context)] [app_generator.py:247] - Unknown Error when generating
api-1            | Traceback (most recent call last):
api-1            |   File "/app/api/core/app/apps/chat/app_generator.py", line 227, in _generate_worker
api-1            |     runner.run(
api-1            |   File "/app/api/core/app/apps/chat/app_runner.py", line 217, in run
api-1            |     self._handle_invoke_result(
api-1            |   File "/app/api/core/app/apps/base_app_runner.py", line 279, in _handle_invoke_result
api-1            |     self._handle_invoke_result_stream(invoke_result=invoke_result, queue_manager=queue_manager, agent=agent)
api-1            |   File "/app/api/core/app/apps/base_app_runner.py", line 320, in _handle_invoke_result_stream
api-1            |     text += result.delta.message.content
api-1            | TypeError: can only concatenate str (not "list") to str
nginx-1          | 172.16.18.1 - - [08/Jun/2025:05:16:07 +0000] "POST /console/api/apps/6febf05c-fab0-4f97-bd81-468d24333ffb/chat-messages HTTP/1.1" 500 141 "https://dify.on-o.com/app/6febf05c-fab0-4f97-bd81-468d24333ffb/configuration" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" "240d:1a:17c:3a00:d756:78e4:b069:6921"
api-1            | [2025-06-08 05:16:07 +0000] [19] [ERROR] Error handling request /console/api/apps/6febf05c-fab0-4f97-bd81-468d24333ffb/chat-messages
api-1            | Traceback (most recent call last):
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 54, in handle
api-1            |     self.handle_request(listener_name, req, client, addr)
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/ggevent.py", line 127, in handle_request
api-1            |     super().handle_request(listener_name, req, sock, addr)
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request
api-1            |     for item in respiter:
api-1            |                 ^^^^^^^^
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__
api-1            |     return self._next()
api-1            |            ^^^^^^^^^^^^
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded
api-1            |     for item in iterable:
api-1            |                 ^^^^^^^^
api-1            |   File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 125, in generator
api-1            |     yield from gen
api-1            |   File "/app/api/libs/helper.py", line 203, in generate
api-1            |     yield from response
api-1            |   File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 116, in __next__
api-1            |     return next(self.generator)
api-1            |            ^^^^^^^^^^^^^^^^^^^^
api-1            |   File "/app/api/core/app/apps/base_app_generator.py", line 155, in gen
api-1            |     for message in generator:
api-1            |                    ^^^^^^^^^
api-1            |   File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 25, in _generate_full_response
api-1            |     yield from cls.convert_stream_full_response(response)
api-1            |   File "/app/api/core/app/apps/chat/generate_response_converter.py", line 62, in convert_stream_full_response
api-1            |     for chunk in stream_response:
api-1            |                  ^^^^^^^^^^^^^^^
api-1            |   File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 182, in _to_stream_response
api-1            |     for stream_response in generator:
api-1            |                            ^^^^^^^^^
api-1            |   File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 221, in _wrapper_process_stream_response
api-1            |     for response in self._process_stream_response(publisher=publisher, trace_manager=trace_manager):
api-1            |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1            |   File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 317, in _process_stream_response
api-1            |     current_content += cast(str, delta_text)
api-1            | TypeError: can only concatenate str (not "list") to str

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/20794 **State:** closed **Merged:** Yes --- Fixes #20204 ## Summary <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixed chat agent app with Gemini plugin 0.2.x doesn't work. ## Screenshots ![image](https://github.com/user-attachments/assets/a2704bb5-6b27-4e69-81e8-87dcc4f9a3d9) | Before | After | |--------|-------| |None from Chat box. |Any response from LLM. | On docker compose logs ``` api-1 | 2025-06-08 05:16:07.035 ERROR [Thread-5 (worker_with_context)] [app_generator.py:247] - Unknown Error when generating api-1 | Traceback (most recent call last): api-1 | File "/app/api/core/app/apps/chat/app_generator.py", line 227, in _generate_worker api-1 | runner.run( api-1 | File "/app/api/core/app/apps/chat/app_runner.py", line 217, in run api-1 | self._handle_invoke_result( api-1 | File "/app/api/core/app/apps/base_app_runner.py", line 279, in _handle_invoke_result api-1 | self._handle_invoke_result_stream(invoke_result=invoke_result, queue_manager=queue_manager, agent=agent) api-1 | File "/app/api/core/app/apps/base_app_runner.py", line 320, in _handle_invoke_result_stream api-1 | text += result.delta.message.content api-1 | TypeError: can only concatenate str (not "list") to str nginx-1 | 172.16.18.1 - - [08/Jun/2025:05:16:07 +0000] "POST /console/api/apps/6febf05c-fab0-4f97-bd81-468d24333ffb/chat-messages HTTP/1.1" 500 141 "https://dify.on-o.com/app/6febf05c-fab0-4f97-bd81-468d24333ffb/configuration" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36" "240d:1a:17c:3a00:d756:78e4:b069:6921" api-1 | [2025-06-08 05:16:07 +0000] [19] [ERROR] Error handling request /console/api/apps/6febf05c-fab0-4f97-bd81-468d24333ffb/chat-messages api-1 | Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 54, in handle api-1 | self.handle_request(listener_name, req, client, addr) api-1 | File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/ggevent.py", line 127, in handle_request api-1 | super().handle_request(listener_name, req, sock, addr) api-1 | File "/app/api/.venv/lib/python3.12/site-packages/gunicorn/workers/base_async.py", line 114, in handle_request api-1 | for item in respiter: api-1 | ^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wsgi.py", line 256, in __next__ api-1 | return self._next() api-1 | ^^^^^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/werkzeug/wrappers/response.py", line 32, in _iter_encoded api-1 | for item in iterable: api-1 | ^^^^^^^^ api-1 | File "/app/api/.venv/lib/python3.12/site-packages/flask/helpers.py", line 125, in generator api-1 | yield from gen api-1 | File "/app/api/libs/helper.py", line 203, in generate api-1 | yield from response api-1 | File "/app/api/core/app/features/rate_limiting/rate_limit.py", line 116, in __next__ api-1 | return next(self.generator) api-1 | ^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/app/apps/base_app_generator.py", line 155, in gen api-1 | for message in generator: api-1 | ^^^^^^^^^ api-1 | File "/app/api/core/app/apps/base_app_generate_response_converter.py", line 25, in _generate_full_response api-1 | yield from cls.convert_stream_full_response(response) api-1 | File "/app/api/core/app/apps/chat/generate_response_converter.py", line 62, in convert_stream_full_response api-1 | for chunk in stream_response: api-1 | ^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 182, in _to_stream_response api-1 | for stream_response in generator: api-1 | ^^^^^^^^^ api-1 | File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 221, in _wrapper_process_stream_response api-1 | for response in self._process_stream_response(publisher=publisher, trace_manager=trace_manager): api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py", line 317, in _process_stream_response api-1 | current_content += cast(str, delta_text) api-1 | TypeError: can only concatenate str (not "list") to str ``` ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [ ] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:45:41 -05:00
yindo closed this issue 2026-02-21 20:45:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29500