Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
a974d736
Unverified
Commit
a974d736
authored
Feb 23, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 23, 2024
Browse files
Merge pull request #866 from asedmammad/fix-rag-scan-unsupported-mime
fix: RAG scan unsupported mime type
parents
53fce7ca
b473ad57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
backend/apps/rag/main.py
backend/apps/rag/main.py
+5
-5
No files found.
backend/apps/rag/main.py
View file @
a974d736
...
@@ -423,7 +423,7 @@ def get_loader(filename: str, file_content_type: str, file_path: str):
...
@@ -423,7 +423,7 @@ def get_loader(filename: str, file_content_type: str, file_path: str):
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
]
or
file_ext
in
[
"xls"
,
"xlsx"
]:
]
or
file_ext
in
[
"xls"
,
"xlsx"
]:
loader
=
UnstructuredExcelLoader
(
file_path
)
loader
=
UnstructuredExcelLoader
(
file_path
)
elif
file_ext
in
known_source_ext
or
file_content_type
.
find
(
"text/"
)
>=
0
:
elif
file_ext
in
known_source_ext
or
(
file_content_type
and
file_content_type
.
find
(
"text/"
)
>=
0
)
:
loader
=
TextLoader
(
file_path
)
loader
=
TextLoader
(
file_path
)
else
:
else
:
loader
=
TextLoader
(
file_path
)
loader
=
TextLoader
(
file_path
)
...
@@ -486,8 +486,8 @@ def store_doc(
...
@@ -486,8 +486,8 @@ def store_doc(
@
app
.
get
(
"/scan"
)
@
app
.
get
(
"/scan"
)
def
scan_docs_dir
(
user
=
Depends
(
get_admin_user
)):
def
scan_docs_dir
(
user
=
Depends
(
get_admin_user
)):
try
:
for
path
in
Path
(
DOCS_DIR
).
rglob
(
"./**/*"
)
:
for
path
in
Path
(
DOCS_DIR
).
rglob
(
"./**/*"
)
:
try
:
if
path
.
is_file
()
and
not
path
.
name
.
startswith
(
"."
):
if
path
.
is_file
()
and
not
path
.
name
.
startswith
(
"."
):
tags
=
extract_folders_after_data_docs
(
path
)
tags
=
extract_folders_after_data_docs
(
path
)
filename
=
path
.
name
filename
=
path
.
name
...
@@ -535,8 +535,8 @@ def scan_docs_dir(user=Depends(get_admin_user)):
...
@@ -535,8 +535,8 @@ def scan_docs_dir(user=Depends(get_admin_user)):
),
),
)
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
return
True
return
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment