Skip to content

Conversation

@polina-c
Copy link
Collaborator

@polina-c polina-c commented Dec 24, 2025

  1. Remove ChatMessageRole: this library should not enforce the set of roles, that can vary from case to case. The role should be part of envelope in client's code.
  2. Rename ChatMessage to Message, because this library can be used in chats and in other systems.
  3. Use constants for repeating literals
  4. Remove postfix 'Part' from part type literals, to reduce size of messages.
  5. Extend test coverage for primitives.
  6. Add test for example.
  7. fix case of null in nameFromMimeType
  8. Followed Gemini's advises below

gemini-code-assist[bot]

This comment was marked as outdated.

@polina-c polina-c changed the title - Some cleanups to make the library useable for wide range of use cases. Dec 24, 2025
@polina-c polina-c changed the title Some cleanups to make the library useable for wide range of use cases. Updates to make the library applicable for wide range of use cases. Dec 24, 2025
@polina-c polina-c changed the title Updates to make the library applicable for wide range of use cases. Updates to make the library applicable for wider range of use cases. Dec 24, 2025
gemini-code-assist[bot]

This comment was marked as outdated.

@polina-c
Copy link
Collaborator Author

/gemini review

@polina-c polina-c marked this pull request as ready for review December 24, 2025 06:08
@polina-c
Copy link
Collaborator Author

polina-c commented Dec 24, 2025

@csells , how does it look?

Options for name for the class ChatMessage:

  1. Message (I used it for now, but I am open)
  2. MessageBody
  3. MessageContent
  4. Content

@polina-c polina-c changed the title Updates to make the library applicable for wider range of use cases. Updates to make the library applicable for wider range of use cases, and more stable. Dec 24, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several significant and beneficial changes to make the library more flexible and robust. Key changes include removing the enforced ChatMessageRole, renaming ChatMessage to Message, and using constants for JSON keys to reduce message size. The test coverage has been significantly improved, including a new test for the example, which is excellent. My review focuses on some opportunities to improve code clarity and leverage more modern Dart features, such as using const constructors for immutable classes and refactoring switch statements/expressions for better readability. Overall, this is a solid pull request that improves the library's design and usability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant