(props: InputToolbarProps)
| 47 | } |
| 48 | |
| 49 | function InputToolbar(props: InputToolbarProps) { |
| 50 | const dispatch = useAppDispatch(); |
| 51 | const ideMessenger = useContext(IdeMessengerContext); |
| 52 | const fileInputRef = useRef<HTMLInputElement | null>(null); |
| 53 | const defaultModel = useAppSelector(selectSelectedChatModel); |
| 54 | const useActiveFile = useAppSelector(selectUseActiveFile); |
| 55 | const isInEdit = useAppSelector((store) => store.session.isInEdit); |
| 56 | const codeToEdit = useAppSelector((store) => store.editModeState.codeToEdit); |
| 57 | const hasReasoningEnabled = useAppSelector( |
| 58 | (store) => store.session.hasReasoningEnabled, |
| 59 | ); |
| 60 | const isEnterDisabled = |
| 61 | props.disabled || (isInEdit && codeToEdit.length === 0); |
| 62 | |
| 63 | const supportsImages = |
| 64 | defaultModel && |
| 65 | modelSupportsImages( |
| 66 | defaultModel.provider, |
| 67 | defaultModel.model, |
| 68 | defaultModel.title, |
| 69 | defaultModel.capabilities, |
| 70 | ); |
| 71 | |
| 72 | const supportsReasoning = modelSupportsReasoning(defaultModel); |
| 73 | |
| 74 | const smallFont = useFontSize(-2); |
| 75 | const tinyFont = useFontSize(-3); |
| 76 | |
| 77 | return ( |
| 78 | <> |
| 79 | <div |
| 80 | onClick={props.onClick} |
| 81 | className={`find-widget-skip bg-vsc-input-background flex select-none flex-row items-center justify-between gap-1 pt-1 ${props.hidden ? "pointer-events-none h-0 cursor-default opacity-0" : "pointer-events-auto mt-2 cursor-text opacity-100"}`} |
| 82 | style={{ |
| 83 | fontSize: smallFont, |
| 84 | }} |
| 85 | > |
| 86 | <div className="xs:gap-1.5 flex flex-row items-center gap-1"> |
| 87 | {!isInEdit && ( |
| 88 | <ToolTip place="top" content="Select Mode"> |
| 89 | <HoverItem className="!p-0"> |
| 90 | <ModeSelect /> |
| 91 | </HoverItem> |
| 92 | </ToolTip> |
| 93 | )} |
| 94 | <ToolTip place="top" content="Select Model"> |
| 95 | <HoverItem className="!p-0"> |
| 96 | <ModelSelect /> |
| 97 | </HoverItem> |
| 98 | </ToolTip> |
| 99 | <div className="xs:flex text-description -mb-1 hidden items-center transition-colors duration-200"> |
| 100 | {props.toolbarOptions?.hideImageUpload || |
| 101 | (supportsImages && ( |
| 102 | <> |
| 103 | <input |
| 104 | type="file" |
| 105 | ref={fileInputRef} |
| 106 | style={{ display: "none" }} |
nothing calls this directly
no test coverage detected