Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
607358c9
authored
Oct 31, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善令牌界面
parent
4a4ce233
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
38 deletions
+44
-38
README.md
+12
-0
web/public/index.html
+2
-3
web/src/components/LogsTable.js
+5
-15
web/src/components/SiderBar.js
+3
-3
web/src/components/TokensTable.js
+0
-0
web/src/helpers/utils.js
+12
-11
web/src/pages/Token/index.js
+10
-6
No files found.
README.md
View file @
607358c9
# Neko API
# Neko API
> **Note**
> 本项目为开源项目,在[One API](https://github.com/songquanpeng/one-api)的基础上进行二次开发,感谢原作者的无私奉献。
> 使用者必须在遵循 OpenAI 的[使用条款](https://openai.com/policies/terms-of-use)以及**法律法规**的情况下使用,不得用于非法用途。
> **Warning**
> 本项目为个人学习使用,不保证稳定性,且不提供任何技术支持,使用者必须在遵循 OpenAI 的使用条款以及法律法规的情况下使用,不得用于非法用途。
> 根据[《生成式人工智能服务管理暂行办法》](http://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。
> **Note**
> 最新版Docker镜像 calciumion/neko-api:main
\ No newline at end of file
web/public/index.html
View file @
607358c9
...
@@ -6,10 +6,9 @@
...
@@ -6,10 +6,9 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<meta
name=
"theme-color"
content=
"#ffffff"
/>
<meta
name=
"theme-color"
content=
"#ffffff"
/>
<meta
name=
"description"
<meta
name=
"description"
content=
"Neko API,企业级AI接口调用平台,专为企业级需求打造,提供高性能、高并发、高可用的服务,一站式处理大规模数据和复杂任务。我们的稳定高并发处理能力和高可用性保证您的业务流畅运行,结合OpenAI、Claude、Midjourney等AI接口和专业的技术支持,为您的企业快速部署和实现AI接口应用,释放商业价值"
/>
content=
"NekoAPI,企业级AI接口调用平台,专为企业级需求打造,提供高性能、高并发、高可用的服务,一站式处理大规模数据和复杂任务。我们的稳定高并发处理能力和高可用性保证您的业务流畅运行,结合OpenAI、Claude、Midjourney等AI接口和专业的技术支持,为您的企业快速部署和实现AI接口应用,释放商业价值"
/>
<title>
Neko API
</title>
<meta
name=
"keywords"
content=
"Neko API,OpenAI,Claude,Midjourney,高并发,高可用,高性能,企业级AI接口调用平台"
/>
<meta
name=
"keywords"
content=
"Neko API,OpenAI,Claude,Midjourney,高并发,高可用,高性能,企业级AI接口调用平台"
/>
<title>
Neko
API
</title>
<title>
NekoAPI
</title>
</head>
</head>
<body>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
...
...
web/src/components/LogsTable.js
View file @
607358c9
...
@@ -20,7 +20,7 @@ import {
...
@@ -20,7 +20,7 @@ import {
}
from
'@douyinfe/semi-icons'
;
}
from
'@douyinfe/semi-icons'
;
const
{
Sider
,
Content
,
Header
}
=
Layout
;
const
{
Sider
,
Content
,
Header
}
=
Layout
;
const
{
Column
}
=
Table
;
const
{
Column
}
=
Table
;
function
renderTimestamp
(
timestamp
)
{
function
renderTimestamp
(
timestamp
)
{
...
@@ -65,13 +65,13 @@ const LogsTable = () => {
...
@@ -65,13 +65,13 @@ const LogsTable = () => {
{
{
title
:
'渠道'
,
title
:
'渠道'
,
dataIndex
:
'channel'
,
dataIndex
:
'channel'
,
className
:
isAdmin
()
?
'tableShow'
:
'tableHiddle'
,
className
:
isAdmin
()
?
'tableShow'
:
'tableHiddle'
,
render
:
(
text
,
record
,
index
)
=>
{
render
:
(
text
,
record
,
index
)
=>
{
return
(
return
(
isAdminUser
?
isAdminUser
?
record
.
type
===
0
||
record
.
type
===
2
?
record
.
type
===
0
||
record
.
type
===
2
?
<
div
>
<
div
>
{
<
Tag
color
=
{
colors
[
parseInt
(
text
)
%
10
]
}
size
=
'large'
>
{
text
}
<
/Tag>
}
{
<
Tag
color
=
{
stringToColor
(
text
)
}
size
=
'large'
>
{
text
}
<
/Tag>
}
<
/div
>
<
/div
>
:
:
<><
/
>
<><
/
>
...
@@ -83,7 +83,7 @@ const LogsTable = () => {
...
@@ -83,7 +83,7 @@ const LogsTable = () => {
{
{
title
:
'用户'
,
title
:
'用户'
,
dataIndex
:
'username'
,
dataIndex
:
'username'
,
className
:
isAdmin
()
?
'tableShow'
:
'tableHiddle'
,
className
:
isAdmin
()
?
'tableShow'
:
'tableHiddle'
,
render
:
(
text
,
record
,
index
)
=>
{
render
:
(
text
,
record
,
index
)
=>
{
return
(
return
(
isAdminUser
?
isAdminUser
?
...
@@ -291,15 +291,6 @@ const LogsTable = () => {
...
@@ -291,15 +291,6 @@ const LogsTable = () => {
const
pageData
=
logs
.
slice
((
activePage
-
1
)
*
ITEMS_PER_PAGE
,
activePage
*
ITEMS_PER_PAGE
);
const
pageData
=
logs
.
slice
((
activePage
-
1
)
*
ITEMS_PER_PAGE
,
activePage
*
ITEMS_PER_PAGE
);
// const onPaginationChange = (e, { activePage }) => {
// (async () => {
// if (activePage === Math.ceil(logs.length / ITEMS_PER_PAGE) + 1) {
// // In this case we have to load more data and then append them.
// await loadLogs(activePage - 1);
// }
// setActivePage(activePage);
// })();
// };
const
handlePageChange
=
page
=>
{
const
handlePageChange
=
page
=>
{
setActivePage
(
page
);
setActivePage
(
page
);
if
(
page
===
Math
.
ceil
(
logs
.
length
/
ITEMS_PER_PAGE
)
+
1
)
{
if
(
page
===
Math
.
ceil
(
logs
.
length
/
ITEMS_PER_PAGE
)
+
1
)
{
...
@@ -307,7 +298,6 @@ const LogsTable = () => {
...
@@ -307,7 +298,6 @@ const LogsTable = () => {
loadLogs
(
page
-
1
).
then
(
r
=>
{
loadLogs
(
page
-
1
).
then
(
r
=>
{
});
});
}
}
// setLoading(false);
};
};
const
refresh
=
async
()
=>
{
const
refresh
=
async
()
=>
{
...
@@ -405,7 +395,7 @@ const LogsTable = () => {
...
@@ -405,7 +395,7 @@ const LogsTable = () => {
<
/
>
<
/
>
}
}
<
Form
.
Section
>
<
Form
.
Section
>
<
Button
label
=
'
操作
'
type
=
"primary"
htmlType
=
"submit"
className
=
"btn-margin-right"
<
Button
label
=
'
查询
'
type
=
"primary"
htmlType
=
"submit"
className
=
"btn-margin-right"
onClick
=
{
refresh
}
>
查询
<
/Button
>
onClick
=
{
refresh
}
>
查询
<
/Button
>
<
/Form.Section
>
<
/Form.Section
>
<
/
>
<
/
>
...
...
web/src/components/SiderBar.js
View file @
607358c9
...
@@ -34,7 +34,7 @@ let headerButtons = [
...
@@ -34,7 +34,7 @@ let headerButtons = [
itemKey
:
'channel'
,
itemKey
:
'channel'
,
to
:
'/channel'
,
to
:
'/channel'
,
icon
:
<
IconLayers
/>
,
icon
:
<
IconLayers
/>
,
admin
:
true
className
:
isAdmin
()?
'semi-navigation-item-normal'
:
'tableHiddle'
,
},
},
{
{
...
@@ -48,7 +48,7 @@ let headerButtons = [
...
@@ -48,7 +48,7 @@ let headerButtons = [
itemKey
:
'redemption'
,
itemKey
:
'redemption'
,
to
:
'/redemption'
,
to
:
'/redemption'
,
icon
:
<
IconGift
/>
,
icon
:
<
IconGift
/>
,
admin
:
true
className
:
isAdmin
()?
'semi-navigation-item-normal'
:
'tableHiddle'
,
},
},
{
{
text
:
'钱包'
,
text
:
'钱包'
,
...
@@ -61,7 +61,7 @@ let headerButtons = [
...
@@ -61,7 +61,7 @@ let headerButtons = [
itemKey
:
'user'
,
itemKey
:
'user'
,
to
:
'/user'
,
to
:
'/user'
,
icon
:
<
IconUser
/>
,
icon
:
<
IconUser
/>
,
admin
:
true
className
:
isAdmin
()?
'semi-navigation-item-normal'
:
'tableHiddle'
,
},
},
{
{
text
:
'日志'
,
text
:
'日志'
,
...
...
web/src/components/TokensTable.js
View file @
607358c9
This diff is collapsed.
Click to expand it.
web/src/helpers/utils.js
View file @
607358c9
import
{
toast
}
from
'react-toastify
'
;
import
{
Toast
}
from
'@douyinfe/semi-ui
'
;
import
{
toastConstants
}
from
'../constants'
;
import
{
toastConstants
}
from
'../constants'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
toast
}
from
"react-toastify"
;
const
HTMLToastContent
=
({
htmlContent
})
=>
{
const
HTMLToastContent
=
({
htmlContent
})
=>
{
return
<
div
dangerouslySetInnerHTML
=
{{
__html
:
htmlContent
}}
/>
;
return
<
div
dangerouslySetInnerHTML
=
{{
__html
:
htmlContent
}}
/>
;
...
@@ -81,42 +82,42 @@ export function showError(error) {
...
@@ -81,42 +82,42 @@ export function showError(error) {
window
.
location
.
href
=
'/login?expired=true'
;
window
.
location
.
href
=
'/login?expired=true'
;
break
;
break
;
case
429
:
case
429
:
toast
.
error
(
'错误:请求次数过多,请稍后再试!'
,
showErrorOptions
);
Toast
.
error
(
'错误:请求次数过多,请稍后再试!'
);
break
;
break
;
case
500
:
case
500
:
toast
.
error
(
'错误:服务器内部错误,请联系管理员!'
,
showErrorOptions
);
Toast
.
error
(
'错误:服务器内部错误,请联系管理员!'
);
break
;
break
;
case
405
:
case
405
:
t
oast
.
info
(
'本站仅作演示之用,无服务端!'
);
T
oast
.
info
(
'本站仅作演示之用,无服务端!'
);
break
;
break
;
default
:
default
:
toast
.
error
(
'错误:'
+
error
.
message
,
showErrorOptions
);
Toast
.
error
(
'错误:'
+
error
.
message
);
}
}
return
;
return
;
}
}
toast
.
error
(
'错误:'
+
error
.
message
,
showErrorOptions
);
Toast
.
error
(
'错误:'
+
error
.
message
);
}
else
{
}
else
{
toast
.
error
(
'错误:'
+
error
,
showErrorOptions
);
Toast
.
error
(
'错误:'
+
error
);
}
}
}
}
export
function
showWarning
(
message
)
{
export
function
showWarning
(
message
)
{
toast
.
warn
(
message
,
showWarningOptions
);
Toast
.
warning
(
message
);
}
}
export
function
showSuccess
(
message
)
{
export
function
showSuccess
(
message
)
{
toast
.
success
(
message
,
showSuccessOptions
);
Toast
.
success
(
message
);
}
}
export
function
showInfo
(
message
)
{
export
function
showInfo
(
message
)
{
toast
.
info
(
message
,
showInfoOptions
);
Toast
.
info
(
message
);
}
}
export
function
showNotice
(
message
,
isHTML
=
false
)
{
export
function
showNotice
(
message
,
isHTML
=
false
)
{
if
(
isHTML
)
{
if
(
isHTML
)
{
toast
(
<
HTMLToastContent
htmlContent
=
{
message
}
/>, showNoticeOptions
)
;
toast
(
<
HTMLToastContent
htmlContent
=
{
message
}
/>, showNoticeOptions
)
;
}
else
{
}
else
{
toast
.
info
(
message
,
showNoticeOptions
);
Toast
.
info
(
message
);
}
}
}
}
...
...
web/src/pages/Token/index.js
View file @
607358c9
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Segment
,
Header
}
from
'semantic-ui-react'
;
import
TokensTable
from
'../../components/TokensTable'
;
import
TokensTable
from
'../../components/TokensTable'
;
import
{
Layout
}
from
"@douyinfe/semi-ui"
;
const
{
Content
,
Header
}
=
Layout
;
const
Token
=
()
=>
(
const
Token
=
()
=>
(
<>
<>
<
Segment
>
<
Layout
>
<
Header
as
=
'h3'
>
我的令牌
<
/Header
>
<
Header
>
<
TokensTable
/>
<
h3
>
我的令牌
<
/h3
>
<
/Segment
>
<
/Header
>
<
Content
>
<
TokensTable
/>
<
/Content
>
<
/Layout
>
<
/
>
<
/
>
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment