UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

29 lines (25 loc) 722 B
export const getHarmoniousSize = ( inputWidth: number, inputHeight: number, { spacing = 24, containerWidth, containerHeight, }: { containerHeight: number; containerWidth: number; spacing: number }, ) => { let width = String(inputWidth); let height = String(inputHeight); const maxWidth = containerWidth - spacing; const maxHeight = containerHeight - spacing; if (inputHeight >= inputWidth && inputHeight >= maxHeight) { height = maxHeight + 'px'; width = 'auto'; } else if (inputWidth >= inputHeight && inputWidth >= maxWidth) { height = 'auto'; width = maxWidth + 'px'; } else { width = width + 'px'; height = height + 'px'; } return { height, width }; };