Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions src/components/map-projects/Candidates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import RefreshIcon from '@mui/icons-material/Refresh';
import SortIcon from '@mui/icons-material/Sort';
import GroupIcon from '@mui/icons-material/Layers';
import AssistantIcon from '@mui/icons-material/Assistant';
import HourglassIcon from '@mui/icons-material/HourglassEmpty';

import isEmpty from 'lodash/isEmpty'
import flatten from 'lodash/flatten'
Expand Down Expand Up @@ -53,38 +54,7 @@ import {
conceptForMapping,
getAIAnalysisCandidateIDs
} from './viewBuilders.js'

const getRowProgressLabel = (stageMap, algos) => {
if(stageMap === undefined)
return {label: false}
if(!stageMap)
return {label: 'Preparing...', status: 'partial'}

const stages = algos.map(k => stageMap[k.id]);

if (!stages.length || stages.every(v => v === -1)) {
return { label: 'Not started', status: 'idle' };
}

const runningIndex = stages.findIndex(v => v === 0);
if (runningIndex !== -1) {
return {
label: `Running: ${algos[runningIndex].id}...`,
status: 'running',
};
}

if (stages.every(v => v === 1)) {
return true
}

const waitingIndex = stages.findIndex(v => v === -1)
if(waitingIndex !== -1) {
return {label: `Waiting: ${algos[waitingIndex].id}`, status: 'waiting'} // AutoMatch Bulk
}

return { label: 'Partially completed', status: 'partial' };
}
import { getRowProgressLabel } from './rowProgress.js'

const Sort = ({ selected, onSort }) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -407,7 +377,7 @@ const CandidateList = ({rowViews, header, rowIndex, sortBy, order, openConceptPa
// conceptCache — project-wide ConceptDefinition store, keyed by concept_key.
// algosSelected — algorithm definitions (for headers/grouping).
// (plans/unified-mapper-model.md "How the views map onto this model".)
const Candidates = ({rowIndex, rowState, conceptCache, targetCanonical, targetRelativeUrl, openConceptPanel, showItem, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, promptTemplates, promptTemplate, onPromptTemplateChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, canSelectAIModel}) => {
const Candidates = ({rowIndex, rowState, conceptCache, targetCanonical, targetRelativeUrl, openConceptPanel, showItem, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, promptTemplates, promptTemplate, onPromptTemplateChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, canSelectAIModel, capacityWait=false}) => {
const { t } = useTranslation();
const [sortBy, setSortBy] = React.useState('rerank_score')
const [groupBy, setGroupBy] = React.useState('quality')
Expand Down Expand Up @@ -466,7 +436,9 @@ const Candidates = ({rowIndex, rowState, conceptCache, targetCanonical, targetRe
const canFetchMore = hasAnyView
const algoStagesValue = values(rowStage || {}).filter((_, i) => Object.keys(rowStage || {})[i] !== 'recommend')
const areAlgoRun = algoStagesValue.length > 0 && algoStagesValue.every(v => v === 1)
const { label } = getRowProgressLabel(rowStage, algosSelected);
const { label, status: progressStatus } = getRowProgressLabel(rowStage, algosSelected, {t, capacityWait});
// Waiting out a busy server, or given up on for now: not a spinner (ocl_issues#2849).
const isCapacityStatus = ['capacity_wait', 'throttled'].includes(progressStatus)

const byAlgoScore = sortBy === 'algo_score'
const byRerankScore = sortBy === 'rerank_score'
Expand Down Expand Up @@ -628,7 +600,7 @@ const Candidates = ({rowIndex, rowState, conceptCache, targetCanonical, targetRe
<span style={{display: 'flex', alignItems: 'center'}}>
{
!areAlgoRun && label &&
<Chip icon={<CircularProgress sx={{width: '14px !important', height: '14px !important', marginLeft: '6px !important', marginRight: '0px !important'}} />} variant='outlined' color='warning' size='small' label={label} sx={{margin: '0 8px'}} />
<Chip icon={isCapacityStatus ? <HourglassIcon fontSize='small' /> : <CircularProgress sx={{width: '14px !important', height: '14px !important', marginLeft: '6px !important', marginRight: '0px !important'}} />} variant='outlined' color='warning' size='small' label={label} sx={{margin: '0 8px'}} />
}
{
// Refresh stays visible even when there are zero candidates so
Expand Down
4 changes: 2 additions & 2 deletions src/components/map-projects/ConfigurationForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const VisuallyHiddenInput = styled('input')({

const deriveCanonicalUrl = relativeUrl => relativeUrl ? `https://ns.openconceptlab.org${relativeUrl}` : ''

const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, name, setName, description, setDescription, repo, onRepoChange, repoVersion, setRepoVersion, versions, mappedSources, targetSourcesFromRows, algosSelected, setAlgosSelected, sx, algos, validColumns, columns, isValidColumnValue, updateColumn, configure, setConfigure, columnVisibilityModel, setColumnVisibilityModel, onSave, isSaving, candidatesScore, onScoreChange, includeDefaultFilter, setIncludeDefaultFilter, filters, setFilters, locales, isLoadingLocales, setAIAssistantColumns, AIAssistantColumns, inAIAssistantGroup, lookupConfig, setLookupConfig, encoderModel, setEncoderModel, isCoreUser, fullRequestLimits, canSelectAIModel, canSetAIOutputLocale, canBridge, canScispacy, canUseOrgProjects=true, canUseCustomAlgorithms=true, promptTemplates, promptTemplate, onPromptTemplateChange, AIModels, AIModel, setAIModel, namespace, setNamespace, promptOutputLocale, setPromptOutputLocale, inputLocale, setInputLocale, oclLocales, useLexicalVariants, setUseLexicalVariants }) => {
const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, name, setName, description, setDescription, repo, onRepoChange, repoVersion, setRepoVersion, versions, mappedSources, targetSourcesFromRows, algosSelected, setAlgosSelected, sx, algos, validColumns, columns, isValidColumnValue, updateColumn, configure, setConfigure, columnVisibilityModel, setColumnVisibilityModel, onSave, isSaving, candidatesScore, onScoreChange, includeDefaultFilter, setIncludeDefaultFilter, filters, setFilters, locales, isLoadingLocales, setAIAssistantColumns, AIAssistantColumns, inAIAssistantGroup, lookupConfig, setLookupConfig, encoderModel, setEncoderModel, isCoreUser, requestLimits, canSelectAIModel, canSetAIOutputLocale, canBridge, canScispacy, canUseOrgProjects=true, canUseCustomAlgorithms=true, promptTemplates, promptTemplate, onPromptTemplateChange, AIModels, AIModel, setAIModel, namespace, setNamespace, promptOutputLocale, setPromptOutputLocale, inputLocale, setInputLocale, oclLocales, useLexicalVariants, setUseLexicalVariants }) => {
const { t } = useTranslation();
const user = getCurrentUser()
const isLLMAlgoNotAllowed = !repoVersion?.match_algorithms?.includes('llm')
Expand Down Expand Up @@ -438,7 +438,7 @@ const ConfigurationForm = ({ project, handleFileUpload, file, owner, setOwner, n
onChange={setAlgosSelected}
repo={repoVersion}
isCoreUser={isCoreUser}
fullRequestLimits={fullRequestLimits}
requestLimits={requestLimits}
/>
{
isCoreUser &&
Expand Down
Loading
Loading