Changes from https://github.com/juk0de/ChatMastermind.git #1

Closed
ok wants to merge 176 commits from main into juk

176 Commits

Author SHA1 Message Date
juk0de
17a0264025 question_cmd: now also accepts Messages as source files 2023-09-13 17:44:39 +02:00
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
juk0de
b5af751193 openai: added test module 2023-09-13 09:01:00 +02:00
juk0de
a7345cbc41 ai_factory: fixed argument parsing bug 2023-09-13 07:52:05 +02:00
juk0de
310cb9421e Merge pull request 'Cleanup after merge of restructurings #8' (#10) from cleanup into main
Reviewed-on: https://kaizenkodo.no/gitea/kaizenkodo/ChatMastermind/pulls/10
2023-09-12 20:23:08 +02:00
1ec3d6fcda Make it possible to specify the AI in config command. 2023-09-12 16:37:50 +02:00
544bf0bf06 Improve README.md 2023-09-12 16:34:39 +02:00
f96e82bdd7 Implement the config -l and config -m commands. 2023-09-12 16:34:17 +02:00
2b62cb8c4b Remove the -*terminal_width() to save space on screen. 2023-09-12 13:48:28 +02:00
juk0de
a895c1fc6a Merge pull request 'ChatMasterMind Application Refactor and Enhancement' (#8) from restructurings into main
Reviewed-on: https://kaizenkodo.no/gitea/kaizenkodo/ChatMastermind/pulls/8
2023-09-12 07:36:04 +02:00
ddfcc71510 Merge branch 'restructurings.main' into restructurings 2023-09-11 13:28:56 +02:00
17de0b9967 Remove old code. 2023-09-11 13:17:59 +02:00
juk0de
33023d29f9 configuration: made 'default' AI ID optional 2023-09-11 13:09:45 +02:00
juk0de
481f9ecf7c configuration: improved config file format 2023-09-11 13:09:45 +02:00
juk0de
22fa187e5f question_cmd: when no tags are specified, no tags are selected 2023-09-11 13:09:45 +02:00
juk0de
b840ebd792 message: to_file() now uses intermediate temporary file 2023-09-11 13:09:45 +02:00
juk0de
66908f5fed message: fixed matching with empty tag sets 2023-09-11 13:09:45 +02:00
juk0de
2e08ccf606 openai: stores AI.ID instead of AI.name in message 2023-09-11 13:09:44 +02:00
juk0de
595ff8e294 question_cmd: added message filtering by tags 2023-09-11 13:09:44 +02:00
juk0de
faac42d3c2 question_cmd: fixed '--ask' command 2023-09-11 13:09:44 +02:00
juk0de
864ab7aeb1 chat: added check for existing files when creating new filenames 2023-09-11 13:09:44 +02:00
juk0de
cc76da2ab3 chat: added 'update_messages()' function and test 2023-09-11 13:09:44 +02:00
juk0de
f99cd3ed41 question_cmd: fixed source code extraction and added a testcase 2023-09-11 13:09:44 +02:00
6f3ea98425 Small fixes. 2023-09-11 13:09:44 +02:00
54ece6efeb Port print arguments -q/-a/-S from main to restructuring. 2023-09-11 13:09:44 +02:00
86eebc39ea Allow in question -s for just sourcing file and -S to source file with ``` encapsulation. 2023-09-11 13:09:44 +02:00
juk0de
3eca53998b question cmd: added tests 2023-09-11 13:09:44 +02:00
juk0de
c4f7bcc94e question_cmd: fixes 2023-09-11 13:09:44 +02:00
juk0de
c52713c833 configuration: added tests 2023-09-11 13:09:44 +02:00
juk0de
ecb6994783 configuration et al: implemented new Config format 2023-09-11 13:09:44 +02:00
juk0de
61e710a4b1 cmm: splitted commands into separate modules (and more cleanup) 2023-09-11 13:09:41 +02:00
juk0de
21d39c6c66 cmm: removed all the old code and modules 2023-09-11 13:08:45 +02:00
juk0de
6a4cc7a65d setup: added 'ais' subfolder 2023-09-11 13:07:46 +02:00
juk0de
d6bb5800b1 test_main: temporarily disabled all testcases 2023-09-11 13:07:46 +02:00
juk0de
034e4093f1 cmm: added 'question' command 2023-09-11 13:07:46 +02:00
juk0de
7d15452242 added new module 'ai_factory' 2023-09-11 13:07:46 +02:00
juk0de
823d3bf7dc added new module 'openai.py' 2023-09-11 13:07:46 +02:00
juk0de
4bd144c4d7 added new module 'ai.py' 2023-09-11 13:07:46 +02:00
juk0de
e186afbef0 cmm: the 'print' command now uses 'Message.from_file()' 2023-09-11 13:07:43 +02:00
juk0de
5e4ec70072 cmm: tags completion now uses 'Message.tags_from_dir' (fixes tag completion for me) 2023-09-11 13:06:22 +02:00
juk0de
4c378dde85 cmm: the 'hist' command now uses the new 'ChatDB' 2023-09-11 13:05:33 +02:00
juk0de
8923a13352 cmm: the 'tags' command now uses the new 'ChatDB' 2023-09-11 13:04:08 +02:00
juk0de
e1414835c8 chat: added functions for finding and deleting messages 2023-09-11 13:04:08 +02:00
juk0de
abb7fdacb6 message / chat: output improvements 2023-09-11 13:04:08 +02:00
juk0de
2e2228bd60 chat: new possibilites for adding messages and better tests 2023-09-11 13:04:08 +02:00
juk0de
713b55482a message: added rename_tags() function and test 2023-09-11 13:04:08 +02:00
juk0de
d35de86c67 message: fixed Answer header for TXT format 2023-09-11 13:04:08 +02:00
juk0de
aba3eb783d message: improved robustness of Question and Answer content checks and tests 2023-09-11 13:04:08 +02:00
juk0de
8e63831701 chat: added clear_cache() function and test 2023-09-11 13:04:08 +02:00
juk0de
c318b99671 chat: improved history printing 2023-09-11 13:04:08 +02:00
juk0de
48c8e951e1 chat: fixed handling of unsupported files in DB and chache dir 2023-09-11 13:04:08 +02:00
juk0de
b22a4b07ed chat: added tags_frequency() function and test 2023-09-11 13:04:08 +02:00
juk0de
33565d351d configuration: added AIConfig class 2023-09-11 13:04:08 +02:00
juk0de
6737fa98c7 added tokens() function to Message and Chat 2023-09-11 13:04:08 +02:00
juk0de
815a21893c added tests for 'chat.py' 2023-09-11 13:04:08 +02:00
juk0de
64893949a4 added new module 'chat.py' 2023-09-11 13:04:08 +02:00
juk0de
a093f9b867 tags: some clarification and new tests 2023-09-11 13:04:08 +02:00
juk0de
dc3f3dc168 added 'message_in()' function and test 2023-09-11 13:04:08 +02:00
juk0de
74c39070d6 fixed Message.filter_tags 2023-09-11 13:04:08 +02:00
juk0de
fde0ae4652 fixed test case file cleanup 2023-09-11 13:04:08 +02:00
juk0de
238dbbee60 fixed handling empty tags in TXT file 2023-09-11 13:04:08 +02:00
juk0de
17f7b2fb45 Added tags filtering (prefix and contained string) to TagLine and Message 2023-09-11 13:04:08 +02:00
juk0de
9c2598a4b8 tests: added testcases for Message.from/to_file() and others 2023-09-11 13:04:08 +02:00
juk0de
acec5f1d55 tests: splitted 'test_main.py' into 3 modules 2023-09-11 13:04:08 +02:00
juk0de
c0f50bace5 gitignore: added vim session file 2023-09-11 13:04:08 +02:00
juk0de
30ccec2462 tags: TagLine constructor now supports multiline taglines and multiple spaces 2023-09-11 13:04:08 +02:00
juk0de
09da312657 configuration: added 'as_dict()' as an instance function 2023-09-11 13:04:08 +02:00
juk0de
33567df15f added testcases for messages.py 2023-09-11 13:04:08 +02:00
juk0de
264979a60d added new module 'message.py' 2023-09-11 13:04:08 +02:00
juk0de
061e5f8682 tags.py: converted most TagLine functions to module functions 2023-09-11 13:04:08 +02:00
juk0de
2d456e68f1 added testcases for Tag and TagLine classes 2023-09-11 13:04:08 +02:00
juk0de
8bd659e888 added new module 'tags.py' with classes 'Tag' and 'TagLine' 2023-09-11 13:04:08 +02:00
juk0de
d4021eeb11 configuration: made 'default' AI ID optional 2023-09-11 07:38:49 +02:00
juk0de
c143c001f9 configuration: improved config file format 2023-09-10 19:57:06 +02:00
juk0de
59b851650a question_cmd: when no tags are specified, no tags are selected 2023-09-10 19:57:06 +02:00
juk0de
6f71a2ff69 message: to_file() now uses intermediate temporary file 2023-09-10 19:57:06 +02:00
juk0de
eca44b14cb message: fixed matching with empty tag sets 2023-09-10 19:55:21 +02:00
juk0de
b48667bfa0 openai: stores AI.ID instead of AI.name in message 2023-09-10 19:18:44 +02:00
juk0de
533ee1c1a9 question_cmd: added message filtering by tags 2023-09-10 19:18:44 +02:00
juk0de
cf50818f28 question_cmd: fixed '--ask' command 2023-09-10 19:18:44 +02:00
juk0de
dd3d3ffc82 chat: added check for existing files when creating new filenames 2023-09-10 19:18:44 +02:00
juk0de
1e3bfdd67f chat: added 'update_messages()' function and test 2023-09-10 19:14:11 +02:00
juk0de
53582a7123 question_cmd: fixed source code extraction and added a testcase 2023-09-10 19:14:11 +02:00
39b518a8a6 Small fixes. 2023-09-09 16:05:27 +02:00
d22877a0f1 Port print arguments -q/-a/-S from main to restructuring. 2023-09-09 15:38:40 +02:00
7cf62c54ef Allow in question -s for just sourcing file and -S to source file with ``` encapsulation. 2023-09-09 15:16:17 +02:00
3ef1339cc0 Fix extracting source file with type specification. 2023-09-09 11:53:32 +02:00
juk0de
5fb5dde550 question cmd: added tests 2023-09-09 09:12:21 +02:00
juk0de
c0b7d17587 question_cmd: fixes 2023-09-09 08:51:44 +02:00
juk0de
76f2373397 configuration: added tests 2023-09-09 08:31:45 +02:00
juk0de
eaa399bcb9 configuration et al: implemented new Config format 2023-09-09 08:31:45 +02:00
juk0de
b1a23394fc cmm: splitted commands into separate modules (and more cleanup) 2023-09-09 08:31:45 +02:00
ed567afbea Make it possible to print just question or answer on printing files. 2023-09-08 15:54:29 +02:00
juk0de
2df9dd6427 cmm: removed all the old code and modules 2023-09-08 13:04:11 +02:00
juk0de
74a26b8c2f setup: added 'ais' subfolder 2023-09-08 09:44:07 +02:00
6e447018d5 Fix tags_completter. 2023-09-07 18:11:32 +02:00
juk0de
893917e455 test_main: temporarily disabled all testcases 2023-09-07 07:51:46 +02:00
juk0de
ba5aa1fbc7 cmm: added 'question' command 2023-09-06 08:23:09 +02:00
juk0de
eb2fcba99d added new module 'ai_factory' 2023-09-06 08:23:09 +02:00
juk0de
b7e3ca7ca7 added new module 'openai.py' 2023-09-06 08:23:09 +02:00
juk0de
aa322de718 added new module 'ai.py' 2023-09-06 08:23:09 +02:00
juk0de
bf1cbff6a2 cmm: the 'print' command now uses 'Message.from_file()' 2023-09-06 08:23:09 +02:00
juk0de
f93a57c00d cmm: tags completion now uses 'Message.tags_from_dir' (fixes tag completion for me) 2023-09-06 08:23:09 +02:00
juk0de
b0504aedbe cmm: the 'hist' command now uses the new 'ChatDB' 2023-09-06 08:23:09 +02:00
juk0de
eb0d97ddc8 cmm: the 'tags' command now uses the new 'ChatDB' 2023-09-06 08:23:09 +02:00
juk0de
7e25a08d6e chat: added functions for finding and deleting messages 2023-09-06 08:23:09 +02:00
juk0de
63040b3688 message / chat: output improvements 2023-09-04 23:03:29 +02:00
juk0de
6e2d5009c1 chat: new possibilites for adding messages and better tests 2023-09-04 08:58:08 +02:00
juk0de
44cd1fab45 message: added rename_tags() function and test 2023-09-03 09:09:39 +02:00
juk0de
4b0f40bccd message: fixed Answer header for TXT format 2023-09-03 09:09:39 +02:00
juk0de
fa292fb73a message: improved robustness of Question and Answer content checks and tests 2023-09-03 09:09:39 +02:00
juk0de
f9d749cdd8 chat: added clear_cache() function and test 2023-09-03 09:09:39 +02:00
juk0de
ba56caf013 chat: improved history printing 2023-09-03 09:09:39 +02:00
juk0de
d80c3962bd chat: fixed handling of unsupported files in DB and chache dir 2023-09-03 09:09:39 +02:00
juk0de
ddfe29b951 chat: added tags_frequency() function and test 2023-09-03 09:09:39 +02:00
juk0de
d93598a74f configuration: added AIConfig class 2023-09-03 09:09:39 +02:00
juk0de
7f612bfc17 added tokens() function to Message and Chat 2023-09-02 07:45:44 +02:00
juk0de
93290da5b5 added tests for 'chat.py' 2023-09-02 07:45:44 +02:00
juk0de
9f4897a5b8 added new module 'chat.py' 2023-09-02 07:45:44 +02:00
juk0de
214a6919db tags: some clarification and new tests 2023-08-31 15:47:58 +02:00
juk0de
b83cbb719b added 'message_in()' function and test 2023-08-31 09:21:51 +02:00
juk0de
8e1cdee3bf fixed Message.filter_tags 2023-08-30 08:22:50 +02:00
juk0de
73d2a9ea3b fixed test case file cleanup 2023-08-29 11:36:01 +02:00
juk0de
169f1bb458 fixed handling empty tags in TXT file 2023-08-28 14:53:04 +02:00
juk0de
7f91a2b567 Added tags filtering (prefix and contained string) to TagLine and Message 2023-08-28 14:53:04 +02:00
juk0de
fc1b8006a0 tests: added testcases for Message.from/to_file() and others 2023-08-26 19:22:15 +02:00
juk0de
aa89270876 tests: splitted 'test_main.py' into 3 modules 2023-08-26 19:22:15 +02:00
juk0de
0d6a6dd604 gitignore: added vim session file 2023-08-26 19:22:15 +02:00
juk0de
580c86e948 tags: TagLine constructor now supports multiline taglines and multiple spaces 2023-08-26 19:22:15 +02:00
juk0de
879831d7f5 configuration: added 'as_dict()' as an instance function 2023-08-26 19:22:15 +02:00
juk0de
dfc1261931 added testcases for messages.py 2023-08-26 19:22:10 +02:00
juk0de
173a46a9b5 added new module 'message.py' 2023-08-26 10:52:38 +02:00
juk0de
604e5ccf73 tags.py: converted most TagLine functions to module functions 2023-08-18 12:21:46 +02:00
juk0de
ef46f5efc9 added testcases for Tag and TagLine classes 2023-08-18 12:21:46 +02:00
juk0de
b13a68836a added new module 'tags.py' with classes 'Tag' and 'TagLine' 2023-08-18 12:21:46 +02:00
juk0de
a5c91adc41 configuration: minor improvements / fixes
Could not extend the subclass of 'TypedDict' the way I wanted, so I switched to 'dataclass'.
2023-08-17 07:46:47 +02:00
380b7c1b67 Python 3.9 compatibility. 2023-08-16 12:24:03 +02:00
juk0de
e8343fde01 test_main: added type annotations and a helper class / function 2023-08-16 11:15:48 +02:00
juk0de
ee8deed320 configuration: added validation 2023-08-16 11:15:47 +02:00
juk0de
dc13213c4d configuration is now a TypedDict in its own module 2023-08-16 08:14:41 +02:00
juk0de
4303fb414f added typ hints for all functions in 'main.py', 'utils.py', 'storage.py' and 'api_client.py' 2023-08-15 23:53:24 +02:00
juk0de
ba41794f4e mypy: added 'disallow_untyped_defs = True' 2023-08-15 09:47:58 +02:00
juk0de
a5075b14a0 added short aliases for subcommands 2023-08-13 08:41:59 +02:00
ok
e8eba0b755 Merge pull request 'Using subcommands instead of arguments' (#2) from subcommands into main
Reviewed-on: https://kaizenkodo.no/gitea/kaizenkodo/ChatMastermind/pulls/2
2023-08-12 21:37:05 +02:00
juk0de
1e15a52e26 updated README and some minor renaming 2023-08-12 18:34:19 +02:00
juk0de
c4a7c07a0c fixed tests 2023-08-12 14:16:16 +02:00
juk0de
22bebc16ed fixed min nr of expected arguments 2023-08-12 14:16:16 +02:00
juk0de
f7ba0c000f renamed 'model' command to 'config' 2023-08-12 14:16:16 +02:00
b6eb7d9af8 Fix autocompletion. 2023-08-12 13:58:15 +02:00
juk0de
f371a6146e moved 'read_config' to storage.py and added 'write_config' 2023-08-12 13:55:39 +02:00
6ed459be6f Fix tests. 2023-08-12 13:17:10 +02:00
1fb9144192 Change REDAME.md with the new call semantics. 2023-08-12 12:44:13 +02:00
4b2f634b79 Remove wrong comment and make it more readable. 2023-08-12 12:30:07 +02:00
e4d055b900 Fix the max_tokens, temperature, and model setup. 2023-08-12 12:20:49 +02:00
juk0de
bc5e6228a6 defined 'ConfigType' for configuration file type hinting 2023-08-12 10:21:09 +02:00
juk0de
056bf4c6b5 fixed almost all tests 2023-08-12 09:51:13 +02:00
juk0de
93a8b0081a main: cleanup 2023-08-12 09:50:54 +02:00
juk0de
5119b3a874 fixed 'ask' command 2023-08-12 08:28:07 +02:00
juk0de
5a435c5f8f fixed 'tag' and 'hist' commands 2023-08-12 08:20:00 +02:00
juk0de
f90e7bcd47 fixed 'hist' command and simplified reading the config file 2023-08-12 08:13:31 +02:00
juk0de
6406d2f5b5 started to implement sub-commands 2023-08-11 18:27:33 +02:00
df91ca863a Fix the supported python version in README.md and set it to 3.9, also add some classifiers. 2023-08-11 11:03:04 +02:00
bc9baff0dc Add official repository URL. 2023-08-10 11:29:54 +02:00
juk0de
7a92ebe539
README: Added 'Contributing' section 2023-08-10 08:26:27 +02:00
9b6b13993c Output the tag list sorted alphabetically. 2023-08-05 23:07:39 +02:00
c5c4a6628f Allow character ":" in tags. 2023-08-05 21:00:30 +02:00
juk0de
f8ed0e3636 tags are now separated by ' ' (old format is still readable) 2023-08-05 18:02:03 +02:00
caf5244d52 Add action -L to list all available models 2023-08-05 16:04:25 +02:00
ca3a53e68b Fix backwards compatibility of -W flag. 2023-08-05 15:35:27 +02:00
820d938060 Fix tests for Python 3.10. 2023-08-05 14:42:38 +02:00
8bb2a002a6 Fixed tests. 2023-08-05 13:21:17 +02:00
01de75bef3 Improve -l output. 2023-08-05 12:39:46 +02:00
1bb553b223 Merge branch 'main' of stage.fjerkroa.no:ok/ChatMastermind 2023-08-05 12:36:13 +02:00
bb8aa2f817 Fix read_file declaration. 2023-08-05 12:36:04 +02:00
OK
0d31b88567 Merge pull request 'Changes from https://github.com/juk0de/ChatMastermind.git' (#2) from juk into main
Reviewed-on: #2
2023-08-05 12:30:24 +02:00