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
35ace577
Commit
35ace577
authored
Jan 19, 2024
by
Marclass
Browse files
add rst document for RAG
parent
e2edbede
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
backend/apps/rag/main.py
backend/apps/rag/main.py
+3
-0
No files found.
backend/apps/rag/main.py
View file @
35ace577
...
@@ -22,6 +22,7 @@ from langchain_community.document_loaders import (
...
@@ -22,6 +22,7 @@ from langchain_community.document_loaders import (
UnstructuredWordDocumentLoader
,
UnstructuredWordDocumentLoader
,
UnstructuredMarkdownLoader
,
UnstructuredMarkdownLoader
,
UnstructuredXMLLoader
,
UnstructuredXMLLoader
,
UnstructuredRSTLoader
,
)
)
from
langchain.text_splitter
import
RecursiveCharacterTextSplitter
from
langchain.text_splitter
import
RecursiveCharacterTextSplitter
from
langchain_community.vectorstores
import
Chroma
from
langchain_community.vectorstores
import
Chroma
...
@@ -178,6 +179,8 @@ def store_doc(
...
@@ -178,6 +179,8 @@ def store_doc(
loader
=
Docx2txtLoader
(
file_path
)
loader
=
Docx2txtLoader
(
file_path
)
elif
file_ext
==
"csv"
:
elif
file_ext
==
"csv"
:
loader
=
CSVLoader
(
file_path
)
loader
=
CSVLoader
(
file_path
)
elif
file_ext
==
"rst"
:
loader
=
UnstructuredRSTLoader
(
file_path
,
mode
=
"elements"
)
elif
file_ext
in
text_xml
:
elif
file_ext
in
text_xml
:
loader
=
UnstructuredXMLLoader
(
file_path
)
loader
=
UnstructuredXMLLoader
(
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
.
find
(
"text/"
)
>=
0
:
...
...
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