Checks if an input may be referencing a file and should not be handled as a typical slash command. If true, then return [Option::Some ], otherwise [Option::None].
(input: &str)
| 3945 | /// Checks if an input may be referencing a file and should not be handled as a typical slash |
| 3946 | /// command. If true, then return [Option::Some<ChatState>], otherwise [Option::None]. |
| 3947 | fn does_input_reference_file(input: &str) -> Option<ChatState> { |
| 3948 | let after_slash = input.strip_prefix("/")?; |
| 3949 | |
| 3950 | if let Some(first) = shlex::split(after_slash).unwrap_or_default().first() { |
| 3951 | let looks_like_path = |
| 3952 | first.contains(MAIN_SEPARATOR) || first.contains('/') || first.contains('\\') || first.contains('.'); |
| 3953 | |
| 3954 | if looks_like_path { |
| 3955 | return Some(ChatState::HandleInput { |
| 3956 | input: after_slash.to_string(), |
| 3957 | }); |
| 3958 | } |
| 3959 | } |
| 3960 | |
| 3961 | None |
| 3962 | } |
| 3963 | |
| 3964 | // Helper method to save the agent config to file |
| 3965 | async fn save_agent_config(os: &mut Os, config: &Agent, agent_name: &str, is_global: bool) -> Result<(), ChatError> { |