support import obsidian vault as knowlege base #948

Closed
opened 2026-02-21 17:29:09 -05:00 by yindo · 6 comments
Owner

Originally created by @geosmart on GitHub (Jan 22, 2024).

Self Checks

1. Is this request related to a challenge you're experiencing?

all of my diary task, diary, note store in obsidian , with markdown format.

I want to use dify to import all of my notes in obsidian , and search by nature language

2. Describe the feature you'd like to see

datasource support import local obsidian vault,set exclude dirs by regexp

3. How will this feature improve your workflow or experience?

search personal knowledge base with qa style

4. Additional context or comments

No response

5. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @geosmart on GitHub (Jan 22, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### 1. Is this request related to a challenge you're experiencing? all of my diary task, diary, note store in obsidian , with markdown format. I want to use dify to import all of my notes in obsidian , and search by nature language ### 2. Describe the feature you'd like to see datasource support import local obsidian vault,set exclude dirs by regexp ### 3. How will this feature improve your workflow or experience? search personal knowledge base with qa style ### 4. Additional context or comments _No response_ ### 5. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 17:29:09 -05:00
yindo closed this issue 2026-02-21 17:29:09 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 22, 2024):

🤖

Thank you for your feature request. Based on the current state of the dify repository, it seems that some of the functionality you're asking for is already in place, while other parts would need to be added.

Firstly, dify does support importing data from local sources, as evidenced by the generate method in the ApplicationManager class, which accepts a list of FileObj objects. This suggests that files can be passed into the application for processing. You can find this in the api/core/application_manager.py file.

Secondly, dify does have functionality for parsing and importing markdown files, which are used by Obsidian. This is handled by the MarkdownLoader class in the api/core/data_loader/loader/markdown.py file. The MarkdownLoader class has several methods that facilitate the loading and parsing of markdown files, and this functionality should be compatible with markdown files used by Obsidian, as Obsidian uses standard markdown syntax.

However, as for your request to import data specifically from Obsidian vaults and to exclude certain directories or files based on regular expressions during the import process, I wasn't able to find any existing functionality in the dify codebase that would support these features. This would likely require additional development work to implement.

