Important
Notice: This project is still in development.
This project(koma
) is designed to help users search for information on macOS.
Specifically thanks to the apple_cloud_notes_parser and neon.
- [core] List all notes from Notes.app;
- [core] Convert all notes into markdown;
- [core] Get a specific note;
- [core] Create a note using AppleScript;
- [api ] Incremental index all notes and its paragraphs;
- [api ] Semantic query in both json and plain text;
- [api ] Summrize similar content;
- [api ] Automatic sync Apple notes.
The full api documents can be found in built-in OpenAPI document with url <Your Domain>/api/docs
.
Examples
> # sync notes
> curl -X POST "http://localhost:8000/api/rag/memories/sync.json"
> # list all notes
> curl -X GET "http://localhost:8000/api/rag/memories/list.json"
> # query notes
> curl -X GET "http://localhost:8000/api/rag/neurons/search.json?query=apple"
> # query notes but in text format
> curl -X GET "http://localhost:8000/api/rag/neurons/search.txt?query=apple&topk=5"
By using OpenAPI this is easy to intergate into any rag platform, such as Dify.
In Dify, goto Tools and create one using <Your Domain>/api/openapi.json
.
TODO.
- You have Docker or Orbstack(recommand) installed.
- Your Docker have Full Disk Access permission.
- Your Apple Notes.app folder is
~/Library/Group Containers/group.com.apple.notes
> curl -O https://raw.githubusercontent.com/AFutureD/koma/master/docker-compose.yml
See Section Configuration.
x-shared_environment: &shared_environment
SERVER_URL: 'https://example.com'
PGHOST: '*.neon.tech'
PGUSER: 'user_name'
PGPASSWORD: '<password>'
PGDATABASE: 'db_name'
OPENAI_API_KEY: 'sk-xxx'
CO_API_KEY: 'xxxxx'
> docker-compose up -d migrate
> docker-compose up -d api
- You have pdm and uvicorn installed.
- Your Terminal have Full Disk Access permission.
- Your Apple Notes.app folder is
~/Library/Group Containers/group.com.apple.notes
- Configure the
.env
> git clone https://github.com/AFutureD/koma.git
> cd koma
> pdm install
See Section Configuration.
> pdm run setup
> pdm run server
Key | Description | Default | Required | Example |
---|---|---|---|---|
SERVER_URL | The Server Url used in OpenAPI | http://localhost:8000 | False | https://example.com |
PGHOST | The host of PostgreSQL | - | True | *.neon.tech |
PGUSER | The user of PostgreSQL | - | True | db_name |
PGPASSWORD | The password of PostgreSQL | - | True | user_name |
PGDATABASE | The db name of PostgreSQL | - | True | password |
APPLE_NOTES_FOLDER | Used when deployed in a docker | - | False | /root/group.com.apple.notes |
Key | Description | Default | Required | Example |
---|---|---|---|---|
OPENAI_API_KEY | The api key of OpenAI used for generate embeddings | - | True | sk-xxxxxxxxxxxxxxxx |
CO_API_KEY | The api key of Cohere used for rerank | - | True | cxxx9Sxx4jWxxOWxxxp |