fix(prompt-optimizer): support list content type in prompt optimizer
This commit is contained in:
@@ -227,7 +227,14 @@ class PromptOptimizerService:
|
|||||||
content = getattr(chunk, "content", chunk)
|
content = getattr(chunk, "content", chunk)
|
||||||
if not content:
|
if not content:
|
||||||
continue
|
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]
|
cache = buffer[:-20]
|
||||||
|
|
||||||
# 尝试找到 "prompt": " 开始位置
|
# 尝试找到 "prompt": " 开始位置
|
||||||
|
|||||||
Reference in New Issue
Block a user