mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-04 20:46:29 +03:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -444,9 +444,11 @@ void UISceneNode::setThreadPool( const std::shared_ptr<ThreadPool>& threadPool )
|
||||
}
|
||||
|
||||
static std::string getErrorContext( size_t offset, std::string_view content ) {
|
||||
static constexpr auto CONTEXT_LENGTH = 40;
|
||||
std::size_t left = std::max( 0ul, offset >= CONTEXT_LENGTH ? offset - CONTEXT_LENGTH : 0ul );
|
||||
std::size_t right = std::min( content.size(), offset + 40 );
|
||||
static constexpr std::size_t CONTEXT_LENGTH = 40;
|
||||
std::size_t minVal = offset >= CONTEXT_LENGTH ? offset - CONTEXT_LENGTH : 0;
|
||||
std::size_t maxVal = offset + CONTEXT_LENGTH;
|
||||
std::size_t left = std::max( static_cast<std::size_t>( 0ul ), minVal );
|
||||
std::size_t right = std::min( content.size(), maxVal );
|
||||
return std::string{ content.substr( left, right - left ) };
|
||||
}
|
||||
|
||||
|
||||
@@ -2651,12 +2651,15 @@ void LLMChatUI::addPermissionUI( const acp::RequestPermissionRequest& req,
|
||||
UIWidget* LLMChatUI::addMarkdownBubble( const std::string& layout, const std::string& markdown ) {
|
||||
find( "chat_presentation" )->setVisible( false );
|
||||
UIWidget* chat = mChatsList->getUISceneNode()->loadLayoutFromString( layout, mChatsList );
|
||||
if ( chat )
|
||||
if ( chat && !markdown.empty() )
|
||||
chat->asType<UIMarkdownView>()->loadFromString( markdown );
|
||||
return chat;
|
||||
}
|
||||
|
||||
void LLMChatUI::addPlanBubble( const std::string& markdown ) {
|
||||
if ( markdown.empty() )
|
||||
return;
|
||||
|
||||
runOnMainThread( [this, markdown] {
|
||||
removeWaitingBubble();
|
||||
|
||||
@@ -2810,7 +2813,10 @@ void LLMChatUI::addToolCallUpdate( const nlohmann::json& msg ) {
|
||||
}
|
||||
|
||||
void LLMChatUI::updateThinkingBubble( const std::string& chunk ) {
|
||||
runOnMainThread( [this, chunk] {
|
||||
if ( chunk.empty() )
|
||||
return;
|
||||
|
||||
runOnMainThread( [this, chunk = std::move( chunk )] {
|
||||
removeWaitingBubble();
|
||||
|
||||
UIWidget* bubble = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user