Skip to content

MrMarans/AnythingLLM_File-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

56 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Currently available as Version 0.9 (BETA)

AnythingLLM File Management Backend ๐Ÿš€

A Django service that automatically syncs and manages files between your local filesystem and AnythingLLM. Just add files to your monitored folder and the system handles workspace organization and embedding automatically.

Features โœจ

  • File Monitoring ๐Ÿ“‚: Watches for new, modified and deleted files
  • AnythingLLM Integration ๐Ÿ”—:
    • ๐Ÿ“ค Automatic file upload and updates
    • ๐Ÿข Workspace management
    • โŒ Cleanup of deleted files
  • Image Processing ๐Ÿ–ผ๏ธ:
    • ๐Ÿ“ท AI-powered image descriptions using Ollama
    • ๐Ÿ” Text descriptions for better search
  • Scheduling โณ:
    • โฐ Configurable CRON schedule
    • ๐Ÿ“ง Manual updates via API endpoint and frontend

Prerequisites ๐Ÿ› ๏ธ

  • ๐Ÿณ Docker and Docker Compose
  • ๐Ÿง  AnythingLLM instance (works with desktop and docker version)
  • ๐Ÿ”‘ Access to AnythingLLM Developer API
  • ๐Ÿ‘๏ธ Optional: Ollama for image description functionality

Configuration โš™๏ธ

Environment Variables ๐ŸŒ

Quick config via .env file:

ANYTHING_LLM_API=your_api_key        # AnythingLLM API key
ANYTHING_LLM_URL=your_anything_llm_url  # URL without trailing /


USE_CRON=true                        # Enable scheduled checking
CHECK_FILES_CRON=*/1 * * * *         # Check every minute

# Image description (optional)
OLLAMA_URL=http://localhost:11434/api/generate
IMAGE_DESCRIPTION_ACTIVATE=true
IMAGE_DESCRIPTION_MODEL=gemma3:4b
IMAGE_DESCRIPTION_LANGUAGE=english

SORT_FILES=true                      # Auto-organize files
DELETE_UNUSED_FOLDERS=false          # Clean up empty folders

๐Ÿ”‘ API Key: AnythingLLM Settings โ†’ Tools โ†’ Developer API โ†’ Generate New API Key

Folder Setup ๐Ÿ“

In docker-compose.yml, set your monitored directory:

volumes:
  - C:\MyFolder:/app/AnythingLLM

You can add as many monitored directories you need. If you want multiple, you can do it like this:

volumes:
  - C:\YOUR_FOLDER:/app/AnythingLLM
  - C:\YOUR_SECOND_FOLDER:/app/AnythingLLM_SecondInstance
  - C:\YOUR_THIRD_FOLDER:/app/AnythingLLM3

The programm checks for all folders which starts with "AnythingLLM" within the /app path. Meaning "AnythingLLM_Second", "AnythingLLMHomeWork" and such all get detected, but just putting a number behind it is probably the best solution.

Make sure the path to your folder is before the :/app/AnythingLLM ๐Ÿ“‚ Each subfolder creates a matching workspace in AnythingLLM:

  • C:\MyFolder\Work โ†’ Work workspace
  • C:\MyFolder\Personal โ†’ Personal workspace

Workspaces are automatically created and deleted to match your folder structure.

โš ๏ธ Files within the source folder (in this example the "C:\MyFolder") are skipped. Make sure you create subfolders, else the program can't create workspaces or upload files, as they are not detected.

Image Description Feature ๐Ÿ–ผ๏ธ

Generates searchable text descriptions for images:

  • ๐Ÿ” Detects images (.jpg, .png, etc.) in monitored folders
  • ๐Ÿง  Uses Ollama for AI description
  • ๐Ÿ“„ Creates .image_description files
  • ๐Ÿ“ค Only uploads text descriptions for efficient embedding

Setup: Enable with IMAGE_DESCRIPTION_ACTIVATE=true and configure Ollama settings in .env

File Sorting Feature ๐Ÿ—‚๏ธ

โš ๏ธ BETA Feature: Use with caution.

Automatically organizes documents into folders based on workspace associations:

  • ๐Ÿ” Moves files to folders matching their workspace names
  • ๐Ÿ“ Creates workspace folders as needed
  • ๐Ÿ”„ Handles single and multi-workspace documents

Configuration:

  • Enable with SORT_FILES=true in .env
  • Optional: DELETE_UNUSED_FOLDERS=true to clean up empty folders

Note: Only needed if uploading through AnythingLLM Frontend, as this app already manages files automatically.

Installation and Setup ๐Ÿš€

  1. Clone the repository:
git clone https://github.com/MrMarans/AnythingLLM_File-Manager.git
  1. Configure your environment:

    • ๐Ÿ› ๏ธ Copy the .env.example file, create an .env file and set your settings.
    • ๐Ÿ”‘ Set your API key, AnythingLLM URL, watched folder path
    • ๐Ÿ“‚ Configure docker-compose.yml with the correct volume mapping for your monitored directory
  2. Start the service:

docker-compose up -d

๐Ÿ†™ Updating to a new version or updating the configuration? Use:

docker-compose down
docker-compose up -d --build

