Compare commits

...

2 Commits

3 changed files with 11 additions and 7 deletions

View File

@ -81,7 +81,7 @@ You can provide the following files / links as context to Ollama:
- .html
- .md
- .pdf
- links to websites
- links (Note that only SSL-secured websites are supported)
## How the Rag is working in the GUI:

View File

@ -6,4 +6,5 @@ langchain_community
langchain
pathlib
unstructured
markdown
markdown
requests

View File

@ -6,6 +6,7 @@ from langchain_community.embeddings import OllamaEmbeddings
from langchain_community.vectorstores import Chroma
from langchain_community.chat_models import ChatOllama
from langchain.chains import RetrievalQA
import requests
@ -40,9 +41,12 @@ class Rag:
def get_file(self, file_path):
# Check if the file path starts with 'https://'
if file_path.startswith('https://'):
loader = WebBaseLoader(file_path)
data = loader.load()
if data is None:
try:
loader = WebBaseLoader(file_path)
data = loader.load()
if data is None:
return False
except requests.exceptions.SSLError:
return False
else:
file_type = file_path.split(".")[-1]
@ -61,8 +65,7 @@ class Rag:
loader = PyPDFLoader(file_path=file_path)
data = loader.load_and_split()
case _:
loader = WebBaseLoader(file_path)
data = loader.load()
return False
except OSError:
return False