mediar-ai / screenpipe

rewind.ai x cursor.com = your AI assistant that has all the context. 24/7 screen & voice recording for the age of super intelligence. get your data ready or be left behind
https://screenpi.pe
MIT License
9.53k stars 553 forks source link

feat: let user select the directory to save things #680

Open asd55667 opened 1 week ago

asd55667 commented 1 week ago

/claim #669 /closes #669

the summay of changes:

ui

tauri

server

I have no clue to check pip-store related changes works, the remains mentioned above all manually checked in my mac-air-m3 device, both dev and build. some missing may occur due to the lack of my knowledge.

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
screenpipe ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 1:55am
louis030195 commented 1 week ago

overall great contribution

i wonder if all still work well like including pipes which rely on the .screenpipe

https://docs.screenpi.pe/docs/plugins#available-pipes

i use the reddit one which rely on the dir, it writes logs of your day using AI and then search for relevant reddit posts based on these logs and generate answer to it

can you explain the .screenpipe_dir?

asd55667 commented 1 week ago

I'm kind of busy in last commit time, the screenpipe-server.rs file which writes media data and db file seems like an external process with tauri, I couldn't find a better way to get the data_dir field from tauri store, so i choose a ungracefully way to add a . screenpipe_dir temp file for accessing the data_dir field, when data_dir changes, it will write . screenpipe_dir in, and the restart server will read from it

asd55667 commented 1 week ago

There are also some problem with this pr. what I have found as follow:

I will handle these in another pr and verify pipes in next few days. the ui part may adjust as

louis030195 commented 6 days ago

https://github.com/mediar-ai/screenpipe/blob/7922064dda8c1882a3e52da0c30430fe4d641170/screenpipe-app-tauri/src-tauri/capabilities/main.json#L43

okay might be related

i will test this PR later

louis030195 commented 3 days ago

still dont understand what is .screenpipe_dir

louis030195 commented 3 days ago

you can do this to display hidden files on macos finder

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

(PS: finder is such a trash software XD)

asd55667 commented 2 days ago

still dont understand what is .screenpipe_dir

Sorry for my confusing word, let me explain in detail, when user change the data_dir in settings and saved(from ~/.screenpipe to ~/.screenpip1, i just serialize the string ~/.screenpip1 and save to ~/screenpipe/.screenpipe_dir,

$ cat ~/.screenpipe/.screenpipe_dir
# ~/.screenpip1

And then the recorder server start, it will load path from the ~/.screenpipe/.screenpipe_dir file, and write log in there.

the filename .screenpipe_dir was named from the parameter of the constructor of server in screenpipe-server/src/server.rs. When the recorder server starts, it should initalize the data_dir from settings which stored in tauri (in my laptop /Users/wcw/Library/Application Support/screenpipe/store.bin), I used to thought the store should be load from StoreBuilder of tauri, and use the .screenpipe_dir file to sync state for convenient, maybe you will find a better way to resolve it.

louis030195 commented 1 day ago

@asd55667 did you look at

https://github.com/mediar-ai/screenpipe/blob/f89075488fde63ad297be13d3bb6cf7fa447ea97/screenpipe-app-tauri/src-tauri/src/sidecar.rs#L85

if you set the data dir in the sidecar here like other things it would not require the .screenpipe_dir?

asd55667 commented 1 day ago

@asd55667 did you look at

https://github.com/mediar-ai/screenpipe/blob/f89075488fde63ad297be13d3bb6cf7fa447ea97/screenpipe-app-tauri/src-tauri/src/sidecar.rs#L85

if you set the data dir in the sidecar here like other things it would not require the .screenpipe_dir?

yes. in this solution, every operation of write the data_dir field of settings should sync the value in .screenpipe_dir. it's not that elegant. The only usage of .screenpipe_dir is for operation of read in screenpipe-server/src/bin/screenpipe-server.rs.

If I set the data dir in the sidecar here, I think I should sync the value to .screenpipe_dir, and then restart the recorder server or make sure this happens before the server start.

Once if i access /Users/wcw/Library/Application Support/screenpipe/store.bin by screenpipe-server/src/bin/screenpipe-server.rs, i have to validate the recorder server in other os(linux, windows) that i don't have now.

louis030195 commented 15 hours ago

hey i don't get what you are saying, just use the sidecar.rs like we do with all other settings