import React from 'react'; import { Box, CloseButton } from '@chakra-ui/react'; import { useSystemStore } from '@/web/common/system/useSystemStore'; import ReactDOM from 'react-dom'; import Markdown from '@/components/Markdown'; const Price = ({ onClose }: { onClose: () => void }) => { const { llmModelList, vectorModelList, audioSpeechModelList, whisperModel } = useSystemStore(); const list = [ { title: 'AI语言模型', describe: '', md: ` | 模型 | 输入价格(¥) | 输出价格(¥) | | --- | --- | --- | ${llmModelList ?.map((item) => `| ${item.name} | ${item.inputPrice}/1k tokens | ${item.outputPrice}/1k tokens |`) .join('\n')}` }, { title: '索引模型(文档训练 & 文档检索)', describe: '', md: ` | 模型 | 价格(¥) | | --- | --- | ${vectorModelList?.map((item) => `| ${item.name} | ${item.inputPrice}/1k 字符 |`).join('\n')} ` }, { title: '语音播放', describe: '', md: ` | 模型 | 价格(¥) | | --- | --- | ${audioSpeechModelList ?.map((item) => `| ${item.name} | ${item.inputPrice}/1k 字符 | - |`) .join('\n')}` }, ...(whisperModel ? [ { title: '语音输入', describe: '', md: ` | 模型 | 价格(¥) | | --- | --- | | ${whisperModel.name} | ${whisperModel.inputPrice}/分钟 | - |` } ] : []) ]; return ReactDOM.createPortal( {list.map((item) => ( {item.title} ))} , // @ts-ignore document.querySelector('body') ); }; export default Price;