mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-23 17:20:48 +00:00
Adapt context management to tool role usage.
This commit is contained in:
@@ -764,14 +764,10 @@ void TracyLlm::ManageContext( std::unique_lock<std::mutex>& lock )
|
||||
std::vector<std::pair<size_t, size_t>> toolOutputs;
|
||||
for( auto& msg : m_chat )
|
||||
{
|
||||
if( msg["role"].get_ref<const std::string&>() == "user" )
|
||||
if( msg["role"].get_ref<const std::string&>() == "tool" )
|
||||
{
|
||||
auto& content = msg["content"];
|
||||
const auto& str = content.get_ref<const std::string&>();
|
||||
if( str.starts_with( "<tool_output>\n" ) )
|
||||
{
|
||||
toolOutputs.emplace_back( str.size(), idx );
|
||||
}
|
||||
auto& str = msg["content"].get_ref<const std::string&>();
|
||||
toolOutputs.emplace_back( str.size(), idx );
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace tracy
|
||||
class TracyLlmChat
|
||||
{
|
||||
public:
|
||||
static constexpr const char* ForgetMsg = "<tool_output>\n...";
|
||||
static constexpr const char* ForgetMsg = "...";
|
||||
|
||||
enum class TurnRole
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user