Inject current time into each user message.

This is not removed later on, mainly to enable caching of previous replies
(changing any earlier message would require processing everything that's
later), but also to give the LLM a sense of passing time.
This commit is contained in:
Bartosz Taudul
2025-12-28 18:16:12 +01:00
parent 9183aef645
commit 79ee17d2f6

View File

@@ -781,11 +781,10 @@ void TracyLlm::SendMessage( std::unique_lock<std::mutex>& lock )
bool res;
try
{
m_chat.back()["content"].get_ref<std::string&>().append( "\n\n<SYSTEM_PROMPT>\nThe current time is: " + m_tools->GetCurrentTime() + "\n</SYSTEM_PROMPT>\n" );
auto chat = m_chat;
AddMessageBlocking( "", "assistant", lock );
chat.front()["content"].get_ref<std::string&>().append( "\n\nThe current time is: " + m_tools->GetCurrentTime() + "\n" );
nlohmann::json req;
req["model"] = m_api->GetModels()[m_modelIdx].name;
req["messages"] = std::move( chat );