mirror of
https://github.com/katanemo/plano.git
synced 2026-07-11 16:12:13 +02:00
fix ordering of messages
This commit is contained in:
parent
6cfd630a05
commit
da8047e40c
4 changed files with 8 additions and 3 deletions
|
|
@ -349,6 +349,9 @@ async fn handle_agent_chat(
|
||||||
response_text.len()
|
response_text.len()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// remove last message and add new one at the end
|
||||||
|
let last_message = current_messages.pop().unwrap();
|
||||||
|
|
||||||
// Create a new message with the agent's response as assistant message
|
// Create a new message with the agent's response as assistant message
|
||||||
// and add it to the conversation history
|
// and add it to the conversation history
|
||||||
current_messages.push(OpenAIMessage {
|
current_messages.push(OpenAIMessage {
|
||||||
|
|
@ -359,6 +362,8 @@ async fn handle_agent_chat(
|
||||||
tool_call_id: None,
|
tool_call_id: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
current_messages.push(last_message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should never be reached since we return in the last agent iteration
|
// This should never be reached since we return in the last agent iteration
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ Use this data to answer the user's currency exchange query.
|
||||||
|
|
||||||
response_messages = [
|
response_messages = [
|
||||||
{"role": "system", "content": SYSTEM_PROMPT},
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
{"role": "system", "content": currency_context},
|
{"role": "assistant", "content": currency_context},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add conversation history
|
# Add conversation history
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ Example: "I'd be happy to help you find flights! Could you please tell me both t
|
||||||
|
|
||||||
response_messages = [
|
response_messages = [
|
||||||
{"role": "system", "content": SYSTEM_PROMPT},
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
{"role": "system", "content": flight_context},
|
{"role": "assistant", "content": flight_context},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add conversation history
|
# Add conversation history
|
||||||
|
|
|
||||||
|
|
@ -508,7 +508,7 @@ Use this data to answer the user's weather query.
|
||||||
|
|
||||||
response_messages = [
|
response_messages = [
|
||||||
{"role": "system", "content": SYSTEM_PROMPT},
|
{"role": "system", "content": SYSTEM_PROMPT},
|
||||||
{"role": "system", "content": weather_context},
|
{"role": "assistant", "content": weather_context},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add conversation history
|
# Add conversation history
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue