1010
1111use crate :: agent:: commands:: { TokenUsage , SLASH_COMMANDS } ;
1212use crate :: agent:: { AgentError , AgentResult , ProviderType } ;
13- use crate :: agent:: ui:: { SlashCommandAutocomplete , ansi} ;
13+ use crate :: agent:: ui:: ansi;
1414use crate :: config:: { load_agent_config, save_agent_config} ;
1515use colored:: Colorize ;
16- use inquire:: Text ;
1716use std:: io:: { self , Write } ;
1817use std:: path:: Path ;
1918
@@ -407,17 +406,13 @@ impl ChatSession {
407406 input. trim ( ) . starts_with ( '/' )
408407 }
409408
410- /// Read user input with prompt - with interactive slash command support
411- /// Uses `inquire` library for proper terminal handling and autocomplete
409+ /// Read user input with prompt - with interactive file picker support
410+ /// Uses custom terminal handling for @ file references and / commands
412411 pub fn read_input ( & self ) -> io:: Result < String > {
413- // Use inquire::Text with custom autocomplete for slash commands
414- let input = Text :: new ( "You:" )
415- . with_autocomplete ( SlashCommandAutocomplete :: new ( ) )
416- . with_help_message ( "Type / for commands, or ask a question" )
417- . prompt ( ) ;
412+ use crate :: agent:: ui:: input:: { read_input_with_file_picker, InputResult } ;
418413
419- match input {
420- Ok ( text) => {
414+ match read_input_with_file_picker ( "You:" , & self . project_path ) {
415+ InputResult :: Submit ( text) => {
421416 let trimmed = text. trim ( ) ;
422417 // Handle case where full suggestion was submitted (e.g., "/model Description")
423418 // Extract just the command if it looks like a suggestion format
@@ -429,9 +424,8 @@ impl ChatSession {
429424 }
430425 Ok ( trimmed. to_string ( ) )
431426 }
432- Err ( inquire:: InquireError :: OperationCanceled ) => Ok ( "exit" . to_string ( ) ) ,
433- Err ( inquire:: InquireError :: OperationInterrupted ) => Ok ( "exit" . to_string ( ) ) ,
434- Err ( e) => Err ( io:: Error :: new ( io:: ErrorKind :: Other , e. to_string ( ) ) ) ,
427+ InputResult :: Cancel => Ok ( "" . to_string ( ) ) ,
428+ InputResult :: Exit => Ok ( "exit" . to_string ( ) ) ,
435429 }
436430 }
437431}
0 commit comments