修改guideline_prompt
This commit is contained in:
parent
cf33da310d
commit
25f8f7c98f
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
### 3. 计划阶段 (Planning)
|
### 3. 计划阶段 (Planning)
|
||||||
- **步骤制定**: 详细的执行步骤,步骤数量根据实际需求调整,每个步骤应具体可执行
|
- **步骤制定**: 详细的执行步骤,步骤数量根据实际需求调整,每个步骤应具体可执行
|
||||||
- **应急预案**: 准备应对可能的障碍
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -65,5 +65,3 @@
|
|||||||
### ⚡ 计划阶段
|
### ⚡ 计划阶段
|
||||||
**执行步骤**:
|
**执行步骤**:
|
||||||
[按1,2,3...n顺序列出执行步骤]
|
[按1,2,3...n顺序列出执行步骤]
|
||||||
**应急预案**:
|
|
||||||
[按1,2,3...n列出可能障碍的应对方式]
|
|
||||||
|
|||||||
@ -284,19 +284,24 @@ def format_messages_to_chat_history(messages: List[Dict[str, str]]) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: 格式化的聊天记录
|
str: 格式化的聊天记录
|
||||||
"""
|
"""
|
||||||
# 只取最后的6句消息
|
# 只取最后的15句消息
|
||||||
chat_history = []
|
chat_history = []
|
||||||
|
|
||||||
for message in messages:
|
for message in messages:
|
||||||
role = message.get('role', '')
|
role = message.get('role', '')
|
||||||
content = message.get('content', '')
|
content = message.get('content', '')
|
||||||
if len(content) > 0:
|
if role == 'user':
|
||||||
if role == 'user':
|
chat_history.append(f"user: {content}")
|
||||||
chat_history.append(f"user: {content}")
|
elif role == FUNCTION:
|
||||||
elif role == 'assistant':
|
chat_history.append(f"function_response: {content}")
|
||||||
|
elif role == ASSISTANT:
|
||||||
|
if len(content) >0:
|
||||||
chat_history.append(f"assistant: {content}")
|
chat_history.append(f"assistant: {content}")
|
||||||
|
if message.get('function_call'):
|
||||||
|
chat_history.append(f"function_call: {message.get('function_call').get('name')} ")
|
||||||
|
chat_history.append(f"{message.get('function_call').get('arguments')}")
|
||||||
|
|
||||||
recent_chat_history = chat_history[-6:] if len(chat_history) > 6 else chat_history
|
recent_chat_history = chat_history[-15:] if len(chat_history) > 15 else chat_history
|
||||||
|
print(f"recent_chat_history:{recent_chat_history}")
|
||||||
return "\n".join(recent_chat_history)
|
return "\n".join(recent_chat_history)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user