fix(attachments): expose opencode attachment target
This commit is contained in:
parent
960beaad44
commit
1960c5d29e
1 changed files with 17 additions and 12 deletions
|
|
@ -283,6 +283,10 @@ export const MessageComposer = ({
|
||||||
const selectedMember = members.find((m) => m.name === recipient);
|
const selectedMember = members.find((m) => m.name === recipient);
|
||||||
const selectedResolvedColor = selectedMember ? colorMap.get(selectedMember.name) : undefined;
|
const selectedResolvedColor = selectedMember ? colorMap.get(selectedMember.name) : undefined;
|
||||||
const isLeadRecipient = selectedMember ? isLeadMember(selectedMember) : false;
|
const isLeadRecipient = selectedMember ? isLeadMember(selectedMember) : false;
|
||||||
|
const selectedProviderId =
|
||||||
|
normalizeOptionalTeamProviderId(selectedMember?.providerId) ??
|
||||||
|
inferTeamProviderIdFromModel(selectedMember?.model);
|
||||||
|
const isOpenCodeRecipient = selectedProviderId === 'opencode';
|
||||||
const hasTeammates = members.length > 1;
|
const hasTeammates = members.length > 1;
|
||||||
const canDelegate = hasTeammates && (isCrossTeam || isLeadRecipient);
|
const canDelegate = hasTeammates && (isCrossTeam || isLeadRecipient);
|
||||||
const shouldAutoDelegate = isLeadRecipient && canDelegate;
|
const shouldAutoDelegate = isLeadRecipient && canDelegate;
|
||||||
|
|
@ -337,14 +341,19 @@ export const MessageComposer = ({
|
||||||
// const leadContext = useStore((s) =>
|
// const leadContext = useStore((s) =>
|
||||||
// isLeadAgentRecipient ? s.leadContextByTeam[teamName] : undefined
|
// isLeadAgentRecipient ? s.leadContextByTeam[teamName] : undefined
|
||||||
// );
|
// );
|
||||||
const supportsAttachments = isLeadRecipient && !isCrossTeam && !!isTeamAlive;
|
const supportsAttachments =
|
||||||
|
!isCrossTeam && !!isTeamAlive && (isLeadRecipient || isOpenCodeRecipient);
|
||||||
const canAttach = supportsAttachments && draft.canAddMore && !sending;
|
const canAttach = supportsAttachments && draft.canAddMore && !sending;
|
||||||
const attachmentRestrictionReason = !supportsAttachments
|
const attachmentRestrictionReason = !supportsAttachments
|
||||||
? isCrossTeam
|
? isCrossTeam
|
||||||
? 'File attachments are not supported for cross-team messages'
|
? 'File attachments are not supported for cross-team messages'
|
||||||
: !isLeadRecipient
|
: !isTeamAlive
|
||||||
? 'Files can only be sent to the team lead'
|
? 'Team must be online to attach files'
|
||||||
: 'Team must be online to attach files'
|
: !isLeadRecipient && !isOpenCodeRecipient
|
||||||
|
? 'Files can be sent to the team lead or OpenCode teammates'
|
||||||
|
: isOpenCodeRecipient
|
||||||
|
? 'Team must be online to attach files for OpenCode teammates'
|
||||||
|
: 'Team must be online to attach files'
|
||||||
: sending
|
: sending
|
||||||
? 'Wait for current message to finish sending before adding files'
|
? 'Wait for current message to finish sending before adding files'
|
||||||
: !draft.canAddMore
|
: !draft.canAddMore
|
||||||
|
|
@ -640,13 +649,9 @@ export const MessageComposer = ({
|
||||||
</button>
|
</button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
{!isTeamAlive
|
{canAttach
|
||||||
? 'Team must be online to attach files'
|
? 'Attach files (paste or drag & drop)'
|
||||||
: sending
|
: (attachmentRestrictionReason ?? 'Attachments are unavailable')}
|
||||||
? 'Wait for current message to finish sending'
|
|
||||||
: !draft.canAddMore
|
|
||||||
? 'Maximum attachments reached'
|
|
||||||
: 'Attach files (paste or drag & drop)'}
|
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</>
|
</>
|
||||||
|
|
@ -943,7 +948,7 @@ export const MessageComposer = ({
|
||||||
error={draft.attachmentError ?? fileRestrictionError}
|
error={draft.attachmentError ?? fileRestrictionError}
|
||||||
onDismissError={draft.clearAttachmentError}
|
onDismissError={draft.clearAttachmentError}
|
||||||
disabled={attachmentsBlocked}
|
disabled={attachmentsBlocked}
|
||||||
disabledHint="File attachments are only supported when sending to the team lead while the team is online. Remove attachments or switch recipient."
|
disabledHint="File attachments are supported for the online team lead and online OpenCode teammates. Remove attachments or switch recipient."
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue