fix: bill, app detail

This commit is contained in:
archer
2023-07-19 08:36:06 +08:00
parent 58cbf10c85
commit 7a76f54148
12 changed files with 64 additions and 42 deletions

View File

@@ -38,6 +38,7 @@ import { defaultShareChat } from '@/constants/model';
import type { ShareChatEditType } from '@/types/app';
import MyTooltip from '@/components/MyTooltip';
import { useRequest } from '@/hooks/useRequest';
import { formatPrice } from '@/utils/user';
const Share = ({ appId }: { appId: string }) => {
const { toast } = useToast();
@@ -82,12 +83,6 @@ const Share = ({ appId }: { appId: string }) => {
}
});
// format share used token
const formatTokens = (tokens: number) => {
if (tokens < 10000) return tokens;
return `${(tokens / 10000).toFixed(2)}`;
};
return (
<Box position={'relative'} pt={[0, 5, 8]} px={[5, 8]} minH={'50vh'}>
<Flex justifyContent={'space-between'}>
@@ -118,7 +113,7 @@ const Share = ({ appId }: { appId: string }) => {
<Tr>
<Th></Th>
<Th></Th>
<Th>tokens消</Th>
<Th></Th>
<Th>使</Th>
<Th></Th>
</Tr>
@@ -128,7 +123,7 @@ const Share = ({ appId }: { appId: string }) => {
<Tr key={item._id}>
<Td>{item.name}</Td>
<Td>{item.maxContext}</Td>
<Td>{formatTokens(item.tokens)}</Td>
<Td>{formatPrice(item.total)}</Td>
<Td>{item.lastTime ? formatTimeToChatTime(item.lastTime) : '未使用'}</Td>
<Td>
<Flex>