How It Works ๐Ÿ› ๏ธ

  1. File Monitoring ๐Ÿ”:

    • Periodically checks the monitored directory based on the configured CRON schedule โณ
    • Detects new, modified, and deleted files โœ…
    • Maintains a database of detected files ๐Ÿ—ƒ๏ธ
  2. AnythingLLM Integration ๐Ÿ”—:

    • ๐Ÿ“ค New files are automatically uploaded
    • ๐Ÿ“ Modified files trigger updates
    • โŒ Deleted files are removed
    • ๐Ÿข Workspaces are created based on folder structure
  3. Image Processing (when enabled) ๐Ÿ–ผ๏ธ:

    • ๐Ÿ” Detects image files in monitored directories
    • ๐Ÿง  Sends them to Ollama for description generation
    • ๐Ÿ“ Saves descriptions as separate files
    • ๐Ÿ“ค Uploads only the text descriptions to AnythingLLM
  4. Workspace Management ๐Ÿ—๏ธ:

    • ๐Ÿ“ Creates workspaces automatically for new folders
    • ๐Ÿ”„ Updates embeddings when files change
    • ๐Ÿงน Removes empty workspaces to maintain cleanliness

CRON Schedule Examples โฐ

You can modify the CHECK_FILES_CRON environment variable to adjust the checking frequency:

  • */1 * * * * - ๐Ÿ”„ Every minute (default)
  • 0 */2 * * * - โฒ๏ธ Every 2 hours
  • 0 9-17 * * 1-5 - โฐ Every hour between 9 AM and 5 PM, Monday to Friday

To deactivate CRON Scheduler, set USE_CRON=false in the .env file

Update via API

You can let the files manually update with a post request to the ip:port/update_files/update/ endpoint. For most people it will be http://localhost:8000/update_files/update/ Also available are:

  • update_files/sort/ for sorting files in folders
  • update_files/clean/ for deleting empty folders in AnythingLLM
  • update_files/scan/ to just check how many file updates there are
  • update_files/create_image_descriptions/

Web UI Interface ๐Ÿ–ฅ๏ธ ๐Ÿ–ฑ๏ธ

The application includes a simple web UI for managing your AnythingLLM files directly from your browser ๐ŸŒ:

  1. How to access: ๐Ÿ”—

    • Open your browser and navigate to the application's base URL (e.g., http://localhost:8000/)
    • You'll see a user-friendly dashboard with action buttons
  2. Available actions: ๐ŸŽฎ

    • ๐Ÿ“ค Full Upload and Cleaning - Upload files and perform cleaning operations
    • ๐Ÿ—‚๏ธ Sort Files - Sort files into appropriate folders based on workspace associations
    • ๐Ÿงน Clean Folders - Delete unused folders
    • ๐Ÿ” Scan Files - Check for new, changed, or deleted files (doesn't upload anything)
    • ๐Ÿ–ผ๏ธ Create Image Descriptions - Generate descriptions for all images
  3. Usage: ๐Ÿ‘†

    • Simply click on the desired action button
    • The system will execute the requested operation
    • Results will be displayed in the response area below the buttons

This interface provides a convenient alternative to API calls or waiting for scheduled CRON jobs to run. ๐Ÿ’ซ

Troubleshooting ๐Ÿ› ๏ธ

Common issues and their solutions:

  1. Files not being detected ๐Ÿง:

    • ๐Ÿ” Check the volume mounting in docker-compose.yml
    • ๐Ÿ”‘ Verify file permissions
    • ๐Ÿ“ Check the logs for any errors
  2. AnythingLLM connection issues ๐Ÿ”Œ:

    • โœ… Verify ANYTHING_LLM_URL is correct
    • ๐Ÿ”‘ Ensure ANYTHING_LLM_API key is valid
    • ๐ŸŒ Check network connectivity
  3. Schedule not running โณ:

    • โœ… Verify CHECK_FILES_CRON format
    • ๐Ÿ“œ Check container logs for scheduling errors
    • ๐ŸŒ Ensure the container has the correct timezone settings
  4. Image description not working ๐Ÿ–ผ๏ธ:

    • โœ… Check Ollama is running and accessible
    • ๐Ÿ” Verify OLLAMA_URL is correct
    • ๐Ÿ“ Ensure the specified model is available in your Ollama instance

Logs ๐Ÿ“œ

The service logs all operations and errors. Access the logs using:

docker-compose logs -f

Support ๐Ÿค

For issues, questions, or contributions:

  • ๐Ÿ“ Create an issue in the repository
  • Make VERBOSE true in the .env file, this will print more logs
  • ๐Ÿ› ๏ธ Include logs and configuration details when reporting issues

Upcoming Changes ๐Ÿš€

  • ๐Ÿ“ API documentation improvements

  • ๐Ÿ‘ค Face Recognition Feature for Image Description

  • ๐ŸŽฏ Check if filetype is supported by AnythingLLM

  • ๐Ÿš€ Much More exciting features!

  • Version 1.0 will release with AnythingLLM Desktop Support, tested and working on Linux and Windows and granular API endpoints. No releasedate or window yet clear!

Security Information ๐Ÿ”’

โš ๏ธ No security testing has been conducted. Use at your own risk. This has not been tested for production. Please review the settings.py file and adjust as needed. You have been warned.

๐Ÿ” If you have security expertise, pull requests with security improvements are welcome!

License ๐Ÿ“œ

MIT

About

No description, website, or topics provided.

Resources

Stars

33 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors