mirror of
https://github.com/labring/FastGPT.git
synced 2026-04-27 02:08:10 +08:00
3f4400a500
* feat: model config with brand-new price calculate machanism (#6616) * fix: image read and json error (Agent) (#6502) * fix: 1.image read 2.JSON parsing error * dataset cite and pause * perf: plancall second parse * add test --------- Co-authored-by: archer <545436317@qq.com> * master message * remove invalid code * wip: model config * feat: model config with brand-new price calculate machanism * merge main branch * ajust calculate way * ajust priceTiers resolve procession * perf: price config code * fix: default price * fix: test * fix: comment * fix test --------- Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com> Co-authored-by: archer <545436317@qq.com> * wip: fix modal UI (#6634) * wip: fix modal UI * fix: maxInputToken set * chore: add price unit for non llm models * chore: replace question mark icon with beta tag (#6672) * feat:rerank too long; fix:rerank ui(agent),embedding returns 0 (#6663) * feat:rerank too long; fix:rerank ui(agent),embedding returns 0 * rerank * fix:rerank function * perf: rerank code * fix rerank * perf: model price ui --------- Co-authored-by: archer <545436317@qq.com> * remove llmtype field * revert model init * fix: filed * fix: model select filter * perf: multiple selector render * remove invalid checker * remove invalid i18n * perf: model selector tip * perf: model selector tip * fix cr * limit pnpm version * fix: i18n * fix action * set default mintoken * update i18n * perf: usage push * fix:rerank model ui (#6677) * fix: tier match error * fix: testr --------- Co-authored-by: Ryo <whoeverimf5@gmail.com> Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
85 lines
1.9 KiB
TypeScript
85 lines
1.9 KiB
TypeScript
import React, { forwardRef } from 'react';
|
|
import { Flex, Box, type BoxProps, HStack } from '@chakra-ui/react';
|
|
import MyIcon from '../Icon';
|
|
|
|
type Props<T = string> = Omit<BoxProps, 'onChange'> & {
|
|
list: {
|
|
icon?: string;
|
|
label: string | React.ReactNode;
|
|
value: T;
|
|
}[];
|
|
value: T;
|
|
onChange: (e: T) => void;
|
|
iconSize?: string;
|
|
labelSize?: string;
|
|
iconGap?: number;
|
|
};
|
|
|
|
const FillRowTabs = (
|
|
{
|
|
list,
|
|
value,
|
|
onChange,
|
|
py = '2.5',
|
|
px = '4',
|
|
iconSize = '18px',
|
|
labelSize = 'sm',
|
|
iconGap = 2,
|
|
...props
|
|
}: Props,
|
|
ref: React.Ref<HTMLDivElement>
|
|
) => {
|
|
return (
|
|
<Box
|
|
ref={ref}
|
|
display={'inline-flex'}
|
|
px={'3px'}
|
|
py={'3px'}
|
|
borderRadius={'sm'}
|
|
borderWidth={'1px'}
|
|
borderColor={'myGray.200'}
|
|
bg={'myGray.50'}
|
|
gap={'4px'}
|
|
fontSize={'sm'}
|
|
fontWeight={'medium'}
|
|
{...props}
|
|
>
|
|
{list.map((item) => (
|
|
<HStack
|
|
key={item.value}
|
|
flex={'1 0 0'}
|
|
alignItems={'center'}
|
|
justifyContent={'center'}
|
|
cursor={'pointer'}
|
|
borderRadius={'xs'}
|
|
px={px}
|
|
py={py}
|
|
userSelect={'none'}
|
|
whiteSpace={'noWrap'}
|
|
gap={iconGap}
|
|
{...(value === item.value
|
|
? {
|
|
bg: 'white',
|
|
boxShadow: '1.5',
|
|
color: 'primary.600'
|
|
}
|
|
: {
|
|
color: 'myGray.500',
|
|
_hover: {
|
|
color: 'primary.600'
|
|
},
|
|
onClick: () => onChange(item.value)
|
|
})}
|
|
>
|
|
{item.icon && <MyIcon name={item.icon as any} w={iconSize} />}
|
|
<Box fontSize={labelSize}>{item.label}</Box>
|
|
</HStack>
|
|
))}
|
|
</Box>
|
|
);
|
|
};
|
|
|
|
export default forwardRef(FillRowTabs) as <T>(
|
|
props: Props<T> & { ref?: React.Ref<HTMLDivElement> }
|
|
) => JSX.Element;
|