fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 (将裸 except Exception 改为具体异常类型) - 修复PEP8格式问题 - 清理未使用导入 - 添加 UUID_LENGTH 常量替代魔法数字 - 添加 DEFAULT_RATE_LIMIT, MASTER_KEY_RATE_LIMIT, IP_RATE_LIMIT 常量 - 添加 MAX_TEXT_LENGTH, DEFAULT_TIMEOUT 常量 涉及文件: - backend/main.py - backend/db_manager.py - backend/llm_client.py - backend/neo4j_manager.py - backend/tingwu_client.py - backend/tenant_manager.py - backend/growth_manager.py - backend/workflow_manager.py - backend/image_processor.py - backend/multimodal_entity_linker.py - backend/multimodal_processor.py - backend/plugin_manager.py - backend/rate_limiter.py
This commit is contained in:
@@ -10,6 +10,9 @@ import os
|
||||
import uuid
|
||||
from dataclasses import dataclass
|
||||
|
||||
# Constants
|
||||
UUID_LENGTH = 8 # UUID 截断长度
|
||||
|
||||
# 尝试导入图像处理库
|
||||
try:
|
||||
from PIL import Image, ImageEnhance, ImageFilter
|
||||
@@ -369,7 +372,7 @@ class ImageProcessor:
|
||||
Returns:
|
||||
图片处理结果
|
||||
"""
|
||||
image_id = image_id or str(uuid.uuid4())[:8]
|
||||
image_id = image_id or str(uuid.uuid4())[:UUID_LENGTH]
|
||||
|
||||
if not PIL_AVAILABLE:
|
||||
return ImageProcessingResult(
|
||||
|
||||
Reference in New Issue
Block a user