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
642c5e03
Unverified
Commit
642c5e03
authored
Jul 08, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Jul 08, 2024
Browse files
Merge branch 'dev' into dependabot/pip/backend/dev/peewee-3.17.6
parents
44bbb405
18962104
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
24 deletions
+36
-24
.github/workflows/integration-test.yml
.github/workflows/integration-test.yml
+4
-0
backend/apps/webui/internal/db.py
backend/apps/webui/internal/db.py
+0
-6
backend/apps/webui/models/auths.py
backend/apps/webui/models/auths.py
+2
-2
backend/apps/webui/models/chats.py
backend/apps/webui/models/chats.py
+3
-2
backend/apps/webui/models/documents.py
backend/apps/webui/models/documents.py
+1
-0
backend/apps/webui/models/users.py
backend/apps/webui/models/users.py
+1
-0
backend/config.py
backend/config.py
+4
-0
backend/main.py
backend/main.py
+5
-7
backend/migrations/env.py
backend/migrations/env.py
+12
-3
backend/requirements.txt
backend/requirements.txt
+3
-3
src/lib/i18n/locales/vi-VN/translation.json
src/lib/i18n/locales/vi-VN/translation.json
+1
-1
No files found.
.github/workflows/integration-test.yml
View file @
642c5e03
...
@@ -35,6 +35,10 @@ jobs:
...
@@ -35,6 +35,10 @@ jobs:
done
done
echo "Service is up!"
echo "Service is up!"
-
name
:
Delete Docker build cache
run
:
|
docker builder prune --all --force
-
name
:
Preload Ollama model
-
name
:
Preload Ollama model
run
:
|
run
:
|
docker exec ollama ollama pull qwen:0.5b-chat-v1.5-q2_K
docker exec ollama ollama pull qwen:0.5b-chat-v1.5-q2_K
...
...
backend/apps/webui/internal/db.py
View file @
642c5e03
...
@@ -81,12 +81,6 @@ handle_peewee_migration()
...
@@ -81,12 +81,6 @@ handle_peewee_migration()
SQLALCHEMY_DATABASE_URL
=
DATABASE_URL
SQLALCHEMY_DATABASE_URL
=
DATABASE_URL
# Replace the postgres:// with postgresql://
if
"postgres://"
in
SQLALCHEMY_DATABASE_URL
:
SQLALCHEMY_DATABASE_URL
=
SQLALCHEMY_DATABASE_URL
.
replace
(
"postgres://"
,
"postgresql://"
)
if
"sqlite"
in
SQLALCHEMY_DATABASE_URL
:
if
"sqlite"
in
SQLALCHEMY_DATABASE_URL
:
engine
=
create_engine
(
engine
=
create_engine
(
SQLALCHEMY_DATABASE_URL
,
connect_args
=
{
"check_same_thread"
:
False
}
SQLALCHEMY_DATABASE_URL
,
connect_args
=
{
"check_same_thread"
:
False
}
...
...
backend/apps/webui/models/auths.py
View file @
642c5e03
...
@@ -169,10 +169,10 @@ class AuthsTable:
...
@@ -169,10 +169,10 @@ class AuthsTable:
def
update_user_password_by_id
(
self
,
id
:
str
,
new_password
:
str
)
->
bool
:
def
update_user_password_by_id
(
self
,
id
:
str
,
new_password
:
str
)
->
bool
:
try
:
try
:
with
get_db
()
as
db
:
with
get_db
()
as
db
:
result
=
(
result
=
(
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"password"
:
new_password
})
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"password"
:
new_password
})
)
)
db
.
commit
()
return
True
if
result
==
1
else
False
return
True
if
result
==
1
else
False
except
:
except
:
return
False
return
False
...
@@ -180,8 +180,8 @@ class AuthsTable:
...
@@ -180,8 +180,8 @@ class AuthsTable:
def
update_email_by_id
(
self
,
id
:
str
,
email
:
str
)
->
bool
:
def
update_email_by_id
(
self
,
id
:
str
,
email
:
str
)
->
bool
:
try
:
try
:
with
get_db
()
as
db
:
with
get_db
()
as
db
:
result
=
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"email"
:
email
})
result
=
db
.
query
(
Auth
).
filter_by
(
id
=
id
).
update
({
"email"
:
email
})
db
.
commit
()
return
True
if
result
==
1
else
False
return
True
if
result
==
1
else
False
except
:
except
:
return
False
return
False
...
...
backend/apps/webui/models/chats.py
View file @
642c5e03
...
@@ -141,13 +141,14 @@ class ChatTable:
...
@@ -141,13 +141,14 @@ class ChatTable:
db
.
add
(
shared_result
)
db
.
add
(
shared_result
)
db
.
commit
()
db
.
commit
()
db
.
refresh
(
shared_result
)
db
.
refresh
(
shared_result
)
# Update the original chat with the share_id
# Update the original chat with the share_id
result
=
(
result
=
(
db
.
query
(
Chat
)
db
.
query
(
Chat
)
.
filter_by
(
id
=
chat_id
)
.
filter_by
(
id
=
chat_id
)
.
update
({
"share_id"
:
shared_chat
.
id
})
.
update
({
"share_id"
:
shared_chat
.
id
})
)
)
db
.
commit
()
return
shared_chat
if
(
shared_result
and
result
)
else
None
return
shared_chat
if
(
shared_result
and
result
)
else
None
def
update_shared_chat_by_chat_id
(
self
,
chat_id
:
str
)
->
Optional
[
ChatModel
]:
def
update_shared_chat_by_chat_id
(
self
,
chat_id
:
str
)
->
Optional
[
ChatModel
]:
...
@@ -206,8 +207,8 @@ class ChatTable:
...
@@ -206,8 +207,8 @@ class ChatTable:
def
archive_all_chats_by_user_id
(
self
,
user_id
:
str
)
->
bool
:
def
archive_all_chats_by_user_id
(
self
,
user_id
:
str
)
->
bool
:
try
:
try
:
with
get_db
()
as
db
:
with
get_db
()
as
db
:
db
.
query
(
Chat
).
filter_by
(
user_id
=
user_id
).
update
({
"archived"
:
True
})
db
.
query
(
Chat
).
filter_by
(
user_id
=
user_id
).
update
({
"archived"
:
True
})
db
.
commit
()
return
True
return
True
except
:
except
:
return
False
return
False
...
...
backend/apps/webui/models/documents.py
View file @
642c5e03
...
@@ -158,6 +158,7 @@ class DocumentsTable:
...
@@ -158,6 +158,7 @@ class DocumentsTable:
with
get_db
()
as
db
:
with
get_db
()
as
db
:
db
.
query
(
Document
).
filter_by
(
name
=
name
).
delete
()
db
.
query
(
Document
).
filter_by
(
name
=
name
).
delete
()
db
.
commit
()
return
True
return
True
except
:
except
:
return
False
return
False
...
...
backend/apps/webui/models/users.py
View file @
642c5e03
...
@@ -212,6 +212,7 @@ class UsersTable:
...
@@ -212,6 +212,7 @@ class UsersTable:
try
:
try
:
with
get_db
()
as
db
:
with
get_db
()
as
db
:
db
.
query
(
User
).
filter_by
(
id
=
id
).
update
({
"oauth_sub"
:
oauth_sub
})
db
.
query
(
User
).
filter_by
(
id
=
id
).
update
({
"oauth_sub"
:
oauth_sub
})
db
.
commit
()
user
=
db
.
query
(
User
).
filter_by
(
id
=
id
).
first
()
user
=
db
.
query
(
User
).
filter_by
(
id
=
id
).
first
()
return
UserModel
.
model_validate
(
user
)
return
UserModel
.
model_validate
(
user
)
...
...
backend/config.py
View file @
642c5e03
...
@@ -1331,3 +1331,7 @@ AUDIO_TTS_VOICE = PersistentConfig(
...
@@ -1331,3 +1331,7 @@ AUDIO_TTS_VOICE = PersistentConfig(
####################################
####################################
DATABASE_URL
=
os
.
environ
.
get
(
"DATABASE_URL"
,
f
"sqlite:///
{
DATA_DIR
}
/webui.db"
)
DATABASE_URL
=
os
.
environ
.
get
(
"DATABASE_URL"
,
f
"sqlite:///
{
DATA_DIR
}
/webui.db"
)
# Replace the postgres:// with postgresql://
if
"postgres://"
in
DATABASE_URL
:
DATABASE_URL
=
DATABASE_URL
.
replace
(
"postgres://"
,
"postgresql://"
)
backend/main.py
View file @
642c5e03
...
@@ -173,13 +173,11 @@ https://github.com/open-webui/open-webui
...
@@ -173,13 +173,11 @@ https://github.com/open-webui/open-webui
def
run_migrations
():
def
run_migrations
():
env
=
os
.
environ
.
copy
()
from
alembic.config
import
Config
env
[
"DATABASE_URL"
]
=
DATABASE_URL
from
alembic
import
command
migration_task
=
subprocess
.
run
(
[
"alembic"
,
f
"-c
{
BACKEND_DIR
}
/alembic.ini"
,
"upgrade"
,
"head"
],
env
=
env
alembic_cfg
=
Config
(
"alembic.ini"
)
)
command
.
upgrade
(
alembic_cfg
,
"head"
)
if
migration_task
.
returncode
>
0
:
raise
ValueError
(
"Error running migrations"
)
@
asynccontextmanager
@
asynccontextmanager
...
...
backend/migrations/env.py
View file @
642c5e03
...
@@ -18,6 +18,8 @@ from apps.webui.models.users import User
...
@@ -18,6 +18,8 @@ from apps.webui.models.users import User
from
apps.webui.models.files
import
File
from
apps.webui.models.files
import
File
from
apps.webui.models.functions
import
Function
from
apps.webui.models.functions
import
Function
from
config
import
DATABASE_URL
# this is the Alembic Config object, which provides
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
# access to the values within the .ini file in use.
config
=
context
.
config
config
=
context
.
config
...
@@ -38,9 +40,16 @@ target_metadata = Auth.metadata
...
@@ -38,9 +40,16 @@ target_metadata = Auth.metadata
# my_important_option = config.get_main_option("my_important_option")
# my_important_option = config.get_main_option("my_important_option")
# ... etc.
# ... etc.
database_url
=
os
.
getenv
(
"DATABASE_URL"
,
None
)
DB_URL
=
DATABASE_URL
if
database_url
:
# Replace the postgres:// with postgresql://
config
.
set_main_option
(
"sqlalchemy.url"
,
database_url
)
if
"postgres://"
in
DB_URL
:
DB_URL
=
DB_URL
.
replace
(
"postgres://"
,
"postgresql://"
)
if
DB_URL
:
config
.
set_main_option
(
"sqlalchemy.url"
,
DB_URL
)
print
(
"DB_URL"
,
DB_URL
)
def
run_migrations_offline
()
->
None
:
def
run_migrations_offline
()
->
None
:
...
...
backend/requirements.txt
View file @
642c5e03
...
@@ -13,7 +13,7 @@ passlib[bcrypt]==1.7.4
...
@@ -13,7 +13,7 @@ passlib[bcrypt]==1.7.4
requests==2.32.3
requests==2.32.3
aiohttp==3.9.5
aiohttp==3.9.5
sqlalchemy==2.0.30
sqlalchemy==2.0.30
alembic==1.13.
1
alembic==1.13.
2
peewee==3.17.6
peewee==3.17.6
peewee-migrate==1.12.2
peewee-migrate==1.12.2
psycopg2-binary==2.9.9
psycopg2-binary==2.9.9
...
@@ -51,7 +51,7 @@ pyxlsb==1.0.10
...
@@ -51,7 +51,7 @@ pyxlsb==1.0.10
xlrd==2.0.1
xlrd==2.0.1
validators==0.28.1
validators==0.28.1
opencv-python-headless==4.
9
.0.8
0
opencv-python-headless==4.
10
.0.8
4
rapidocr-onnxruntime==1.3.22
rapidocr-onnxruntime==1.3.22
fpdf2==2.7.9
fpdf2==2.7.9
...
@@ -73,5 +73,5 @@ duckduckgo-search~=6.1.7
...
@@ -73,5 +73,5 @@ duckduckgo-search~=6.1.7
## Tests
## Tests
docker~=7.1.0
docker~=7.1.0
pytest~=8.2.
1
pytest~=8.2.
2
pytest-docker~=3.1.1
pytest-docker~=3.1.1
src/lib/i18n/locales/vi-VN/translation.json
View file @
642c5e03
...
@@ -182,7 +182,7 @@
...
@@ -182,7 +182,7 @@
"Discover, download, and explore custom functions"
:
"Tìm kiếm, tải về và khám phá thêm các function tùy chỉnh"
,
"Discover, download, and explore custom functions"
:
"Tìm kiếm, tải về và khám phá thêm các function tùy chỉnh"
,
"Discover, download, and explore custom prompts"
:
"Tìm kiếm, tải về và khám phá thêm các prompt tùy chỉnh"
,
"Discover, download, and explore custom prompts"
:
"Tìm kiếm, tải về và khám phá thêm các prompt tùy chỉnh"
,
"Discover, download, and explore custom tools"
:
"Tìm kiếm, tải về và khám phá thêm các tool tùy chỉnh"
,
"Discover, download, and explore custom tools"
:
"Tìm kiếm, tải về và khám phá thêm các tool tùy chỉnh"
,
"Discover, download, and explore model prese
Kh
ts"
:
"
Tìm kiếm, tải về và khám phá thêm các thiết lập mô hình sẵn
"
,
"Discover, download, and explore model presets"
:
""
,
"Dismissible"
:
"Có thể loại bỏ"
,
"Dismissible"
:
"Có thể loại bỏ"
,
"Display Emoji in Call"
:
"Hiển thị Emoji trong cuộc gọi"
,
"Display Emoji in Call"
:
"Hiển thị Emoji trong cuộc gọi"
,
"Display the username instead of You in the Chat"
:
"Hiển thị tên người sử dụng thay vì 'Bạn' trong nội dung chat"
,
"Display the username instead of You in the Chat"
:
"Hiển thị tên người sử dụng thay vì 'Bạn' trong nội dung chat"
,
...
...
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