Merge branch 'main' into prompt
This commit is contained in:
commit
db853e6604
33 files changed
+3444
-369
No files matched your search
@@ -12,6 +12,8 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database.session import get_session, AsyncSessionLocal
|
||||
from app.home.models import Image
|
||||
from app.user.dependencies.auth import get_current_user
|
||||
from app.user.models import User
|
||||
from app.home.schemas.home_schema import (
|
||||
AutoCompleteRequest,
|
||||
CrawlingRequest,
|
||||
@@ -500,6 +502,7 @@ async def upload_images(
|
||||
files: Optional[list[UploadFile]] = File(
|
||||
default=None, description="이미지 바이너리 파일 목록"
|
||||
),
|
||||
current_user: User = Depends(get_current_user),
|
||||
session: AsyncSession = Depends(get_session),
|
||||
) -> ImageUploadResponse:
|
||||
"""이미지 업로드 (URL + 바이너리 파일)"""
|
||||
@@ -653,6 +656,9 @@ async def upload_images(
|
||||
이미지를 Azure Blob Storage에 업로드하고 새로운 task_id를 생성합니다.
|
||||
바이너리 파일은 로컬 서버에 저장하지 않고 Azure Blob에 직접 업로드됩니다.
|
||||
|
||||
## 인증
|
||||
**Bearer 토큰 필수** - `Authorization: Bearer {access_token}` 헤더를 포함해야 합니다.
|
||||
|
||||
## 요청 방식
|
||||
multipart/form-data 형식으로 전송합니다.
|
||||
|
||||
@@ -679,11 +685,13 @@ jpg, jpeg, png, webp, heic, heif
|
||||
```bash
|
||||
# 바이너리 파일만 업로드
|
||||
curl -X POST "http://localhost:8000/image/upload/blob" \\
|
||||
-H "Authorization: Bearer {access_token}" \\
|
||||
-F "files=@/path/to/image1.jpg" \\
|
||||
-F "files=@/path/to/image2.png"
|
||||
|
||||
# URL + 바이너리 파일 동시 업로드
|
||||
curl -X POST "http://localhost:8000/image/upload/blob" \\
|
||||
-H "Authorization: Bearer {access_token}" \\
|
||||
-F 'images_json=[{"url":"https://example.com/image.jpg"}]' \\
|
||||
-F "files=@/path/to/local_image.jpg"
|
||||
```
|
||||
@@ -706,6 +714,7 @@ curl -X POST "http://localhost:8000/image/upload/blob" \\
|
||||
responses={
|
||||
200: {"description": "이미지 업로드 성공"},
|
||||
400: {"description": "이미지가 제공되지 않음", "model": ErrorResponse},
|
||||
401: {"description": "인증 실패 (토큰 없음/만료)"},
|
||||
},
|
||||
tags=["Image-Blob"],
|
||||
openapi_extra={
|
||||
@@ -728,6 +737,7 @@ async def upload_images_blob(
|
||||
default=None,
|
||||
description="이미지 바이너리 파일 목록",
|
||||
),
|
||||
current_user: User = Depends(get_current_user),
|
||||
) -> ImageUploadResponse:
|
||||
"""이미지 업로드 (URL + Azure Blob Storage)
|
||||
|
||||
@@ -806,7 +816,7 @@ async def upload_images_blob(
|
||||
img_order = len(url_images) # URL 이미지 다음 순서부터 시작
|
||||
|
||||
if valid_files_data:
|
||||
uploader = AzureBlobUploader(task_id=task_id)
|
||||
uploader = AzureBlobUploader(user_uuid=current_user.user_uuid, task_id=task_id)
|
||||
total_files = len(valid_files_data)
|
||||
|
||||
for idx, (original_name, ext, file_content) in enumerate(valid_files_data):
|
||||
|
||||
Reference in new issue
Block a user