(value: &Value)
| 941 | } |
| 942 | |
| 943 | fn cursor_model_string(value: &Value) -> Option<String> { |
| 944 | [ |
| 945 | "model", |
| 946 | "model_id", |
| 947 | "modelId", |
| 948 | "model_name", |
| 949 | "modelName", |
| 950 | "model_slug", |
| 951 | "modelSlug", |
| 952 | "model_display_name", |
| 953 | "modelDisplayName", |
| 954 | "display_model", |
| 955 | "displayModel", |
| 956 | "display_model_name", |
| 957 | "displayModelName", |
| 958 | ] |
| 959 | .into_iter() |
| 960 | .find_map(|key| { |
| 961 | value |
| 962 | .get(key) |
| 963 | .and_then(Value::as_str) |
| 964 | .filter(|model| !model.trim().is_empty()) |
| 965 | .map(str::to_string) |
| 966 | }) |
| 967 | } |
| 968 | |
| 969 | fn cursor_record_message_model(record: &Value, message: &Value) -> Option<String> { |
| 970 | cursor_model_string(record).or_else(|| cursor_model_string(message)) |
no test coverage detected