diff --git a/src/routers/deep_agent_chat.py b/src/routers/deep_agent_chat.py
index 3aa139c..e0ca704 100755
--- a/src/routers/deep_agent_chat.py
+++ b/src/routers/deep_agent_chat.py
@@ -147,13 +147,16 @@ async def chat_stream(request: DeepAgentChatRequest):
"Please strictly follow the above settings in subsequent conversations。"
)
initial_messages.append(SystemMessage(content=system_prompt))
- design_backend = f"""
-
- Category: {cp.type or 'unspecified'}
- region: {cp.region or 'unspecified'}
- style: {cp.style or 'unspecified'}
-
- """
+
+ if cp.type or cp.region or cp.style:
+ design_backend = ""
+ if cp.type:
+ design_backend += f"Category: {cp.type}"
+ if cp.region:
+ design_backend += f"region: {cp.region}"
+ if cp.style:
+ design_backend += f"style: {cp.style}"
+ design_backend += ""
# 6. 分支处理
if is_branching:
@@ -372,42 +375,52 @@ async def get_chat_history(thread_id: str):
"""
### 获取项目设计历史记录
- 此接口用于拉取指定 `thread_id` 下的所有历史状态快照。它是实现 **“版本回溯”** 和 **“方案对比”** 的核心数据来源。
+ 此接口用于拉取指定
+ `thread_id`
+ 下的所有历史状态快照。它是实现 **“版本回溯” ** 和 **“方案对比” ** 的核心数据来源。
#### 1. 功能说明
- * **快照列表**: 返回该项目从启动至今的所有关键节点(Checkpoints)。
- * **版本定位**: 每个历史点都包含一个唯一的 `checkpoint_id`。
- * **数据回溯**: 客户端获取此列表后,可以引导用户选择任意一个版本,并将其 `checkpoint_id` 传回 `/chat/stream` 接口以开启新的设计分支。
+ * ** 快照列表 **: 返回该项目从启动至今的所有关键节点(Checkpoints)。
+ * ** 版本定位 **: 每个历史点都包含一个唯一的
+ `checkpoint_id`。
+ * ** 数据回溯 **: 客户端获取此列表后,可以引导用户选择任意一个版本,并将其
+ `checkpoint_id`
+ 传回
+ ` / chat / stream
+ ` 接口以开启新的设计分支。
#### 2. 路径参数
- * `thread_id`: 设计项目的唯一标识符(由 `/chat/stream` 首次调用时生成或指定)。
+ *`thread_id`: 设计项目的唯一标识符(由
+ ` / chat / stream
+ ` 首次调用时生成或指定)。
#### 3. 返回字段定义
- * `thread_id`: 当前查询的项目ID。
- * `history`: 历史记录数组,包含:
- - `checkpoint_id`: 必填,回溯时使用的关键凭证。
- - `last_message`: 该阶段的最后一条消息摘要(方便前端预览)。
- - `node`: 产生该快照的节点名称(如 Designer, Visualizer)。
- - `timestamp`: 逻辑步骤序号。
+ *`thread_id`: 当前查询的项目ID。
+ *`history`: 历史记录数组,包含:
+ - `checkpoint_id`: 必填,回溯时使用的关键凭证。
+ - `last_message`: 该阶段的最后一条消息摘要(方便前端预览)。
+ - `node`: 产生该快照的节点名称(如
+ Designer, Visualizer)。
+ - `timestamp`: 逻辑步骤序号。
#### 4. 响应示例
```json
{
- "thread_id": "proj_001",
- "history": [
- {
- "checkpoint_id": "d82f3a12",
- "last_message": "我想设计一款北欧风书架",
- "node": "Supervisor",
- "timestamp": 1
- },
- {
- "checkpoint_id": "f4k92m1a",
- "last_message": "建议使用浅色橡木材质,增加简约感...",
- "node": "Designer",
- "timestamp": 2
- }
- ]
+ "thread_id": "proj_001",
+ "history": [
+ {
+ "checkpoint_id": "d82f3a12",
+ "last_message": "我想设计一款北欧风书架",
+ "node": "Supervisor",
+ "timestamp": 1
+ },
+ {
+ "checkpoint_id": "f4k92m1a",
+ "last_message": "建议使用浅色橡木材质,增加简约感...",
+ "node": "Designer",
+ "timestamp": 2
+ }
+ ]
}
```
"""