(prompt: &str)
| 171 | } |
| 172 | |
| 173 | pub(super) fn detect_language_hint(prompt: &str) -> Option<String> { |
| 174 | if prompt |
| 175 | .chars() |
| 176 | .any(|c| ('\u{4e00}'..='\u{9fff}').contains(&c)) |
| 177 | { |
| 178 | return Some("zh".to_string()); |
| 179 | } |
| 180 | if prompt |
| 181 | .chars() |
| 182 | .any(|c| ('\u{3040}'..='\u{309f}').contains(&c) || ('\u{30a0}'..='\u{30ff}').contains(&c)) |
| 183 | { |
| 184 | return Some("ja".to_string()); |
| 185 | } |
| 186 | if prompt |
| 187 | .chars() |
| 188 | .any(|c| ('\u{ac00}'..='\u{d7af}').contains(&c)) |
| 189 | { |
| 190 | return Some("ko".to_string()); |
| 191 | } |
| 192 | if prompt |
| 193 | .chars() |
| 194 | .any(|c| ('\u{0600}'..='\u{06ff}').contains(&c)) |
| 195 | { |
| 196 | return Some("ar".to_string()); |
| 197 | } |
| 198 | if prompt |
| 199 | .chars() |
| 200 | .any(|c| ('\u{0400}'..='\u{04ff}').contains(&c)) |
| 201 | { |
| 202 | return Some("ru".to_string()); |
| 203 | } |
| 204 | None |
| 205 | } |
| 206 | |
| 207 | fn extract_target_name_from_prompt(prompt: &str, _patterns: &[&str]) -> String { |
| 208 | if let Some(start) = prompt.find('"') { |
no test coverage detected