MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / cursor_model_string

Function cursor_model_string

src/sessions/cursor.rs:943–967  ·  view source on GitHub ↗
(value: &Value)

Source from the content-addressed store, hash-verified

941}
942
943fn 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
969fn cursor_record_message_model(record: &Value, message: &Value) -> Option<String> {
970 cursor_model_string(record).or_else(|| cursor_model_string(message))

Callers 4

event_messageFunction · 0.85
event_dispatch_messagesFunction · 0.85
cursor_dispatch_modelFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected