refactor(third_party_api): 重构第三方API模块结构和逻辑 feat(third_party_api): 新增OCR图片识别接口 style(third_party_api): 优化API请求参数和响应模型 build: 添加静态文件目录挂载配置
14 lines
490 B
Python
14 lines
490 B
Python
from fastapi import APIRouter, UploadFile, File
|
|
from app.controllers.upload import UploadController
|
|
from app.schemas.upload import ImageUploadResponse
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/image", response_model=ImageUploadResponse, summary="上传图片")
|
|
async def upload_image(file: UploadFile = File(...)) -> ImageUploadResponse:
|
|
"""
|
|
上传图片接口
|
|
:param file: 图片文件
|
|
:return: 图片URL和文件名
|
|
"""
|
|
return await UploadController.upload_image(file) |