From 74d0ea3379555dd9d1075f1c6399306f4b96a6d5 Mon Sep 17 00:00:00 2001 From: ZiWei <131428629+ZiWei09@users.noreply.github.com> Date: Mon, 22 Dec 2025 14:37:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=9C=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=89=A9=E6=96=99=E6=97=B6=E5=A4=84=E7=90=86=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E5=92=8C=E5=AD=97=E5=85=B8=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=AD=A3=E7=A1=AE=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../devices/workstation/bioyond_studio/bioyond_rpc.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py index d7f63bf..94e8a5a 100644 --- a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py +++ b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py @@ -180,8 +180,15 @@ class BioyondV1RPC(BaseRequest): # 自动更新缓存 data = response.get("data", {}) if data: - name = data.get("name") or params.get("name") - mat_id = data.get("id") + if isinstance(data, str): + # 如果返回的是字符串,通常是ID + mat_id = data + name = params.get("name") + else: + # 如果返回的是字典,尝试获取name和id + name = data.get("name") or params.get("name") + mat_id = data.get("id") + if name and mat_id: self.material_cache[name] = mat_id print(f"已自动更新缓存: {name} -> {mat_id}")