'cmm question --repeat' supports multiple questions, added tests and fixes #15

Merged
juk0de merged 11 commits from repeat_multi into main 2023-09-26 18:04:29 +02:00
Collaborator

This PR primarily modifies the cmm question --repeat command to allow repeating multiple questions, instead of only the last one.

Additionally, this PR includes the following changes:

  • In ai_factory.py, added optional parameters 'def_ai' and 'def_model' to the create_ai function which allows specifying a default AI and model.
  • In openai.py, a potential bug was fixed where the 'tags' attribute was updated to ensure it is always a set, even when 'otags' is None.
  • In question.py, a significant amount of new code was added to facilitate the 'repeat' functionality. This includes functions to create modified args based on an existing message (create_msg_args), to repeat a given list of messages (repeat_messages), and to invert the semantics of the INPUT tags for this command (invert_input_tag_args).
  • In main.py, the 'nargs' parameter was changed from + to * in the 'or-tags', 'and-tags', and 'exclude-tags' arguments to accommodate the updated handling of tags in question.py.
  • A new test_common.py file was added which includes a FakeAI class for testing purposes, and a TestWithFakeAI class which includes a number of methods for asserting various conditions about messages.

This PR also includes additional tests to verify the correct operation of the new 'repeat' functionality.

This PR primarily modifies the `cmm question --repeat` command to allow repeating multiple questions, instead of only the last one. Additionally, this PR includes the following changes: - In `ai_factory.py`, added optional parameters 'def_ai' and 'def_model' to the `create_ai` function which allows specifying a default AI and model. - In `openai.py`, a potential bug was fixed where the 'tags' attribute was updated to ensure it is always a set, even when 'otags' is None. - In `question.py`, a significant amount of new code was added to facilitate the 'repeat' functionality. This includes functions to create modified args based on an existing message (`create_msg_args`), to repeat a given list of messages (`repeat_messages`), and to invert the semantics of the INPUT tags for this command (`invert_input_tag_args`). - In `main.py`, the 'nargs' parameter was changed from `+` to `*` in the 'or-tags', 'and-tags', and 'exclude-tags' arguments to accommodate the updated handling of tags in `question.py`. - A new `test_common.py` file was added which includes a `FakeAI` class for testing purposes, and a `TestWithFakeAI` class which includes a number of methods for asserting various conditions about messages. This PR also includes additional tests to verify the correct operation of the new 'repeat' functionality.
juk0de added 11 commits 2023-09-24 09:03:13 +02:00
juk0de added the enhancement label 2023-09-24 09:03:18 +02:00
juk0de requested review from ok 2023-09-24 09:03:22 +02:00
juk0de self-assigned this 2023-09-24 09:03:28 +02:00
ok was assigned by juk0de 2023-09-24 09:03:31 +02:00
ok was unassigned by juk0de 2023-09-24 09:03:37 +02:00
juk0de changed title from Make 'cmm question --repeat' support multiple questions, tests and fixes to 'cmm question --repeat' supports multiple questions, added tests and fixes 2023-09-24 09:04:42 +02:00
juk0de merged commit dd836cd72d into main 2023-09-26 18:04:29 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kaizenkodo/ChatMastermind#15