mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-06 08:55:30 +00:00
Make the tool reply limit easier to understand.
This commit is contained in:
@@ -399,18 +399,34 @@ void TracyLlm::Draw( WindowConstraints& constraints )
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(bytes)" );
|
||||
constraints.MarkMinWidth();
|
||||
if( !s_config.llmLimitToolReplySize ) ImGui::EndDisabled();
|
||||
if( !models.empty() )
|
||||
ImGui::SameLine();
|
||||
TextDisabledUnformatted( "Effective: " );
|
||||
ImGui::SameLine();
|
||||
bool known = false;
|
||||
if( s_config.llmLimitToolReplySize )
|
||||
{
|
||||
known = true;
|
||||
TextDisabledUnformatted( MemSizeToString( s_config.llmMaxToolReplySizeValue ) );
|
||||
}
|
||||
else if( !models.empty() )
|
||||
{
|
||||
const auto ctxSize = models[m_modelIdx].contextSize;
|
||||
const int ctxBasedLimit = TracyLlmTools::CalcCtxBasedLimit( ctxSize );
|
||||
if( ctxBasedLimit > 0 )
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(ctx: %d bytes)", ctxBasedLimit);
|
||||
known = true;
|
||||
TextDisabledUnformatted( MemSizeToString( ctxBasedLimit ) );
|
||||
}
|
||||
}
|
||||
if( !known )
|
||||
{
|
||||
TextDisabledUnformatted( MemSizeToString( DefaultToolReplyLimit ) );
|
||||
ImGui::SameLine();
|
||||
TextColoredUnformatted( 0xFF00FFFF, ICON_FA_TRIANGLE_EXCLAMATION );
|
||||
TooltipIfHovered( "Will change when model context size is known" );
|
||||
}
|
||||
constraints.MarkMinWidth();
|
||||
|
||||
char buf[1024];
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
constexpr int DefaultToolReplyLimit = 48 * 1024;
|
||||
|
||||
class TracyLlmApi;
|
||||
class TracyLlmChat;
|
||||
class TracyLlmTools;
|
||||
|
||||
@@ -376,11 +376,9 @@ int TracyLlmTools::CalcCtxBasedLimit( int ctxSize )
|
||||
|
||||
int TracyLlmTools::CalcMaxSize() const
|
||||
{
|
||||
constexpr int defaultLimit = 48*1024;
|
||||
const int limit = s_config.llmLimitToolReplySize ? s_config.llmMaxToolReplySizeValue : defaultLimit;
|
||||
if( s_config.llmLimitToolReplySize ) return s_config.llmMaxToolReplySizeValue;
|
||||
const int ctxLimit = CalcCtxBasedLimit( m_ctxSize );
|
||||
if( ctxLimit <= 0 ) return limit;
|
||||
return std::min( ctxLimit, limit );
|
||||
return ctxLimit > 0 ? ctxLimit : DefaultToolReplyLimit;
|
||||
}
|
||||
|
||||
std::string TracyLlmTools::TrimString( std::string&& str ) const
|
||||
|
||||
Reference in New Issue
Block a user