auto-coder-web 0.1.102__py3-none-any.whl → 0.1.104__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,23 +60,31 @@ def ensure_task_dir(project_path: str) -> str:
60
60
  return task_dir
61
61
 
62
62
  @byzerllm.prompt()
63
- def coding_prompt(messages: List[Dict[str, Any]], request: CodingCommandRequest):
64
- '''
65
- 下面是我们已经产生的一个消息列表,其中 USER_RESPONSE 表示用户的输入,其他都是你的输出:
66
- <messages>
63
+ def coding_prompt(messages: List[Dict[str, Any]], query: str):
64
+ '''
65
+ 【历史对话】按时间顺序排列,从旧到新:
67
66
  {% for message in messages %}
68
67
  <message>
69
- <type>{{ message.type }}</type>
70
- <content>{{ message.content }}</content>
68
+ {% if message.type == "USER" or message.type == "USER_RESPONSE" or message.metadata.path == "/agent/edit/tool/result" %}【用户】{% else %}【助手】{% endif %}
69
+ <content>
70
+ {{ message.content }}
71
+ </content>
71
72
  </message>
72
73
  {% endfor %}
73
- </messages>
74
74
 
75
- 下面是用户的最新需求:
76
- <request>
77
- {{ request.command }}
78
- </request>
75
+ 【当前问题】用户的最新需求如下:
76
+ <current_query>
77
+ {{ query }}
78
+ </current_query>
79
79
  '''
80
+ # 使用消息解析器处理消息
81
+ from auto_coder_web.agentic_message_parser import parse_messages
82
+ processed_messages = parse_messages(messages)
83
+
84
+ return {
85
+ "messages": processed_messages,
86
+ "query": query
87
+ }
80
88
 
81
89
  @router.post("/api/coding-command")
82
90
  async def coding_command(request: CodingCommandRequest, project_path: str = Depends(get_project_path)):
@@ -113,14 +121,9 @@ async def coding_command(request: CodingCommandRequest, project_path: str = Depe
113
121
  chat_data = get_chat_list_sync(project_path, current_session_name)
114
122
 
115
123
  # 从聊天历史中提取消息
116
- for msg in chat_data.get("messages", []):
117
- # 只保留用户和中间结果信息
118
- if msg.get("type","") not in ["USER_RESPONSE","RESULT"]:
119
- continue
120
-
124
+ for msg in chat_data.get("messages", []):
121
125
  if msg.get("contentType","") in ["token_stat"]:
122
- continue
123
-
126
+ continue
124
127
  messages.append(msg)
125
128
  except Exception as e:
126
129
  logger.error(f"Error reading chat history: {str(e)}")
auto_coder_web/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.102"
1
+ __version__ = "0.1.104"