chore: format
This commit is contained in:
1 parent
f71e9570c0
commit
5c62cc0517
99 files changed
+12026
-5908
No files matched your search
@@ -79,6 +79,7 @@ async def delete_file_resource(file: FileModel, db: AsyncSession) -> bool:
|
||||
|
||||
return result
|
||||
|
||||
|
||||
############################
|
||||
# Knowledge Base Embedding
|
||||
############################
|
||||
|
||||
@@ -2205,9 +2205,10 @@ async def _fetch_url(url: str, max_size_mb: int | str | None) -> dict:
|
||||
|
||||
if not is_attachment and base_content_type in {'', 'application/octet-stream', 'binary/octet-stream'}:
|
||||
sample = first_chunk[:4096].lstrip().lower()
|
||||
if sample.startswith(
|
||||
(b'<!doctype html', b'<html', b'<head', b'<body', b'<?xml')
|
||||
) or b'<html' in sample[:1024]:
|
||||
if (
|
||||
sample.startswith((b'<!doctype html', b'<html', b'<head', b'<body', b'<?xml'))
|
||||
or b'<html' in sample[:1024]
|
||||
):
|
||||
return {'kind': 'web'}
|
||||
|
||||
if max_bytes and content_length:
|
||||
|
||||
@@ -73,9 +73,7 @@ async def get_tools(
|
||||
tools = []
|
||||
bypass_access_control = user.role == 'admin' and BYPASS_ADMIN_ACCESS_CONTROL
|
||||
user_group_ids = (
|
||||
set()
|
||||
if bypass_access_control
|
||||
else {group.id for group in await Groups.get_groups_by_member_id(user.id, db=db)}
|
||||
set() if bypass_access_control else {group.id for group in await Groups.get_groups_by_member_id(user.id, db=db)}
|
||||
)
|
||||
|
||||
# Local Tools
|
||||
@@ -210,9 +208,7 @@ async def get_tool_list(user=Depends(get_verified_user), db: AsyncSession = Depe
|
||||
|
||||
bypass_access_control = user.role == 'admin' and BYPASS_ADMIN_ACCESS_CONTROL
|
||||
user_group_ids = (
|
||||
set()
|
||||
if bypass_access_control
|
||||
else {group.id for group in await Groups.get_groups_by_member_id(user.id, db=db)}
|
||||
set() if bypass_access_control else {group.id for group in await Groups.get_groups_by_member_id(user.id, db=db)}
|
||||
)
|
||||
tools = await Tools.get_tools(
|
||||
defer_content=True,
|
||||
|
||||
Reference in new issue
Block a user