Jotdown is a note-taking app for devs. Everything is done in the terminal, during the week you can only take notes, and on sundays you can ask questions about your notes for review.
- Clone the project
- Create and activate an environment: a)
python -m venv jotdown-venv
then b)source jotdown/bin/activate
- Install the dependencies by running
make install
- run
make
- if it's a weekday (MON-SAT), you'll be able to write notes. On sunday, you'll be able to review your notes by asking questions.
Jotdown is basically 2 features, taking notes and asking questions about the notes. Here is how both are implemented:
-
Taking notes
I used the ncurses library to provide a better user experience. It allowed me to do the following which is not possible with the standard input function.
- multi-line writing and editing like in normal text editors
- show word count, to know when you hit your daily words goal
- show custom messages while writing
- custom actions based on key-press (press ESC to exit)
Once you finish taking notes, it is saved in a vector database so that when I want to review my week, I can retrieve relevent notes to answer my questions.
-
Asking questions about the notes
After retrieving notes that are relevant to my question, I add them as context to the API call to OpenAI. I used Langchain as framework to interact with OpenAI and format my prompt templates.
---
title: Jotdown class diagram
---
classDiagram
LLM <|-- Scribe
LLM <|-- Librarian
class LLM {
#llm: ChatOpenAI
#template: ChatPromptTemplate
+ask()
}
class Scribe {
-MIN_WORDS: String
-system_msg: String
+take_notes()
-clean()
}
class Librarian {
+store()
#retrieve()
+chat()
-vector_store
-create_db()
-create_chain()
-text_to_doc()
}
IUserInput <|-- Editor
IUserInput <|-- CLI
CLI <|-- Librarian
Editor <|-- Scribe
class IUserInput {
+input()
}
class Editor {
-height: int
-width: int
-begin_y: int
-begin_x: int
-win_texteditor: _CursesWindow
-win_counter: _CursesWindow
+print()
+get()
+getkey()
+get_and_print()
}
class CLI {
+stream()
}
- db: use local db instead of in-memory db
- ui: use ncurses editor => text editing
- test: add automated testing (pytest, mypy, github actions)