({
block,
addMargin,
resolvedToolUseIDs,
erroredToolUseIDs,
shouldAnimate,
verbose,
advisorModel,
}: Props)
| 19 | }; |
| 20 | |
| 21 | export function AdvisorMessage({ |
| 22 | block, |
| 23 | addMargin, |
| 24 | resolvedToolUseIDs, |
| 25 | erroredToolUseIDs, |
| 26 | shouldAnimate, |
| 27 | verbose, |
| 28 | advisorModel, |
| 29 | }: Props): React.ReactNode { |
| 30 | if (block.type === 'server_tool_use') { |
| 31 | const input = block.input && Object.keys(block.input).length > 0 ? jsonStringify(block.input) : null; |
| 32 | return ( |
| 33 | <Box marginTop={addMargin ? 1 : 0} paddingRight={2} flexDirection="row"> |
| 34 | <ToolUseLoader |
| 35 | shouldAnimate={shouldAnimate} |
| 36 | isUnresolved={!resolvedToolUseIDs.has(block.id)} |
| 37 | isError={erroredToolUseIDs.has(block.id)} |
| 38 | /> |
| 39 | <Text bold>Advising</Text> |
| 40 | {advisorModel ? <Text dimColor> using {renderModelName(advisorModel)}</Text> : null} |
| 41 | {input ? <Text dimColor> · {input}</Text> : null} |
| 42 | </Box> |
| 43 | ); |
| 44 | } |
| 45 | |
| 46 | let body: React.ReactNode; |
| 47 | switch (block.content.type) { |
| 48 | case 'advisor_tool_result_error': |
| 49 | body = <Text color="error">Advisor unavailable ({block.content.error_code})</Text>; |
| 50 | break; |
| 51 | case 'advisor_result': |
| 52 | body = verbose ? ( |
| 53 | <Text dimColor>{block.content.text}</Text> |
| 54 | ) : ( |
| 55 | <Text dimColor> |
| 56 | {figures.tick} Advisor has reviewed the conversation and will apply the feedback <CtrlOToExpand /> |
| 57 | </Text> |
| 58 | ); |
| 59 | break; |
| 60 | case 'advisor_redacted_result': |
| 61 | body = <Text dimColor>{figures.tick} Advisor has reviewed the conversation and will apply the feedback</Text>; |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | return ( |
| 66 | <Box paddingRight={2}> |
| 67 | <MessageResponse>{body}</MessageResponse> |
| 68 | </Box> |
| 69 | ); |
| 70 | } |
nothing calls this directly
no test coverage detected