This commit is contained in:
HuangHai
2026-01-26 09:15:45 +08:00
parent 6b6a32c902
commit d9bb1d1f83
17 changed files with 70 additions and 358 deletions

View File

@@ -25,6 +25,23 @@ ocr_kit = EasyOcrKit()
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger("WxUtil")
def connect_device():
"""
连接设备并返回设备对象,同时打印详细的设备信息
"""
try:
d = u2.connect()
# 获取可靠的序列号
device_serial = d.serial if hasattr(d, 'serial') else "未知"
logger.info(f"设备连接成功: {device_serial}")
# 获取并打印详细设备信息
device_info = d.device_info
logger.info(f"详细设备信息: 品牌={device_info.get('brand')}, 型号={device_info.get('model')}, SDK={device_info.get('sdk')}")
return d
except Exception as e:
logger.error(f"设备连接失败: {e}")
return None
async def get_vlm_json(image_path, prompt):
"""
@@ -249,7 +266,7 @@ async def analyze_chat_image(image_path, output_path, device=None, target_name="
unconverted_voices = [unconverted_voices[-1]]
# 使用传入的 device 或创建新连接
d = device if device else u2.connect()
d = device if device else connect_device()
for voice in unconverted_voices:
vx, vy = voice['coordinates']