MCPcopy Create free account
hub / github.com/SpartanJ/eepp / doAgentRequest

Method doAgentRequest

src/tools/ecode/plugins/aiassistant/chatui.cpp:2003–2062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2001}
2002
2003void LLMChatUI::doAgentRequest() {
2004 mToolCallBubbles.clear();
2005 mTerminalBubbles.clear();
2006 if ( !mAgentSession ) {
2007 auto it = mAgents.find( mCurAgent );
2008 if ( it == mAgents.end() ) {
2009 showMsg( "Agent not configured." );
2010 return;
2011 }
2012
2013 mChatRun->setVisible( false )->setEnabled( false );
2014 mChatStop->setVisible( true )->setEnabled( true );
2015
2016 setupAgentSession();
2017
2018 UIWidget* chat = addChatUI( LLMChat::Role::Assistant );
2019 chat->addClass( "llm_waiting" );
2020 toggleEnableChats( false );
2021 auto* editor = chat->findByClass<UICodeEditor>( "data_ui" );
2022 editor->setEnabled( false );
2023 auto* thinking = editor->findByClass<UIImage>( "thinking" );
2024 auto thinkingID = String::hash( String::format( "thinking-%p", thinking ) );
2025 thinking->setVisible( true );
2026 thinking->setPosition( { PixelDensity::dpToPx( 8 ), PixelDensity::dpToPx( 3 ) } );
2027 thinking->setInterval( [thinking] { thinking->rotate( 360 / 32 ); }, Seconds( 0.125 ),
2028 thinkingID );
2029
2030 mAgentSession->start( [this]( bool ready ) {
2031 runOnMainThread( [this, ready]() {
2032 if ( ready ) {
2033 sendAgentPrompt();
2034 } else {
2035 mChatStop->setVisible( false )->setEnabled( false );
2036 mChatRun->setVisible( true )->setEnabled( true );
2037 toggleEnableChats( true );
2038 showMsg( i18n( "failed_to_start_agent", "Failed to start agent process." ) );
2039 mAgentSession.reset();
2040 }
2041 } );
2042 } );
2043 } else {
2044 // Existing session, just send the prompt
2045 mChatRun->setVisible( false )->setEnabled( false );
2046 mChatStop->setVisible( true )->setEnabled( true );
2047
2048 UIWidget* chat = addChatUI( LLMChat::Role::Assistant );
2049 chat->addClass( "llm_waiting" );
2050 toggleEnableChats( false );
2051 auto* editor = chat->findByClass<UICodeEditor>( "data_ui" );
2052 editor->setEnabled( false );
2053 auto* thinking = editor->findByClass<UIImage>( "thinking" );
2054 auto thinkingID = String::hash( String::format( "thinking-%p", thinking ) );
2055 thinking->setVisible( true );
2056 thinking->setPosition( { PixelDensity::dpToPx( 8 ), PixelDensity::dpToPx( 3 ) } );
2057 thinking->setInterval( [thinking] { thinking->rotate( 360 / 32 ); }, Seconds( 0.125 ),
2058 thinkingID );
2059
2060 sendAgentPrompt();

Callers

nothing calls this directly

Calls 14

hashFunction · 0.85
formatFunction · 0.85
SecondsFunction · 0.85
addClassMethod · 0.80
setIntervalMethod · 0.80
clearMethod · 0.45
findMethod · 0.45
endMethod · 0.45
setEnabledMethod · 0.45
setVisibleMethod · 0.45
setPositionMethod · 0.45
rotateMethod · 0.45

Tested by

no test coverage detected