I hope this information is helpful. If you have any further questions or need more clarification, please don't hesitate to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Jan 22, 2024): _🤖_ <!-- Answer --> Thank you for your feature request. Based on the current state of the dify repository, it seems that some of the functionality you're asking for is already in place, while other parts would need to be added. Firstly, dify does support importing data from local sources, as evidenced by the `generate` method in the `ApplicationManager` class, which accepts a list of `FileObj` objects. This suggests that files can be passed into the application for processing. You can find this in the [api/core/application_manager.py](https://github.com/langgenius/dify/blob/main/api/core/application_manager.py) file. Secondly, dify does have functionality for parsing and importing markdown files, which are used by Obsidian. This is handled by the `MarkdownLoader` class in the `api/core/data_loader/loader/markdown.py` file. The `MarkdownLoader` class has several methods that facilitate the loading and parsing of markdown files, and this functionality should be compatible with markdown files used by Obsidian, as Obsidian uses standard markdown syntax. However, as for your request to import data specifically from Obsidian vaults and to exclude certain directories or files based on regular expressions during the import process, I wasn't able to find any existing functionality in the dify codebase that would support these features. This would likely require additional development work to implement. I hope this information is helpful. If you have any further questions or need more clarification, please don't hesitate to ask. ## Sources - [api/core/application_manager.py](https://github.com/langgenius/dify/blob/main/api/core/application_manager.py) - [api/core/data_loader/loader/markdown.py](https://github.com/langgenius/dify/blob/main/api/core/data_loader/loader/markdown.py) --- This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
Author
Owner

@crazywoola commented on GitHub (Jan 24, 2024):

But they are markdown right? You can simply upload all the markdown files to the knowledge base I think.

@crazywoola commented on GitHub (Jan 24, 2024): But they are markdown right? You can simply upload all the markdown files to the knowledge base I think.
Author
Owner

@geosmart commented on GitHub (Jan 24, 2024):

@crazywoola
now dify need to manual upload files,and does't support dir.
I have thousands of documents need to add to the knowledge base.

when my note update, how to dynamic update the knowledge base.
does dify's knowledge base has an api to do this?

eg. knowledge base have a webhook to recieve a file url and import template, then auto finish build the vector index.

@geosmart commented on GitHub (Jan 24, 2024): @crazywoola now dify need to manual upload files,and does't support dir. I have thousands of documents need to add to the knowledge base. when my note update, how to dynamic update the knowledge base. does dify's knowledge base has an api to do this? eg. knowledge base have a webhook to recieve a file url and import template, then auto finish build the vector index.
Author
Owner

@geosmart commented on GitHub (Jan 24, 2024):

ok, I found the datasets api...

@geosmart commented on GitHub (Jan 24, 2024): ok, I found the datasets api...
Author
Owner

@geosmart commented on GitHub (Jan 24, 2024):

I write a shell to import my obsidian vault dir to dify dataset

#!/bin/bash

# dify nginx gateway
endpoint="http://192.168.68.100:18880"
dataset_id="a2139662-cf9b-1111-a75d-9d5de6ee2f02"
dataset_apikey="dataset-h1QJdjzI9Cbl3Vuj234RTCQh"

# import src dir
target_dir="/mnt/mind/data/kbase/obsidian"

# import all markdown file recurcely
function process_files {
  local dir="$1"
  for file in "$dir"/**/*.md; do
    if [ -f "$file" ]; then
      echo "Processing file: $file"
      filename=$(basename "$file")
      # 执行POST操作
      curl -X POST "$endpoint/v1/datasets/$dataset_id/document/create_by_file" \
      -H "Authorization: Bearer $dataset_apikey" \
      --form "data={\"name\":\"$filename\",\"indexing_technique\":\"economy\",\"process_rule\":{\"mode\":\"automatic\"}}" \
      --form 'type=text/plain' \
      --form "file=@$file"
    elif [ -d "$file" ]; then
      process_files "$file"
    fi
  done
}

process_files "$target_dir"
@geosmart commented on GitHub (Jan 24, 2024): I write a shell to import my obsidian vault dir to dify dataset ```bash #!/bin/bash # dify nginx gateway endpoint="http://192.168.68.100:18880" dataset_id="a2139662-cf9b-1111-a75d-9d5de6ee2f02" dataset_apikey="dataset-h1QJdjzI9Cbl3Vuj234RTCQh" # import src dir target_dir="/mnt/mind/data/kbase/obsidian" # import all markdown file recurcely function process_files { local dir="$1" for file in "$dir"/**/*.md; do if [ -f "$file" ]; then echo "Processing file: $file" filename=$(basename "$file") # 执行POST操作 curl -X POST "$endpoint/v1/datasets/$dataset_id/document/create_by_file" \ -H "Authorization: Bearer $dataset_apikey" \ --form "data={\"name\":\"$filename\",\"indexing_technique\":\"economy\",\"process_rule\":{\"mode\":\"automatic\"}}" \ --form 'type=text/plain' \ --form "file=@$file" elif [ -d "$file" ]; then process_files "$file" fi done } process_files "$target_dir" ```
Author
Owner

@replete commented on GitHub (Apr 23, 2024):

@geosmart I am also looking at this use-case of importing a local obsidian vault (at least parts of it) as a knowledgebase to chat with. Are you still using this solution? I'm hoping to set something up that can automatically reindex notes without uploading thousands of files via a web UI.

It seems like it be best to import different folders as separate collections.

Phil

@replete commented on GitHub (Apr 23, 2024): @geosmart I am also looking at this use-case of importing a local obsidian vault (at least parts of it) as a knowledgebase to chat with. Are you still using this solution? I'm hoping to set something up that can automatically reindex notes without uploading thousands of files via a web UI. It seems like it be best to import different folders as separate collections. Phil
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#948