fix: LIMIT $ → direct interpolation to avoid MySQL variable error

This commit is contained in:
yumoqing 2026-08-02 15:46:37 +08:00
parent ee8005644f
commit 0d0c8299e8

View File

@ -171,8 +171,7 @@ async def _build_context(sor, iteration_id, task_id, max_msgs, system_prompt):
params["iid"] = iteration_id
if where:
sql = f"SELECT role, content FROM pipeline_conversations WHERE {' OR '.join(where)} ORDER BY created_at DESC LIMIT ${max_msgs}$"
params["max_msgs"] = max_msgs
sql = f"SELECT role, content FROM pipeline_conversations WHERE {' OR '.join(where)} ORDER BY created_at DESC LIMIT {max_msgs}"
history = await sor.sqlExe(sql, params)
# Reverse to chronological order
for h in reversed(history):