This commit is contained in:
Timothy Jaeryang Baek
2026-02-21 15:35:34 -06:00
parent c114fd6876
commit 631e30e22d
26 changed files with 177 additions and 164 deletions
+3 -1
View File
@@ -400,7 +400,9 @@ async def search_files(
Uses SQL-based filtering with pagination for better performance.
"""
# Determine user_id: null for admin with bypass (search all), user.id otherwise
user_id = None if (user.role == "admin" and BYPASS_ADMIN_ACCESS_CONTROL) else user.id
user_id = (
None if (user.role == "admin" and BYPASS_ADMIN_ACCESS_CONTROL) else user.id
)
# Use optimized database query with pagination
files = Files.search_files(
+2 -8
View File
@@ -69,8 +69,6 @@ log = logging.getLogger(__name__)
##########################################
async def send_get_request(url, key=None, user: UserModel = None):
timeout = aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST)
try:
@@ -374,9 +372,7 @@ async def get_all_models_responses(request: Request, user: UserModel) -> list:
request_tasks = []
for idx, url in enumerate(api_base_urls):
if (str(idx) not in api_configs) and (url not in api_configs): # Legacy support
request_tasks.append(
get_models_request(url, api_keys[idx], user=user)
)
request_tasks.append(get_models_request(url, api_keys[idx], user=user))
else:
api_config = api_configs.get(
str(idx),
@@ -716,9 +712,7 @@ async def verify_connection(
status_code=500, detail="Failed to connect to Anthropic API"
)
if "error" in result:
raise HTTPException(
status_code=500, detail=result["error"]
)
raise HTTPException(status_code=500, detail=result["error"])
return result
else:
async with session.get(
+7 -5
View File
@@ -1216,9 +1216,7 @@ async def update_rag_config(
request.app.state.config.YANDEX_WEB_SEARCH_CONFIG = (
form_data.web.YANDEX_WEB_SEARCH_CONFIG
)
request.app.state.config.YOUCOM_API_KEY = (
form_data.web.YOUCOM_API_KEY
)
request.app.state.config.YOUCOM_API_KEY = form_data.web.YOUCOM_API_KEY
return {
"status": True,
@@ -1950,7 +1948,9 @@ async def process_web(
request: Request,
form_data: ProcessUrlForm,
process: bool = Query(True, description="Whether to process and save the content"),
overwrite: bool = Query(True, description="Whether to overwrite existing collection"),
overwrite: bool = Query(
True, description="Whether to overwrite existing collection"
),
user=Depends(get_verified_user),
):
try:
@@ -2362,7 +2362,9 @@ async def process_web_search(
user,
)
search_tasks = [search_query_with_semaphore(query) for query in form_data.queries]
search_tasks = [
search_query_with_semaphore(query) for query in form_data.queries
]
else:
# Unlimited parallel execution (previous behavior)
search_tasks = [