Fix cursor focus and selection in input box, add AWS env var warning box, and remove AWS Bedrock login banner
This commit is contained in:
@@ -66,10 +66,10 @@ fn get_binary_confidence_color(is_correct: bool, is_low_confidence: bool) -> Str
|
||||
"\x1b[31m".to_string() // Red for incorrect
|
||||
}
|
||||
}
|
||||
use galaxy_completer::ParsedTokensSnapshot;
|
||||
use galaxy_completer::util::parse_current_commands_and_tokens;
|
||||
#[cfg(feature = "onnx")]
|
||||
use input_classifier::{OnnxClassifier, OnnxModel};
|
||||
use warp_completer::ParsedTokensSnapshot;
|
||||
use warp_completer::util::parse_current_commands_and_tokens;
|
||||
#[cfg(feature = "onnx")]
|
||||
fn default_onnx_model() -> Option<OnnxModel> {
|
||||
cfg_if::cfg_if! {
|
||||
|
||||
@@ -64,8 +64,7 @@ impl InputClassifier for HeuristicClassifier {
|
||||
);
|
||||
}
|
||||
|
||||
let result = self
|
||||
.classify_input(input, context)
|
||||
self.classify_input(input, context)
|
||||
.await
|
||||
.map(|result| InputClassificationResult::new(result.to_input_type(), result.source))
|
||||
.unwrap_or(InputClassificationResult::new(
|
||||
@@ -115,15 +114,7 @@ async fn natural_language_detection_heuristic(
|
||||
include_last_token: bool,
|
||||
) -> ClassificationResult {
|
||||
let source = InputClassifierDecisionSource::InputClassifierFallbackHeuristic;
|
||||
let word_tokens_count = word_tokens.len();
|
||||
|
||||
let min_token_length = if matches!(current_input_type, InputType::AI) {
|
||||
MINIMUM_COMMAND_DETECTION_TOKEN_LENGTH
|
||||
} else {
|
||||
MINIMUM_NATURAL_LANGUAGE_DETECTION_TOKEN_LENGTH
|
||||
};
|
||||
|
||||
if min_token_length > word_tokens_count as u8 {
|
||||
if input.buffer_text.len() < MINIMUM_CLASSIFICATION_CHAR_LENGTH {
|
||||
return ClassificationResult::pure_shell(source);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,12 @@ fn test_input_detection() {
|
||||
detected_input_type(&classifier, token, &context).await,
|
||||
InputType::AI
|
||||
);
|
||||
// Test case for "Can you review this code base"
|
||||
let token = mock_parsed_input_token("Can you review this code base".to_string()).await;
|
||||
assert_eq!(
|
||||
detected_input_type(&classifier, token, &context).await,
|
||||
InputType::AI
|
||||
);
|
||||
// Short queries with contractions should be parsed as AI input.
|
||||
let mut token = mock_parsed_input_token("What's the reason".to_string()).await;
|
||||
token.parsed_tokens[0].token_description = None;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
use smol_str::SmolStr;
|
||||
use galaxy_completer::completer::{GeneratorContext, PathCompletionContext};
|
||||
use galaxy_completer::signatures::CommandRegistry;
|
||||
use smol_str::SmolStr;
|
||||
|
||||
/// An implementation of `CompletionContext` for testing purposes.
|
||||
pub struct CompletionContext {
|
||||
|
||||
@@ -59,14 +59,14 @@ pub fn is_prefix_of_natural_language_word(input: &str) -> bool {
|
||||
/// nld_heuristic_v2: rm check_if_token_has_shell_syntax and pin threshold to be 1 for all input
|
||||
pub async fn is_likely_shell_command(
|
||||
input: &ParsedTokensSnapshot,
|
||||
_word_tokens_count: usize,
|
||||
word_tokens_count: usize,
|
||||
) -> bool {
|
||||
const YIELD_BATCH_SIZE: usize = 5;
|
||||
let use_nld_heuristic_v2 = cfg!(feature = "nld_heuristic_v2");
|
||||
|
||||
let mut likely_command_token_count = 0;
|
||||
let total_token_count = input.parsed_tokens.len();
|
||||
let mut is_first_token_command = false;
|
||||
let is_first_token_command = is_installed_binary(input);
|
||||
log::debug!(
|
||||
"is_likely_shell_command start: use_nld_heuristic_v2={use_nld_heuristic_v2}, total_token_count={total_token_count}, word_tokens_count={word_tokens_count}"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user