I am needing some assistance with getting my local files into my Postgres Vector DB. My goal is to monitor my local server for specific file changes (added, updated, deleted) and update the vectors. If a file is updated, I want the older version to be removed before the updated file is added. I can find flows for monitoring Google Drive and inserting into Supabase. But nothing for local files to Postgres.
I attempted to get ChatGPT to assist but that was a joke. The training dataset is too old and it wasnât aware of the correct nodes. And it had me pretty much using Code Nodes to attempt to accomplish the task. In the end we were making repeated changes that were taking me in circles.
Iâve even tried simplifying the flow with a manual trigger to simple take the files from the specified directory and insert them into the DB. The path error still remains. I have verified that permissions are correct and accessible from within the containers. Volumes are mounted properly. I can manually list the contents of the path from within the n8n container.
Intended flow: Local File Trigger â List Path â Create ID â Check File Status â Delete if needed â Extract file text â Insert into vector
Command failed: cat {{$json[âfile_pathâ]}} cat: canât open â{{[file_path]}}â: No such file or directory
This flow didnât start out like this. These are changes suggested by ChatGPT. Pretty much went from no code to âHey, Letâs code EVERYTHINGâ
Yeah I donât think the Execute Command node can take n8n expressions so your âcat {{$json[âfile_pathâ]}}â is just that and the {{ ... }} doesnât get replaced. To fix (If you want to keep your template as-is), try replacing all Execute Command nodes with âEdit Fields (Set)â nodes which can handle expressions.
Thank you for your reply. I was actually looking at some of your templates that I came across last night. I was debating between the Ultimate RAG Setup and the Financial Documents Assistant. I think the Financial Documents Assistant will probably work for my use case. Nice work by the way. Youâve created some very nice workflows.
I have changed the workflow that I am using to your finacial doc flow. However I am having an issue with the Local File Trigger. The trigger is only returning one file in the top directory path. I am wanting to monitor a folder and all sub-folders and files. But even in the top folder itâs only returning one file when there are 11 files and 10 sub-folders. Do I need to approach this from a different node?