Skip to content

fix: Update prompt message content types to use Literal and add union type for content #17136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

zalcit
Copy link
Contributor

@zalcit zalcit commented Mar 30, 2025

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.

Tip

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

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

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working labels Mar 30, 2025
@crazywoola crazywoola requested review from laipz8200 and Copilot April 17, 2025 01:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

api/core/model_runtime/entities/message_entities.py:63

  • [nitpick] The base class 'PromptMessageContent' is now empty after removing the original type field. Consider adding a brief comment explaining that this is intentional to support polymorphic behavior via the 'type' field defined in the subclasses.
pass

api/core/model_runtime/entities/message_entities.py:115

  • [nitpick] Consider renaming 'PromptMessageContentUnionTypes' to 'PromptMessageContentUnion' for brevity and improved clarity.
PromptMessageContentUnionTypes = Annotated[

@crazywoola crazywoola force-pushed the fix_update_prompt_message_content_types branch from 7123413 to a23b9cf Compare April 17, 2025 01:13
@crazywoola
Copy link
Member

Hello, I rebased the code to the latest branch, could you fix the errors in the CI?

@zalcit zalcit force-pushed the fix_update_prompt_message_content_types branch from 565f2ec to 92a7d43 Compare April 17, 2025 15:55
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 17, 2025
@zalcit
Copy link
Contributor Author

zalcit commented Apr 17, 2025

Hello, I rebased the code to the latest branch, could you fix the errors in the CI?

@crazywoola done for this

laipz8200
laipz8200 previously approved these changes Apr 18, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 18, 2025
@zalcit zalcit force-pushed the fix_update_prompt_message_content_types branch from 0d57515 to 81b8878 Compare April 21, 2025 15:11
@zalcit zalcit requested a review from laipz8200 April 21, 2025 15:12
@crazywoola
Copy link
Member

Hello still have the same errors.

@zalcit
Copy link
Contributor Author

zalcit commented Apr 22, 2025

Hello still have the same errors.

try again

@laipz8200 laipz8200 mentioned this pull request Apr 22, 2025
6 tasks
@laipz8200 laipz8200 merged commit a1158cc into langgenius:main Apr 22, 2025
6 checks passed
@zalcit zalcit deleted the fix_update_prompt_message_content_types branch April 22, 2025 08:42
@dosubot dosubot bot mentioned this pull request Apr 23, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PromptMessage type error
3 participants