feat: generalize plot.py for all users and integrate lowest-score review handling
- Refactored plot.py to remove retoor-specific logic, enabling support for any user - Added processing of the lowest score review into the review system for comprehensive analysis
This commit is contained in:
@@ -186,25 +186,34 @@ if __name__ == "__main__":
|
||||
print(totals)
|
||||
|
||||
result = {}
|
||||
rows = query("SElECT strftime('%Y-%m-%d', timestamp) as day, GROUP_CONCAT(char,'') FROM kevent WHERE event = 'PRESSED' group by day")
|
||||
rows = query("SElECT strftime('%Y-%m-%d.%H', timestamp) as date_hour, GROUP_CONCAT(char,'') FROM kevent WHERE event = 'PRESSED' group by date_hour")
|
||||
for row in rows:
|
||||
result[row[0]] = row[1]
|
||||
|
||||
with open("keylog.txt","w") as f:
|
||||
for day in result.keys():
|
||||
with open("logs_plain/"+day+".txt","w") as g:
|
||||
g.write(f"**{day}**: ```{result[day]}```\n\n")
|
||||
f.write(f"**{day}**: ```{result[day]}```\n\n")
|
||||
date, hour = day.split(".")
|
||||
label = f"{date} {hour}:00"
|
||||
if not pathlib.Path("logs_plain/"+day+".txt").exists():
|
||||
with open("logs_plain/"+day+".txt","w") as g:
|
||||
|
||||
|
||||
g.write(f"**{label}**: ```{result[day]}```\n\n")
|
||||
f.write(f"**{label}**: ```{result[day]}```\n\n")
|
||||
|
||||
import json
|
||||
for file in pathlib.Path(".").glob("logs_plain/*.txt"):
|
||||
print("Working on: {}".format(file))
|
||||
dest_file = file.parent.parent.joinpath("logs_summaries").joinpath(file.name)
|
||||
print("Dest file: ", dest_file)
|
||||
if dest_file.exists():
|
||||
continue
|
||||
with dest_file.open("w+") as f:
|
||||
print("Requesting...")
|
||||
response = api.gpt4o("The following data is from my keylogger, make a summary of what i did: ```"+file.read_text().replace("@","").replace("`","")+"```")
|
||||
param = file.read_text().replace("@","").replace("`","")
|
||||
response = api.gpt4o_mini("The following data is key presses made by user. Describe what user could be working on using bulletpoints: "+param)
|
||||
print("Done")
|
||||
f.write(response)
|
||||
print(response)
|
||||
|
||||
|
||||
print("Duration: {}".format(time.time() - time_start))
|
||||
|
||||
Reference in New Issue
Block a user