mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 15:53:42 +08:00 
			
		
		
		
	feat: add balance not supported message in ChannelsTable
This commit is contained in:
		@@ -1,17 +1,7 @@
 | 
				
			|||||||
import React, { useEffect, useState } from 'react';
 | 
					import React, {useEffect, useState} from 'react';
 | 
				
			||||||
import { useTranslation } from 'react-i18next';
 | 
					import {useTranslation} from 'react-i18next';
 | 
				
			||||||
import {
 | 
					import {Button, Dropdown, Form, Input, Label, Message, Pagination, Popup, Table,} from 'semantic-ui-react';
 | 
				
			||||||
  Button,
 | 
					import {Link} from 'react-router-dom';
 | 
				
			||||||
  Dropdown,
 | 
					 | 
				
			||||||
  Form,
 | 
					 | 
				
			||||||
  Input,
 | 
					 | 
				
			||||||
  Label,
 | 
					 | 
				
			||||||
  Message,
 | 
					 | 
				
			||||||
  Pagination,
 | 
					 | 
				
			||||||
  Popup,
 | 
					 | 
				
			||||||
  Table,
 | 
					 | 
				
			||||||
} from 'semantic-ui-react';
 | 
					 | 
				
			||||||
import { Link } from 'react-router-dom';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  API,
 | 
					  API,
 | 
				
			||||||
  loadChannelModels,
 | 
					  loadChannelModels,
 | 
				
			||||||
@@ -23,8 +13,8 @@ import {
 | 
				
			|||||||
  timestamp2string,
 | 
					  timestamp2string,
 | 
				
			||||||
} from '../helpers';
 | 
					} from '../helpers';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { CHANNEL_OPTIONS, ITEMS_PER_PAGE } from '../constants';
 | 
					import {CHANNEL_OPTIONS, ITEMS_PER_PAGE} from '../constants';
 | 
				
			||||||
import { renderGroup, renderNumber } from '../helpers/render';
 | 
					import {renderGroup, renderNumber} from '../helpers/render';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function renderTimestamp(timestamp) {
 | 
					function renderTimestamp(timestamp) {
 | 
				
			||||||
  return <>{timestamp2string(timestamp)}</>;
 | 
					  return <>{timestamp2string(timestamp)}</>;
 | 
				
			||||||
@@ -54,6 +44,9 @@ function renderType(type, t) {
 | 
				
			|||||||
function renderBalance(type, balance, t) {
 | 
					function renderBalance(type, balance, t) {
 | 
				
			||||||
  switch (type) {
 | 
					  switch (type) {
 | 
				
			||||||
    case 1: // OpenAI
 | 
					    case 1: // OpenAI
 | 
				
			||||||
 | 
					        if (balance === 0) {
 | 
				
			||||||
 | 
					            return <span>{t('channel.table.balance_not_supported')}</span>;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      return <span>${balance.toFixed(2)}</span>;
 | 
					      return <span>${balance.toFixed(2)}</span>;
 | 
				
			||||||
    case 4: // CloseAI
 | 
					    case 4: // CloseAI
 | 
				
			||||||
      return <span>¥{balance.toFixed(2)}</span>;
 | 
					      return <span>¥{balance.toFixed(2)}</span>;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user