Private
Public Access
0
0

refactor(ai_client): migrate _send_qwen to provider_state.get_history('qwen')

This commit is contained in:
2026-06-25 12:33:13 -04:00
parent 9a1812b286
commit 81e013d7a8
+6 -5
View File
@@ -2810,18 +2810,19 @@ def _send_qwen(md_content: str, user_message: str, base_dir: str,
from src.qwen_adapter import classify_dashscope_error from src.qwen_adapter import classify_dashscope_error
try: try:
_ensure_qwen_client() _ensure_qwen_client()
with _qwen_history_lock: history = provider_state.get_history("qwen")
with history.lock:
user_content = user_message user_content = user_message
if file_items: if file_items:
for fi in file_items: for fi in file_items:
if fi.get("is_image") and fi.get("base64_data"): if fi.get("is_image") and fi.get("base64_data"):
user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}" user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}"
if discussion_history and not _qwen_history: if discussion_history and not history:
_qwen_history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"}) history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"})
else: else:
_qwen_history.append({"role": "user", "content": user_content}) history.append({"role": "user", "content": user_content})
messages = [{"role": "system", "content": f"{_get_combined_system_prompt()}\n\n<context>\n{md_content}\n</context>"}] messages = [{"role": "system", "content": f"{_get_combined_system_prompt()}\n\n<context>\n{md_content}\n</context>"}]
messages.extend(_qwen_history) messages.extend(history)
resp = _dashscope_call( resp = _dashscope_call(
model=_model, model=_model,
messages=messages, messages=messages,