|
1 | | -import {Row, Typography} from "antd"; |
| 1 | +import {Image, Row, Typography} from "antd"; |
2 | 2 | import {SCROLL_STYLE} from "@/constant"; |
3 | 3 | import {modelHub} from "ai-model-hub"; |
4 | | -import {ProCard, ProTable} from "@ant-design/pro-components"; |
| 4 | +import {ProCard, ProTable, WaterMark} from "@ant-design/pro-components"; |
5 | 5 |
|
6 | 6 | const {Text} = Typography; |
7 | 7 |
|
8 | 8 | export function PricingPage() { |
9 | 9 | return ( |
10 | 10 | <div style={{...SCROLL_STYLE}}> |
11 | | - <Row |
12 | | - gutter={[16, 16]} |
13 | | - style={{...SCROLL_STYLE, height: "100%", padding: 32, borderRadius: 16}} |
| 11 | + <WaterMark |
| 12 | + content={"OpenAI-Next"} |
| 13 | + fontColor={"rgba(0,0,0,0.1)"} |
14 | 14 | > |
15 | | - <> |
16 | | - {modelHub.getAll().map((provider) => { |
17 | | - return ( |
18 | | - <ProCard |
19 | | - title={provider.provider} |
20 | | - key={provider.provider} |
21 | | - bordered |
22 | | - headerBordered |
23 | | - > |
24 | | - <ProTable |
25 | | - options={false} |
26 | | - pagination={false} |
27 | | - search={false} |
28 | | - size={"small"} |
29 | | - dataSource={provider.models_list} |
30 | | - columns={[ |
31 | | - { |
32 | | - title: "模型名称", |
33 | | - dataIndex: "name", |
34 | | - width: "15%", |
35 | | - render: (_, record) => <Text strong copyable>{record.name}</Text> |
36 | | - }, |
37 | | - { |
38 | | - title: "发布时间", |
39 | | - dataIndex: "release_time", |
40 | | - width: "10%", |
41 | | - render: (_, record) => { |
42 | | - try { |
43 | | - const timestamp = Number(record.release_time) * 1000; |
44 | | - if (isNaN(timestamp) || timestamp < 0) { |
| 15 | + <Row |
| 16 | + gutter={[16, 16]} |
| 17 | + style={{...SCROLL_STYLE, height: "100%", padding: 32, borderRadius: 16}} |
| 18 | + > |
| 19 | + <> |
| 20 | + {modelHub.getAll().map((provider) => { |
| 21 | + return ( |
| 22 | + <ProCard |
| 23 | + title={provider.logo.icon ? <><Image |
| 24 | + src={provider.logo.icon?.black_white || provider.logo.icon?.color || ""} |
| 25 | + height={32} |
| 26 | + preview={false} |
| 27 | + style={{verticalAlign: 'middle'}} |
| 28 | + /> |
| 29 | + <b style={{ |
| 30 | + fontSize: 18, |
| 31 | + marginLeft: 8, |
| 32 | + verticalAlign: 'middle' |
| 33 | + }}>{provider.provider}</b></> |
| 34 | + : |
| 35 | + provider.provider |
| 36 | + } |
| 37 | + key={provider.provider} |
| 38 | + bordered |
| 39 | + headerBordered |
| 40 | + > |
| 41 | + <ProTable |
| 42 | + options={false} |
| 43 | + pagination={false} |
| 44 | + search={false} |
| 45 | + size={"small"} |
| 46 | + dataSource={provider.models_list} |
| 47 | + columns={[ |
| 48 | + { |
| 49 | + title: "模型名称", |
| 50 | + dataIndex: "name", |
| 51 | + width: "21%", |
| 52 | + render: (_, record) => <Text strong copyable>{record.name}</Text> |
| 53 | + }, |
| 54 | + { |
| 55 | + title: "发布时间", |
| 56 | + dataIndex: "release_time", |
| 57 | + width: "11%", |
| 58 | + render: (_, record) => { |
| 59 | + try { |
| 60 | + const timestamp = Number(record.release_time) * 1000; |
| 61 | + if (isNaN(timestamp) || timestamp < 0) { |
| 62 | + return <Text type={"secondary"}>-</Text> |
| 63 | + } else { |
| 64 | + const date = { |
| 65 | + year: new Date(timestamp).getFullYear(), |
| 66 | + month: new Date(timestamp).getMonth() + 1, |
| 67 | + day: new Date(timestamp).getDate(), |
| 68 | + }; |
| 69 | + return <Text>{date.year}-{(date.month).toString().padStart(2, "0")}-{(date.day).toString().padStart(2, "0")}</Text> |
| 70 | + } |
| 71 | + } catch (e) { |
45 | 72 | return <Text type={"secondary"}>-</Text> |
46 | | - } else { |
47 | | - const date = { |
48 | | - year: new Date(timestamp).getFullYear(), |
49 | | - month: new Date(timestamp).getMonth() + 1, |
50 | | - day: new Date(timestamp).getDate(), |
51 | | - }; |
52 | | - return <Text>{date.year}-{(date.month).toString().padStart(2, "0")}-{(date.day).toString().padStart(2, "0")}</Text> |
53 | 73 | } |
54 | | - } catch (e) { |
55 | | - return <Text type={"secondary"}>-</Text> |
56 | | - } |
| 74 | + }, |
| 75 | + }, |
| 76 | + { |
| 77 | + title: "模型介绍", |
| 78 | + dataIndex: "description", |
| 79 | + width: "38%", |
| 80 | + ellipsis: true, |
57 | 81 | }, |
58 | | - }, |
59 | | - { |
60 | | - title: "模型介绍", |
61 | | - dataIndex: "description", |
62 | | - width: "50%", |
63 | | - ellipsis: true, |
64 | | - }, |
65 | | - { |
66 | | - title: "价格(输入)", |
67 | | - render: (_, record) => { |
68 | | - const price = record?.price?.[0]?.input; |
69 | | - const isFree = price === 0; |
70 | | - return ( |
71 | | - price ? isFree ? <Text type={"success"}>免费</Text> : |
72 | | - <Text>${price} / 1M tokens</Text> : |
73 | | - <Text type={"secondary"}>暂无</Text> |
74 | | - ) |
| 82 | + { |
| 83 | + title: "价格(输入)", |
| 84 | + render: (_, record) => { |
| 85 | + const price = record?.price?.[0]?.input; |
| 86 | + const isFree = price === 0; |
| 87 | + return ( |
| 88 | + price ? isFree ? <Text type={"success"}>免费</Text> : |
| 89 | + <Text>${price} / 1M tokens</Text> : |
| 90 | + <Text type={"secondary"}>暂无</Text> |
| 91 | + ) |
| 92 | + }, |
| 93 | + width: "15%", |
75 | 94 | }, |
76 | | - width: "10%", |
77 | | - }, |
78 | | - { |
79 | | - title: "价格(输出)", |
80 | | - render: (_, record) => { |
81 | | - const price = record?.price?.[0]?.output; |
82 | | - const isFree = price === 0; |
83 | | - return ( |
84 | | - price ? isFree ? <Text type={"success"}>免费</Text> : |
85 | | - <Text>${price} / 1M tokens</Text> : |
86 | | - <Text type={"secondary"}>暂无</Text> |
87 | | - ) |
| 95 | + { |
| 96 | + title: "价格(输出)", |
| 97 | + render: (_, record) => { |
| 98 | + const price = record?.price?.[0]?.output; |
| 99 | + const isFree = price === 0; |
| 100 | + return ( |
| 101 | + price ? isFree ? <Text type={"success"}>免费</Text> : |
| 102 | + <Text>${price} / 1M tokens</Text> : |
| 103 | + <Text type={"secondary"}>暂无</Text> |
| 104 | + ) |
| 105 | + }, |
| 106 | + width: "15%", |
88 | 107 | }, |
89 | | - width: "10%", |
90 | | - }, |
91 | | - ]} |
92 | | - /> |
93 | | - </ProCard> |
94 | | - ); |
95 | | - })} |
96 | | - <Text type={"secondary"} style={{marginTop: 6}}> |
97 | | - You can view the update records of model information, submit feedback or suggestions in |
98 | | - our <Typography.Link |
99 | | - href={"https://github.com/OpenAI-Next/ai-model-hub"}>GitHub Repository</Typography.Link>. |
100 | | - </Text> |
101 | | - </> |
102 | | - </Row> |
| 108 | + ]} |
| 109 | + scroll={{x: 950}} |
| 110 | + /> |
| 111 | + </ProCard> |
| 112 | + ); |
| 113 | + })} |
| 114 | + <Text type={"secondary"} style={{marginTop: 6}}> |
| 115 | + You can view the update records of model information, submit feedback or suggestions in |
| 116 | + our <Typography.Link |
| 117 | + href={"https://github.com/OpenAI-Next/ai-model-hub"}>GitHub Repository</Typography.Link>. |
| 118 | + </Text> |
| 119 | + </> |
| 120 | + </Row> |
| 121 | + </WaterMark> |
103 | 122 | </div> |
104 | 123 | ); |
105 | 124 | } |
|
0 commit comments