From e6784132147618c4fb415c3f4ddb6e9a52787315 Mon Sep 17 00:00:00 2001 From: uersula <2206512436@qq.com> Date: Mon, 7 Jul 2025 02:30:50 +0800 Subject: [PATCH] Fix: Prevent KeyError in _remove_image_from_context --- astrbot/core/provider/sources/openai_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/provider/sources/openai_source.py b/astrbot/core/provider/sources/openai_source.py index 36a8579a6..ec1624776 100644 --- a/astrbot/core/provider/sources/openai_source.py +++ b/astrbot/core/provider/sources/openai_source.py @@ -487,7 +487,7 @@ class ProviderOpenAIOfficial(Provider): if flag: flag = False # 删除 image 后,下一条(LLM 响应)也要删除 continue - if isinstance(context["content"], list): + if "content" in context and isinstance(context["content"], list): flag = True # continue new_content = []