[PR #11745] chore: improve gemini models #27349

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

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

State: closed
Merged: Yes


Summary

Tip

Close issue syntax: Fixes #<issue number> or Resolves #<issue number>, see documentation for more details.

1. add some missing features of some models

2. use the property of MultiModelPromptMessageContent

3. fix may raise error on windows platform

2024-12-16 23:14:12,294.294 ERROR [Thread-11 (_generate_worker)] [app_generator.py:239] - Error when generating
Traceback (most recent call last):
  File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\__base\large_language_model.py", line 110, in invoke
    result = self._invoke(
             ^^^^^^^^^^^^^
  File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 66, in _invoke
    return self._generate(model, credentials, prompt_messages, model_parameters, tools, stop, stream, user)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 195, in _generate
    content = self._format_message_to_glm_content(msg)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 383, in _format_message_to_glm_content
    glm_content["parts"].append(self._upload_file_content_to_google(c))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 365, in _upload_file_content_to_google
    os.unlink(temp_file.name)
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\hejl\\AppData\\Local\\Temp\\tmpear9twnj'

Screenshots

Before After
... ...

Checklist

Important

Please review the checklist below before submitting your pull request.

  • 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/11745 **State:** closed **Merged:** Yes --- # Summary > [!Tip] > Close issue syntax: `Fixes #<issue number>` or `Resolves #<issue number>`, see [documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) for more details. ### 1. add some missing features of some models ### 2. use the property of `MultiModelPromptMessageContent` ### 3. fix may raise error on windows platform ``` 2024-12-16 23:14:12,294.294 ERROR [Thread-11 (_generate_worker)] [app_generator.py:239] - Error when generating Traceback (most recent call last): File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\__base\large_language_model.py", line 110, in invoke result = self._invoke( ^^^^^^^^^^^^^ File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 66, in _invoke return self._generate(model, credentials, prompt_messages, model_parameters, tools, stop, stream, user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 195, in _generate content = self._format_message_to_glm_content(msg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 383, in _format_message_to_glm_content glm_content["parts"].append(self._upload_file_content_to_google(c)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hejl\PycharmProjects\dify\api\core\model_runtime\model_providers\google\llm\llm.py", line 365, in _upload_file_content_to_google os.unlink(temp_file.name) PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\hejl\\AppData\\Local\\Temp\\tmpear9twnj' ``` # Screenshots | Before | After | |--------|-------| | ... | ... | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] 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. - [x] 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:41:21 -05:00
yindo closed this issue 2026-02-21 20:41:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#27349