Merge pull request #900 from SuanmoSuanyangTechnology/fix/prompt_optim

fix(prompt-optimizer): support list content type in prompt optimizer
This commit is contained in:
山程漫悟
2026-04-15 11:39:01 +08:00
committed by GitHub

View File

@@ -227,7 +227,14 @@ class PromptOptimizerService:
content = getattr(chunk, "content", chunk)
if not content:
continue
buffer += content
if isinstance(content, str):
buffer += content
elif isinstance(content, list):
for _ in content:
buffer += _["text"]
else:
logger.error(f"Unsupported content type - {content}")
raise Exception("Unsupported content type")
cache = buffer[:-20]
# 尝试找到 "prompt": " 开始位置