guzhi/app/schemas/third_party_api.py
邹方成 11542275f3 feat(upload): 添加文件上传功能接口和静态文件支持
refactor(third_party_api): 重构第三方API模块结构和逻辑
feat(third_party_api): 新增OCR图片识别接口
style(third_party_api): 优化API请求参数和响应模型

build: 添加静态文件目录挂载配置
2025-10-09 15:19:29 +08:00

53 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import logging
from typing import List, Optional
from pydantic import BaseModel, Field
logger = logging.getLogger(__name__)
class BaseAPIRequest(BaseModel):
"""基础API请求模型"""
pass
class ChinazAPIRequest(BaseAPIRequest):
"""站长之家API请求模型"""
company_name: Optional[str] = Field(None, description="公司名称")
chinaz_ver: str = Field("1.0", description="API版本号")
class OCRRequest(BaseAPIRequest):
"""OCR识别请求模型"""
url: str = Field(..., description="图片URL地址(支持jpgpngjpeg1M以内)")
chinaz_ver: str = Field("1.0", description="API版本号")
class XiaohongshuNoteRequest(BaseAPIRequest):
"""小红书笔记请求模型"""
note_id: str = Field(..., description="笔记ID")
class JizhiliaoSearchRequest(BaseAPIRequest):
"""极致聊搜索请求模型"""
keyword: str = Field(..., description="搜索关键词")
page: int = Field(1, description="页码")
size: int = Field(10, description="每页数量")
class APIResponse(BaseModel):
"""API响应模型"""
success: bool
message: str
data: Optional[dict] = None
class APIEndpointInfo(BaseModel):
"""API端点信息"""
path: str
method: str
description: str
required_params: List[str]
optional_params: Optional[List[str]] = None
class APIProviderInfo(BaseModel):
"""API提供商信息"""
name: str
base_url: str
endpoints: dict[str, APIEndpointInfo]
class APIListResponse(BaseModel):
"""API列表响应"""
providers: List[APIProviderInfo]