refactor(ai_client): migrate _send_qwen to provider_state.get_history('qwen')
This commit is contained in:
+6
-5
@@ -2810,18 +2810,19 @@ def _send_qwen(md_content: str, user_message: str, base_dir: str,
|
||||
from src.qwen_adapter import classify_dashscope_error
|
||||
try:
|
||||
_ensure_qwen_client()
|
||||
with _qwen_history_lock:
|
||||
history = provider_state.get_history("qwen")
|
||||
with history.lock:
|
||||
user_content = user_message
|
||||
if file_items:
|
||||
for fi in file_items:
|
||||
if fi.get("is_image") and fi.get("base64_data"):
|
||||
user_content = f"[IMAGE: {fi.get('path', 'attachment')}]\n{user_content}"
|
||||
if discussion_history and not _qwen_history:
|
||||
_qwen_history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"})
|
||||
if discussion_history and not history:
|
||||
history.append({"role": "user", "content": f"[DISCUSSION HISTORY]\n\n{discussion_history}\n\n---\n\n{user_message}"})
|
||||
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.extend(_qwen_history)
|
||||
messages.extend(history)
|
||||
resp = _dashscope_call(
|
||||
model=_model,
|
||||
messages=messages,
|
||||
|
||||
Reference in New Issue
Block a user