59 lines
2.2 KiB
TypeScript
59 lines
2.2 KiB
TypeScript
import React from 'react';
|
|
|
|
import { useAssistantStatus } from '@/hooks/useAssistantStatus';
|
|
import { useConfigStore } from '@/stores/useConfigStore';
|
|
import { useSessionUIStore } from '@/sync/session-ui-store';
|
|
import { getProviderModelDisplayName } from '@/lib/modelDisplay';
|
|
import { StatusRow } from './StatusRow';
|
|
|
|
/**
|
|
* Status row wrapper.
|
|
* Uses the dedicated assistant status hook so the row keeps accurate live activity
|
|
* labels while still limiting subscriptions to the active assistant message.
|
|
*/
|
|
export const StatusRowContainer: React.FC = React.memo(() => {
|
|
const currentSessionId = useSessionUIStore((state) => state.currentSessionId);
|
|
const abortRecord = useSessionUIStore(
|
|
React.useCallback((state) => {
|
|
if (!currentSessionId) {
|
|
return null;
|
|
}
|
|
return state.sessionAbortFlags?.get(currentSessionId) ?? null;
|
|
}, [currentSessionId]),
|
|
);
|
|
const { activeModel, working } = useAssistantStatus();
|
|
const currentAgentName = useConfigStore((state) => state.currentAgentName);
|
|
const providers = useConfigStore((state) => state.providers);
|
|
|
|
const modelDisplayName = React.useMemo(() => {
|
|
if (!activeModel) {
|
|
return null;
|
|
}
|
|
const provider = providers.length > 0
|
|
? providers.find((candidate) => candidate.id === activeModel.providerId)
|
|
: undefined;
|
|
return getProviderModelDisplayName(provider, activeModel.modelId) || null;
|
|
}, [activeModel, providers]);
|
|
|
|
const wasAborted = Boolean(abortRecord && !abortRecord.acknowledged);
|
|
|
|
return (
|
|
<StatusRow
|
|
isWorking={working.isWorking}
|
|
statusText={working.statusText}
|
|
isGenericStatus={working.isGenericStatus}
|
|
isWaitingForPermission={working.isWaitingForPermission}
|
|
wasAborted={wasAborted || working.wasAborted}
|
|
abortActive={wasAborted || working.abortActive}
|
|
retryInfo={working.retryInfo}
|
|
showAssistantStatus
|
|
showTodos={false}
|
|
agentName={currentAgentName}
|
|
modelName={modelDisplayName}
|
|
providerId={activeModel?.providerId ?? null}
|
|
/>
|
|
);
|
|
});
|
|
|
|
StatusRowContainer.displayName = 'StatusRowContainer';
|