mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-24 23:41:10 +02:00
Merge pull request #12 from okapteinis/claude/pr-review-fixes-01WNkTGGrYURxe9JATA3gX6y
Move imports to top of file per PEP 8 guidelines
This commit is contained in:
commit
f770617d9f
1 changed files with 4 additions and 9 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
# Force asyncio to use standard event loop before unstructured imports
|
# Force asyncio to use standard event loop before unstructured imports
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
|
import uuid
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, Form, HTTPException, UploadFile
|
from fastapi import APIRouter, Depends, Form, HTTPException, UploadFile
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
@ -23,6 +26,7 @@ from app.schemas import (
|
||||||
)
|
)
|
||||||
from app.users import current_active_user
|
from app.users import current_active_user
|
||||||
from app.utils.check_ownership import check_ownership
|
from app.utils.check_ownership import check_ownership
|
||||||
|
from app.tasks.celery_tasks.document_tasks import process_file_upload_task
|
||||||
|
|
||||||
try:
|
try:
|
||||||
asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.DefaultEventLoopPolicy())
|
||||||
|
|
@ -108,11 +112,6 @@ async def create_documents_file_upload(
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
try:
|
try:
|
||||||
# Save file to persistent uploads directory
|
|
||||||
import os
|
|
||||||
import uuid
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Create uploads directory if it doesn't exist
|
# Create uploads directory if it doesn't exist
|
||||||
uploads_dir = Path(os.getenv("UPLOADS_DIR", "./uploads"))
|
uploads_dir = Path(os.getenv("UPLOADS_DIR", "./uploads"))
|
||||||
uploads_dir.mkdir(parents=True, exist_ok=True)
|
uploads_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
@ -127,10 +126,6 @@ async def create_documents_file_upload(
|
||||||
with open(temp_path, "wb") as f:
|
with open(temp_path, "wb") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
from app.tasks.celery_tasks.document_tasks import (
|
|
||||||
process_file_upload_task,
|
|
||||||
)
|
|
||||||
|
|
||||||
process_file_upload_task.delay(
|
process_file_upload_task.delay(
|
||||||
temp_path, file.filename, search_space_id, str(user.id)
|
temp_path, file.filename, search_space_id, str(user.id)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue