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
fa5918ad
Unverified
Commit
fa5918ad
authored
Jan 25, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jan 25, 2024
Browse files
Merge branch 'main' into main
parents
1e932d91
39986c4e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
27 deletions
+55
-27
.dockerignore
.dockerignore
+3
-0
Dockerfile
Dockerfile
+16
-10
backend/apps/rag/main.py
backend/apps/rag/main.py
+13
-4
backend/constants.py
backend/constants.py
+2
-0
backend/requirements.txt
backend/requirements.txt
+5
-5
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+13
-7
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+2
-1
src/lib/constants.ts
src/lib/constants.ts
+1
-0
No files found.
.dockerignore
View file @
fa5918ad
.github
.DS_Store
.DS_Store
docs
kubernetes
node_modules
node_modules
/.svelte-kit
/.svelte-kit
/package
/package
...
...
Dockerfile
View file @
fa5918ad
...
@@ -26,7 +26,21 @@ ENV OPENAI_API_KEY ""
...
@@ -26,7 +26,21 @@ ENV OPENAI_API_KEY ""
ENV
WEBUI_JWT_SECRET_KEY "SECRET_KEY"
ENV
WEBUI_JWT_SECRET_KEY "SECRET_KEY"
WORKDIR
/app
WORKDIR
/app/backend
# install python dependencies
COPY
./backend/requirements.txt ./requirements.txt
RUN
pip3
install
torch torchvision torchaudio
--index-url
https://download.pytorch.org/whl/cpu
--no-cache-dir
RUN
pip3
install
-r
requirements.txt
--no-cache-dir
# Install pandoc
# RUN python -c "import pypandoc; pypandoc.download_pandoc()"
RUN
apt-get update
\
&&
apt-get
install
-y
pandoc
\
&&
rm
-rf
/var/lib/apt/lists/
*
# RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
# copy embedding weight from build
# copy embedding weight from build
RUN
mkdir
-p
/root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
RUN
mkdir
-p
/root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
...
@@ -38,15 +52,7 @@ RUN cd /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 &&\
...
@@ -38,15 +52,7 @@ RUN cd /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 &&\
# copy built frontend files
# copy built frontend files
COPY
--from=build /app/build /app/build
COPY
--from=build /app/build /app/build
WORKDIR
/app/backend
# copy backend files
COPY
./backend/requirements.txt ./requirements.txt
RUN
pip3
install
torch torchvision torchaudio
--index-url
https://download.pytorch.org/whl/cpu
--no-cache-dir
RUN
pip3
install
-r
requirements.txt
--no-cache-dir
# RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
COPY
./backend .
COPY
./backend .
CMD
[ "sh", "start.sh"]
CMD
[ "sh", "start.sh"]
\ No newline at end of file
backend/apps/rag/main.py
View file @
fa5918ad
...
@@ -19,6 +19,7 @@ from langchain_community.document_loaders import (
...
@@ -19,6 +19,7 @@ from langchain_community.document_loaders import (
PyPDFLoader
,
PyPDFLoader
,
CSVLoader
,
CSVLoader
,
Docx2txtLoader
,
Docx2txtLoader
,
UnstructuredEPubLoader
,
UnstructuredWordDocumentLoader
,
UnstructuredWordDocumentLoader
,
UnstructuredMarkdownLoader
,
UnstructuredMarkdownLoader
,
UnstructuredXMLLoader
,
UnstructuredXMLLoader
,
...
@@ -193,6 +194,8 @@ def store_doc(
...
@@ -193,6 +194,8 @@ def store_doc(
loader
=
TextLoader
(
file_path
)
loader
=
TextLoader
(
file_path
)
elif
file_ext
in
octet_markdown
:
elif
file_ext
in
octet_markdown
:
loader
=
UnstructuredMarkdownLoader
(
file_path
)
loader
=
UnstructuredMarkdownLoader
(
file_path
)
elif
file
.
content_type
==
"application/epub+zip"
:
loader
=
UnstructuredEPubLoader
(
file_path
)
else
:
else
:
loader
=
TextLoader
(
file_path
)
loader
=
TextLoader
(
file_path
)
known_type
=
False
known_type
=
False
...
@@ -215,10 +218,16 @@ def store_doc(
...
@@ -215,10 +218,16 @@ def store_doc(
)
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
print
(
e
)
raise
HTTPException
(
if
"No pandoc was found"
in
str
(
e
):
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
raise
HTTPException
(
detail
=
ERROR_MESSAGES
.
DEFAULT
(
e
),
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
)
detail
=
ERROR_MESSAGES
.
PANDOC_NOT_INSTALLED
,
)
else
:
raise
HTTPException
(
status_code
=
status
.
HTTP_400_BAD_REQUEST
,
detail
=
ERROR_MESSAGES
.
DEFAULT
(
e
),
)
@
app
.
get
(
"/reset/db"
)
@
app
.
get
(
"/reset/db"
)
...
...
backend/constants.py
View file @
fa5918ad
...
@@ -42,3 +42,5 @@ class ERROR_MESSAGES(str, Enum):
...
@@ -42,3 +42,5 @@ class ERROR_MESSAGES(str, Enum):
USER_NOT_FOUND
=
"We could not find what you're looking for :/"
USER_NOT_FOUND
=
"We could not find what you're looking for :/"
API_KEY_NOT_FOUND
=
"Oops! It looks like there's a hiccup. The API key is missing. Please make sure to provide a valid API key to access this feature."
API_KEY_NOT_FOUND
=
"Oops! It looks like there's a hiccup. The API key is missing. Please make sure to provide a valid API key to access this feature."
MALICIOUS
=
"Unusual activities detected, please try again in a few minutes."
MALICIOUS
=
"Unusual activities detected, please try again in a few minutes."
PANDOC_NOT_INSTALLED
=
"Pandoc is not installed on the server. Please contact your administrator for assistance."
backend/requirements.txt
View file @
fa5918ad
...
@@ -24,13 +24,13 @@ pypdf
...
@@ -24,13 +24,13 @@ pypdf
docx2txt
docx2txt
unstructured
unstructured
markdown
markdown
pypandoc
pandas
openpyxl
pyxlsb
xlrd
PyJWT
PyJWT
pyjwt[crypto]
pyjwt[crypto]
black
black
pandas
openpyxl
pyxlsb
xlrd
\ No newline at end of file
src/lib/components/chat/MessageInput.svelte
View file @
fa5918ad
...
@@ -121,13 +121,19 @@
...
@@ -121,13 +121,19 @@
error: ''
error: ''
};
};
files = [...files, doc];
try {
const res = await uploadDocToVectorDB(localStorage.token, '', file);
files = [...files, doc];
const res = await uploadDocToVectorDB(localStorage.token, '', file);
if (res) {
doc.upload_status = true;
if (res) {
doc.collection_name = res.collection_name;
doc.upload_status = true;
files = files;
doc.collection_name = res.collection_name;
files = files;
}
} catch (e) {
// Remove the failed doc from the files array
files = files.filter((f) => f.name !== file.name);
toast.error(e);
}
}
};
};
...
...
src/lib/components/layout/Sidebar.svelte
View file @
fa5918ad
...
@@ -321,8 +321,9 @@
...
@@ -321,8 +321,9 @@
return true;
return true;
} else {
} else {
let title = chat.title.toLowerCase();
let title = chat.title.toLowerCase();
const query = search.toLowerCase();
if (title.includes(
search
)) {
if (title.includes(
query
)) {
return true;
return true;
} else {
} else {
return false;
return false;
...
...
src/lib/constants.ts
View file @
fa5918ad
...
@@ -12,6 +12,7 @@ export const WEB_UI_VERSION = 'v1.0.0-alpha-static';
...
@@ -12,6 +12,7 @@ export const WEB_UI_VERSION = 'v1.0.0-alpha-static';
export
const
REQUIRED_OLLAMA_VERSION
=
'
0.1.16
'
;
export
const
REQUIRED_OLLAMA_VERSION
=
'
0.1.16
'
;
export
const
SUPPORTED_FILE_TYPE
=
[
export
const
SUPPORTED_FILE_TYPE
=
[
'
application/epub+zip
'
,
'
application/pdf
'
,
'
application/pdf
'
,
'
text/plain
'
,
'
text/plain
'
,
'
text/csv
'
,
'
text/csv
'
,
...
...
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