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
8da06f5e
Commit
8da06f5e
authored
Jan 23, 2024
by
lucasew
Browse files
fixes after the refactor
Signed-off-by:
lucasew
<
lucas59356@gmail.com
>
parent
d2c5f3d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
backend/apps/web/routers/utils.py
backend/apps/web/routers/utils.py
+2
-2
backend/config.py
backend/config.py
+5
-4
backend/main.py
backend/main.py
+1
-1
No files found.
backend/apps/web/routers/utils.py
View file @
8da06f5e
...
...
@@ -111,12 +111,12 @@ def upload(file: UploadFile = File(...)):
file_path
=
f
"
{
UPLOAD_DIR
}
/
{
file
.
filename
}
"
# Save file in chunks
with
file_path
.
open
(
"wb+"
)
as
f
:
with
open
(
file_path
,
"wb+"
)
as
f
:
for
chunk
in
file
.
file
:
f
.
write
(
chunk
)
def
file_process_stream
():
total_size
=
os
.
path
.
getsize
(
str
(
file_path
)
)
total_size
=
os
.
path
.
getsize
(
file_path
)
chunk_size
=
1024
*
1024
try
:
with
open
(
file_path
,
"rb"
)
as
f
:
...
...
backend/config.py
View file @
8da06f5e
...
...
@@ -25,12 +25,13 @@ except ImportError:
# File Upload
####################################
DATA_DIR
=
Path
(
os
.
getenv
(
"DATA_DIR"
,
"./data"
)).
resolve
()
DATA_DIR
=
str
(
Path
(
os
.
getenv
(
"DATA_DIR"
,
"./data"
)).
resolve
()
)
UPLOAD_DIR
=
f
"
{
DATA_DIR
}
/uploads"
UPLOAD_DIR
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
FRONTEND_BUILD_DIR
=
Path
(
os
.
getenv
(
"FRONTEND_BUILD_DIR"
,
"../build"
))
Path
(
UPLOAD_DIR
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
FRONTEND_BUILD_DIR
=
str
(
Path
(
os
.
getenv
(
"FRONTEND_BUILD_DIR"
,
"../build"
)))
####################################
# ENV (dev,test,prod)
...
...
@@ -88,7 +89,7 @@ if WEBUI_AUTH and WEBUI_JWT_SECRET_KEY == "":
CHROMA_DATA_PATH
=
f
"
{
DATA_DIR
}
/vector_db"
EMBED_MODEL
=
"all-MiniLM-L6-v2"
CHROMA_CLIENT
=
chromadb
.
PersistentClient
(
path
=
str
(
CHROMA_DATA_PATH
)
,
settings
=
Settings
(
allow_reset
=
True
)
path
=
CHROMA_DATA_PATH
,
settings
=
Settings
(
allow_reset
=
True
)
)
CHUNK_SIZE
=
1500
CHUNK_OVERLAP
=
100
backend/main.py
View file @
8da06f5e
...
...
@@ -60,6 +60,6 @@ app.mount("/rag/api/v1", rag_app)
app
.
mount
(
"/"
,
SPAStaticFiles
(
directory
=
str
(
FRONTEND_BUILD_DIR
)
,
html
=
True
),
SPAStaticFiles
(
directory
=
FRONTEND_BUILD_DIR
,
html
=
True
),
name
=
"spa-static-files"
,
)
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