Skip to content

Commit a2b2815

Browse files
authored
Merge pull request #35 from A-Baji/dev
Fix thought min/max bugs
2 parents dcc3a94 + 0cef262 commit a2b2815

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

discordai_modelizer/gen_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
def parse_logs(file: str, channel:str, user: str, thought_time=10, thought_max: int = None, thought_min=4):
99
files_path = pathlib.Path(user_data_dir(appname="discordai"))
1010
dataset = open(files_path / f"{channel}_{user}_data_set.jsonl", 'w')
11+
thought_max = 999999 if not thought_max else thought_max
1112
with open(file, 'r', encoding='utf-8') as data_file:
1213
data = load(data_file)
1314
messages = [msg for msg in data['messages']
@@ -29,8 +30,7 @@ def parse_logs(file: str, channel:str, user: str, thought_time=10, thought_max:
2930
differentiation = (curr_timestamp - prev_timestamp) / \
3031
timedelta(milliseconds=1)
3132
if differentiation > thought_time*1000: # If time between messages exceed `thought_time` milliseconds
32-
thought_max = len(thought.split(" ")) if not thought_max else thought_max
33-
if len(thought.split(" ")) >= thought_min and thought_max >= len(thought.split(" ")): # If the thought size is within `thought_min` and `thought_max`
33+
if len(thought.split(" "))-1 >= thought_min and thought_max >= len(thought.split(" "))-1: # If the thought size is within `thought_min` and `thought_max`
3434
dataset.write(
3535
dumps(
3636
{'prompt': '', 'completion': f'{thought}'

discordai_modelizer/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.2.0"
1+
__version__ = "1.2.1"

0 commit comments

Comments
 (0)