perf: model framwork

This commit is contained in:
archer
2023-05-03 10:57:56 +08:00
parent aa74625f96
commit 91decc3683
19 changed files with 71 additions and 104 deletions

View File

@@ -21,7 +21,7 @@ import {
import { QuestionOutlineIcon } from '@chakra-ui/icons';
import type { ModelSchema } from '@/types/mongoSchema';
import { UseFormReturn } from 'react-hook-form';
import { ChatModelMap, modelList, ModelVectorSearchModeMap } from '@/constants/model';
import { ChatModelMap, ModelVectorSearchModeMap } from '@/constants/model';
import { formatPrice } from '@/utils/user';
import { useConfirm } from '@/hooks/useConfirm';
import { useSelectFile } from '@/hooks/useSelectFile';
@@ -110,17 +110,14 @@ const ModelEditForm = ({
<Box flex={'0 0 80px'} w={0}>
:
</Box>
<Box>{ChatModelMap[getValues('chat.chatModel')]}</Box>
<Box>{ChatModelMap[getValues('chat.chatModel')].name}</Box>
</Flex>
<Flex alignItems={'center'} mt={5}>
<Box flex={'0 0 80px'} w={0}>
:
</Box>
<Box>
{formatPrice(
modelList.find((item) => item.chatModel === getValues('chat.chatModel'))?.price || 0,
1000
)}
{formatPrice(ChatModelMap[getValues('chat.chatModel')].price, 1000)}
/1K tokens()
</Box>
</Flex>

View File

@@ -5,7 +5,7 @@ import type { ModelSchema } from '@/types/mongoSchema';
import { Card, Box, Flex, Button, Tag, Grid } from '@chakra-ui/react';
import { useToast } from '@/hooks/useToast';
import { useForm } from 'react-hook-form';
import { formatModelStatus, modelList, defaultModel } from '@/constants/model';
import { formatModelStatus, defaultModel } from '@/constants/model';
import { useGlobalStore } from '@/store/global';
import { useScreen } from '@/hooks/useScreen';
import { useQuery } from '@tanstack/react-query';