diff --git a/src/main.py b/src/main.py index c33162a..ab9a8b7 100644 --- a/src/main.py +++ b/src/main.py @@ -4,10 +4,12 @@ import trilium.notes as tn tril = tn.TrilumNotes() -tril_notes = tril.get_new_notes() +tril.get_new_notes() +tril_notes = tril.get_notes_content() for note in tril_notes: - print(note) + print(tril_notes[note]['title']) + print(tril_notes[note]['content']) client = Client(host='http://192.168.178.45:11434') user_prompt = input("Ask mistral-nemo a question: ") diff --git a/src/trilium/notes.py b/src/trilium/notes.py index 8351617..bb55041 100644 --- a/src/trilium/notes.py +++ b/src/trilium/notes.py @@ -4,7 +4,7 @@ import os class TrilumNotes: def __init__(self): - self.protocol = os.environ.get('TRILUM_PROTOCOL') + self.protocol = os.environ.get('TRILIUM_PROTOCOL') self.host = os.environ.get('TRILIUM_HOST') self.port = os.environ.get('TRILIUM_PORT') self.tril_pass = os.environ.get('TRILIUM_PASS') @@ -34,3 +34,16 @@ class TrilumNotes: ) self.new_notes = notes return notes + + def _get_content(self, note_id): + return self.ea.get_note_content(note_id) + + def get_notes_content(self): + content_dict = {} + for note in self.new_notes['results']: + content_dict[note['noteId']] = {"title" : f"{note['title']}", + "content" : f"{self._get_content(note['noteId'])}" + } + self.note_content = content_dict + return content_dict +