248 Commits

Author SHA1 Message Date
3245690d4d chat: 'msg_gather()' now supports globbing 2023-09-28 07:51:56 +02:00
37341ccebe question: moved around some code 2023-09-28 07:19:00 +02:00
8031271c18 chat: added message file format as ChatDB class member 2023-09-27 08:15:35 +02:00
5e392e782e message: added function 'rm_file()' and test 2023-09-27 08:14:56 +02:00
589b92c9b6 test_question_cmd: modified tests to use '.msg' file suffix 2023-09-26 18:29:23 +02:00
3c4f93cc51 test_chat: added test for file_path collision detection 2023-09-26 18:29:23 +02:00
f01ccb7d36 test_chat: changed all tests to use the new '.msg' suffix 2023-09-26 18:29:23 +02:00
68aab144ca test_message: changed all tests to use the new '.msg' suffix 2023-09-26 18:29:23 +02:00
ffcf500acb message: fixed tag matching for YAML file format 2023-09-26 18:29:23 +02:00
e3e79cf736 chat: switched to new message suffix and formats
- no longer using file suffix to choose the format
- added 'mformat' argument to 'write_xxx()' functions
- file suffix is now set by 'Message.to_file()' per default
2023-09-26 18:29:23 +02:00
1cd52acf2d message: introduced file suffix '.msg'
- '.msg' suffix is always used for writing
- 'Message.to_file()' will set the file suffix if the given file_path has none
- added 'mformat' argument to 'Message.to_file()' for choosing the file format
- '.txt' and '.yaml' suffixes are only supported for reading
2023-09-26 18:29:23 +02:00
dd836cd72d Merge pull request 'cmm question --repeat supports multiple questions, added tests and fixes' (#15) from repeat_multi into main
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.
2023-09-26 18:04:27 +02:00
601ebe731a test_question_cmd: added a new testcase and made the old cases more explicit (easier to read) 2023-09-24 08:53:37 +02:00
87b25993be tests: moved 'FakeAI' and common functions to 'test_common.py' 2023-09-24 08:38:52 +02:00
a478408449 test_question_cmd: test fixes and cleanup 2023-09-23 08:53:26 +02:00
b83b396c7b question_cmd: fixed msg specific argument creation 2023-09-23 08:11:11 +02:00
3c932aa88e openai: fixed assignment of output tags 2023-09-23 08:11:11 +02:00
b50caa345c test_question_cmd: introduced 'FakeAI' class 2023-09-23 08:11:11 +02:00
80c5dcc801 question_cmd: input tag options without a tag (e. g. '-t') now select ALL tags 2023-09-23 08:11:11 +02:00
33df84beaa ai_factory: added optional 'def_ai' and 'def_model' arguments to 'create_ai' 2023-09-22 13:43:31 +02:00
0657a1bab8 question_cmd: fixed AI and model arguments when repeating messages 2023-09-22 13:43:31 +02:00
e9175aface test_question_cmd: added testcase for --repeat with multiple messages 2023-09-22 13:43:31 +02:00
21f81f3569 question_cmd: implemented repetition of multiple messages 2023-09-22 13:43:31 +02:00
4538624247 Merge pull request 'Implemented the 'question --repeat' command and other improvements' (#14) from repeat into main
Reviewed-on: #14
2023-09-21 07:25:47 +02:00
ac3c19739d README: updates and fixes 2023-09-20 10:18:06 +02:00
ed379ed535 print_cmd: added option to print latest message 2023-09-20 10:18:06 +02:00
c43bafe47a main: improved metavar names and descriptions 2023-09-20 10:18:06 +02:00
7dd83428fb test_question_cmd: added more testcases for '--repeat' 2023-09-20 10:18:06 +02:00
3ad4b96b8f test_question_cmd: added testclass for the 'question_cmd()' function 2023-09-20 10:17:59 +02:00
561003aabe question_cmd: implemented repeating of the latest message 2023-09-20 10:17:59 +02:00
59eb45a3ca chat: improved message equality checks 2023-09-20 10:17:59 +02:00
29a20bd2d8 message: added 'equals()' function and improved robustness and debugging 2023-09-20 10:17:59 +02:00
80a1457dd1 configuration: the cache folder can now be specified in the configuration file 2023-09-20 10:17:59 +02:00
f964c5471e Merge pull request 'Refactoring, fixes and new features for the 'chat.py' module' (#12) from chat_refactoring into main
Reviewed-on: #12
2023-09-18 14:23:51 +02:00
25fffb6fea chat: db_read() and cache_read() now also support globbing and filtering 2023-09-17 10:59:29 +02:00
cf572e1882 chat: added functions db_move() and chat_move() (and tests) 2023-09-17 10:59:29 +02:00
2fb7410b43 chat: added functions msg_in_cache() and msg_in_db(), also tests 2023-09-17 10:59:29 +02:00
33ae27f00e chat: msg_remove() now supports multiple locations 2023-09-17 10:59:29 +02:00
f6a6e6036b chat: added validation during initialization 2023-09-17 10:59:29 +02:00
525cdb92a1 message / chat: 'msg_id()' now returns 'file_path.stem' (removed suffix) 2023-09-17 10:59:29 +02:00
fc82f85b7c chat: added new functions: msg_unique_id(), msg_unique_content() and tests 2023-09-17 10:59:24 +02:00
d90845b58b chat: added new functions to ChatDB: msg_gather(), msg_find(), msg_remove() 2023-09-17 10:58:26 +02:00
98777295d6 refactor: renamed (almost) all Chat/ChatDB functions 2023-09-17 10:58:26 +02:00
f6109949c8 chat: ChatDB now correctly ignores files that contain no valid messages 2023-09-17 10:58:10 +02:00
071871f929 chat et al: '.next' and '.config.yaml' are now ignored by ChatDB 2023-09-14 16:06:00 +02:00
5cb88dad1b chat: implemented special version of 'latest_message()' for the ChatDB class 2023-09-14 16:05:49 +02:00
17a0264025 question_cmd: now also accepts Messages as source files 2023-09-13 17:44:39 +02:00
Oleksandr Kozachuk
7f4a16894e Add pre-commit checks into push webhook. 2023-09-13 11:08:02 +02:00
Oleksandr Kozachuk
26e3d38afb Add the Gitea web hooks. 2023-09-13 10:53:12 +02:00
b5af751193 openai: added test module 2023-09-13 09:01:00 +02:00