Compare commits

...

7 Commits

7 changed files with 48 additions and 30 deletions

View File

@@ -126,10 +126,10 @@ var ValidThemes = map[string]bool{
// All duration's unit is seconds // All duration's unit is seconds
// Shouldn't larger then RateLimitKeyExpirationDuration // Shouldn't larger then RateLimitKeyExpirationDuration
var ( var (
GlobalApiRateLimitNum = env.Int("GLOBAL_API_RATE_LIMIT", 240) GlobalApiRateLimitNum = env.Int("GLOBAL_API_RATE_LIMIT", 480)
GlobalApiRateLimitDuration int64 = 3 * 60 GlobalApiRateLimitDuration int64 = 3 * 60
GlobalWebRateLimitNum = env.Int("GLOBAL_WEB_RATE_LIMIT", 120) GlobalWebRateLimitNum = env.Int("GLOBAL_WEB_RATE_LIMIT", 240)
GlobalWebRateLimitDuration int64 = 3 * 60 GlobalWebRateLimitDuration int64 = 3 * 60
UploadRateLimitNum = 10 UploadRateLimitNum = 10

View File

@@ -1,7 +1,7 @@
export const toastConstants = { export const toastConstants = {
SUCCESS_TIMEOUT: 1500, SUCCESS_TIMEOUT: 5000,
INFO_TIMEOUT: 3000, INFO_TIMEOUT: 8000,
ERROR_TIMEOUT: 5000, ERROR_TIMEOUT: 10000,
WARNING_TIMEOUT: 10000, WARNING_TIMEOUT: 10000,
NOTICE_TIMEOUT: 20000 NOTICE_TIMEOUT: 20000,
}; };

View File

@@ -85,7 +85,8 @@
"test_all_started": "Channel testing started successfully, please refresh page to see results.", "test_all_started": "Channel testing started successfully, please refresh page to see results.",
"delete_disabled_success": "Deleted all disabled channels, total: {{count}}", "delete_disabled_success": "Deleted all disabled channels, total: {{count}}",
"balance_update_success": "Channel {{name}} balance updated successfully!", "balance_update_success": "Channel {{name}} balance updated successfully!",
"all_balance_updated": "All enabled channel balances have been updated!" "all_balance_updated": "All enabled channel balances have been updated!",
"operation_success": "Operation completed successfully!"
}, },
"edit": { "edit": {
"title_edit": "Update Channel Information", "title_edit": "Update Channel Information",

View File

@@ -85,7 +85,8 @@
"test_all_started": "已成功开始测试渠道,请刷新页面查看结果。", "test_all_started": "已成功开始测试渠道,请刷新页面查看结果。",
"delete_disabled_success": "已删除所有禁用渠道,共计 {{count}} 个", "delete_disabled_success": "已删除所有禁用渠道,共计 {{count}} 个",
"balance_update_success": "渠道 {{name}} 余额更新成功!", "balance_update_success": "渠道 {{name}} 余额更新成功!",
"all_balance_updated": "已更新完毕所有已启用渠道余额!" "all_balance_updated": "已更新完毕所有已启用渠道余额!",
"operation_success": "操作成功完成!"
}, },
"edit": { "edit": {
"title_edit": "更新渠道信息", "title_edit": "更新渠道信息",

View File

@@ -207,6 +207,9 @@ const EditChannel = () => {
return; return;
} }
let localInputs = { ...inputs }; let localInputs = { ...inputs };
if (localInputs.key === 'undefined|undefined|undefined') {
localInputs.key = ''; // prevent potential bug
}
if (localInputs.base_url && localInputs.base_url.endsWith('/')) { if (localInputs.base_url && localInputs.base_url.endsWith('/')) {
localInputs.base_url = localInputs.base_url.slice( localInputs.base_url = localInputs.base_url.slice(
0, 0,
@@ -622,6 +625,21 @@ const EditChannel = () => {
/> />
</Form.Field> </Form.Field>
))} ))}
{inputs.type === 37 && (
<Form.Field>
<Form.Input
label='Account ID'
name='user_id'
required
placeholder={
'请输入 Account ID例如d8d7c61dbc334c32d3ced580e4bf42b4'
}
onChange={handleConfigChange}
value={config.user_id}
autoComplete=''
/>
</Form.Field>
)}
{inputs.type !== 33 && !isEdit && ( {inputs.type !== 33 && !isEdit && (
<Form.Checkbox <Form.Checkbox
checked={batch} checked={batch}

View File

@@ -97,9 +97,9 @@
} }
.settings-tab .active.item { .settings-tab .active.item {
color: #4318FF !important; color: #000 !important;
font-weight: 600 !important; font-weight: 600 !important;
border-color: #4318FF !important; border-color: #000 !important;
} }
.ui.tab.segment { .ui.tab.segment {

View File

@@ -1,19 +1,17 @@
import React, { useEffect, useState } from 'react'; import React, {useEffect, useState} from 'react';
import { useTranslation } from 'react-i18next'; import {useTranslation} from 'react-i18next';
import { Card, Grid, Header, Segment, Statistic } from 'semantic-ui-react'; import {Card, Grid} from 'semantic-ui-react';
import { API, showError } from '../../helpers';
import moment from 'moment';
import { import {
LineChart, Bar,
BarChart,
CartesianGrid,
Legend,
Line, Line,
LineChart,
ResponsiveContainer,
Tooltip,
XAxis, XAxis,
YAxis, YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
BarChart,
Bar,
Legend,
} from 'recharts'; } from 'recharts';
import axios from 'axios'; import axios from 'axios';
import './Dashboard.css'; import './Dashboard.css';
@@ -244,7 +242,7 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.requests.title')} {t('dashboard.charts.requests.title')}
<span className='stat-value'>{summaryData.todayRequests}</span> {/* <span className='stat-value'>{summaryData.todayRequests}</span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -273,7 +271,7 @@ const Dashboard = () => {
t('dashboard.charts.requests.tooltip'), t('dashboard.charts.requests.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -296,9 +294,9 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.quota.title')} {t('dashboard.charts.quota.title')}
<span className='stat-value'> {/* <span className='stat-value'>
${summaryData.todayQuota.toFixed(3)} ${summaryData.todayQuota.toFixed(3)}
</span> </span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -327,7 +325,7 @@ const Dashboard = () => {
t('dashboard.charts.quota.tooltip'), t('dashboard.charts.quota.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -350,7 +348,7 @@ const Dashboard = () => {
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
{t('dashboard.charts.tokens.title')} {t('dashboard.charts.tokens.title')}
<span className='stat-value'>{summaryData.todayTokens}</span> {/* <span className='stat-value'>{summaryData.todayTokens}</span> */}
</Card.Header> </Card.Header>
<div className='chart-container'> <div className='chart-container'>
<ResponsiveContainer <ResponsiveContainer
@@ -379,7 +377,7 @@ const Dashboard = () => {
t('dashboard.charts.tokens.tooltip'), t('dashboard.charts.tokens.tooltip'),
]} ]}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}`
} }
/> />
<Line <Line
@@ -424,7 +422,7 @@ const Dashboard = () => {
boxShadow: '0 2px 8px rgba(0,0,0,0.1)', boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
}} }}
labelFormatter={(label) => labelFormatter={(label) =>
`${t('dashboard.tooltip.date')}: ${formatDate(label)}` `${t('dashboard.statistics.tooltip.date')}: ${formatDate(label)}`
} }
/> />
<Legend <Legend