@@ -86,8 +86,8 @@ std::shared_ptr<Channel> CreateChannel(const std::string& host) {
8686}
8787
8888void PrintUsage () {
89- std::cerr << " Usage: ./run_assistant "
90- << " [ --audio_input [<" << kALSAAudioInput << " >|<audio_file>] OR --text_input ] "
89+ std::cerr << " Usage: ./run_assistant_audio "
90+ << " --audio_input [<" << kALSAAudioInput << " >|<audio_file>] "
9191 << " --credentials_file <credentials_file> "
9292 << " [--credentials_type <" << kCredentialsTypeUserAccount << " >] "
9393 << " [--api_endpoint <API endpoint>] "
@@ -101,7 +101,6 @@ bool GetCommandLineFlags(
101101 std::string* locale) {
102102 const struct option long_options[] = {
103103 {" audio_input" , required_argument, nullptr , ' a' },
104- {" text_input" , no_argument, nullptr , ' t' },
105104 {" credentials_file" , required_argument, nullptr , ' f' },
106105 {" credentials_type" , required_argument, nullptr , ' c' },
107106 {" api_endpoint" , required_argument, nullptr , ' e' },
@@ -113,17 +112,14 @@ bool GetCommandLineFlags(
113112 while (true ) {
114113 int option_index;
115114 int option_char =
116- getopt_long (argc, argv, " a:t: f:c:e:l:v" , long_options, &option_index);
115+ getopt_long (argc, argv, " a:f:c:e:l:v" , long_options, &option_index);
117116 if (option_char == -1 ) {
118117 break ;
119118 }
120119 switch (option_char) {
121120 case ' a' :
122121 *audio_input = optarg;
123122 break ;
124- case ' t' :
125- use_text = true ;
126- break ;
127123 case ' f' :
128124 *credentials_file_path = optarg;
129125 break ;
@@ -154,7 +150,7 @@ bool GetCommandLineFlags(
154150}
155151
156152int main (int argc, char ** argv) {
157- std::string audio_input_source, text_input_source, credentials_file_path, credentials_type,
153+ std::string audio_input_source, credentials_file_path, credentials_type,
158154 api_endpoint, locale;
159155 // Initialize gRPC and DNS resolvers
160156 // https://github.com/grpc/grpc/issues/11366#issuecomment-328595941
@@ -169,19 +165,6 @@ int main(int argc, char** argv) {
169165 }
170166
171167 while (true ) {
172- if (use_text) {
173- // Take in any text
174- std::clog << " : " << std::endl;
175- std::getline (std::cin, text_input_source);
176- // Take in any text
177- if (text_input_source.empty ()) {
178- // Input is empty. This can happen if the user entered
179- // no text or if the input source is through a terminal
180- // pipe. In either case, this will be interpreted as
181- // an exit condition.
182- return 0 ;
183- }
184- }
185168 // Create an AssistRequest
186169 AssistRequest request;
187170 auto * assist_config = request.mutable_config ();
@@ -210,10 +193,8 @@ int main(int argc, char** argv) {
210193 assist_config->mutable_audio_in_config ()->set_encoding (
211194 AudioInConfig::LINEAR16);
212195 assist_config->mutable_audio_in_config ()->set_sample_rate_hertz (16000 );
213- } else if (!text_input_source.empty ()) {
214- assist_config->set_text_query (text_input_source);
215196 } else {
216- std::cerr << " requires either --audio_input or --text_input " << std::endl;
197+ std::cerr << " requires --audio_input" << std::endl;
217198 return -1 ;
218199 }
219200
@@ -344,7 +325,7 @@ int main(int argc, char** argv) {
344325 return -1 ;
345326 }
346327
347- if (!use_text && audio_input_source != kALSAAudioInput ) {
328+ if (audio_input_source != kALSAAudioInput ) {
348329 // A filepath was used as the audio input to this program
349330 // If this is the case, then we can stop the program after
350331 // one turn.
0 commit comments