|
var dagcomponentfuncs = window.dashAgGridComponentFunctions = window.dashAgGridComponentFunctions || {}; |
|
|
|
window.gridOriginalData = null; |
|
|
|
|
|
window.pinnedModelIds = new Set(JSON.parse(localStorage.getItem('pinnedModelIds') || '[]')); |
|
|
|
|
|
dagcomponentfuncs.ModelLink = function(props) { |
|
if (!props.data.Model_Link) { |
|
return props.value; |
|
} |
|
return React.createElement( |
|
'a', |
|
{ |
|
href: props.data.Model_Link, |
|
target: '_blank', |
|
style: { |
|
color: '#007bff', |
|
textDecoration: 'none' |
|
} |
|
}, |
|
props.value |
|
); |
|
}; |
|
|
|
if (!localStorage.getItem('pinnedModelIds')) { |
|
localStorage.setItem('pinnedModelIds', '[]'); |
|
} |
|
|
|
dagcomponentfuncs.PinRenderer = function(props) { |
|
return React.createElement( |
|
'div', |
|
{ |
|
onClick: function() { |
|
const api = props.api; |
|
const modelId = props.data.Model_Display; |
|
const isPinned = props.data.pinned || false; |
|
|
|
if (isPinned) { |
|
|
|
const currentPinned = api.getGridOption('pinnedTopRowData') || []; |
|
const newPinnedRows = currentPinned.filter(row => row.Model_Display !== modelId); |
|
api.setGridOption('pinnedTopRowData', newPinnedRows); |
|
} else { |
|
|
|
const currentPinned = api.getGridOption('pinnedTopRowData') || []; |
|
const pinnedRow = {...props.data, pinned: true}; |
|
api.setGridOption('pinnedTopRowData', [...currentPinned, pinnedRow]); |
|
} |
|
}, |
|
style: { |
|
cursor: 'pointer', |
|
textAlign: 'center', |
|
fontSize: '16px' |
|
} |
|
}, |
|
props.data.pinned ? 'π' : 'β' |
|
); |
|
}; |
|
|
|
dagcomponentfuncs.TypeRenderer = function(props) { |
|
const typeMap = { |
|
'Base': ['B', '#71de5f'], |
|
'Finetune': ['F', '#f6b10b'], |
|
'Merge': ['M', '#f08aff'], |
|
'Proprietary': ['P', '#19cdce'] |
|
}; |
|
|
|
|
|
let type = 'Unknown'; |
|
if (props.data['Total Parameters'] === null) { |
|
type = 'Proprietary'; |
|
} else if (props.data['Is Foundation'] && !props.data['Is Merged']) { |
|
type = 'Base'; |
|
} else if (props.data['Is Merged']) { |
|
type = 'Merge'; |
|
} else if (props.data['Is Finetuned'] && !props.data['Is Merged']) { |
|
type = 'Finetune'; |
|
} |
|
|
|
const [letter, color] = typeMap[type] || ['?', '#999']; |
|
|
|
return React.createElement('div', { |
|
style: { |
|
display: 'flex', |
|
alignItems: 'center', |
|
height: '100%', |
|
position: 'absolute', |
|
top: 0, |
|
bottom: 0, |
|
left: '12px' |
|
} |
|
}, |
|
React.createElement('div', { |
|
style: { |
|
color: color, |
|
display: 'flex', |
|
alignItems: 'center', |
|
justifyContent: 'center', |
|
fontWeight: 'bold', |
|
fontSize: '14px', |
|
lineHeight: '1', |
|
textAlign: 'center' |
|
} |
|
}, letter) |
|
); |
|
}; |