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
c3d4de67
authored
Dec 16, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
be5ed916
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
61 deletions
+4
-61
README.md
+4
-0
i18n/en.json
+0
-0
i18n/translate.py
+0
-61
No files found.
README.md
View file @
c3d4de67
...
@@ -170,6 +170,10 @@ docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:1234
...
@@ -170,6 +170,10 @@ docker run --name new-api -d --restart always -p 3000:3000 -e SQL_DSN="root:1234
-
[
chatnio
](
https://github.com/Deeptrain-Community/chatnio
)
:下一代 AI 一站式 B/C 端解决方案
-
[
chatnio
](
https://github.com/Deeptrain-Community/chatnio
)
:下一代 AI 一站式 B/C 端解决方案
-
[
neko-api-key-tool
](
https://github.com/Calcium-Ion/neko-api-key-tool
)
:用key查询使用额度
-
[
neko-api-key-tool
](
https://github.com/Calcium-Ion/neko-api-key-tool
)
:用key查询使用额度
其他基于New API的项目:
-
[
new-api-horizon
](
https://github.com/Calcium-Ion/new-api-horizon
)
:New API高性能优化版,并支持Claude格式
-
[
VoAPI
](
https://github.com/VoAPI/VoAPI
)
:基于New API的闭源项目
## 🌟 Star History
## 🌟 Star History
[

](https://star-history.com/#Calcium-Ion/new-api&Date)
[

](https://star-history.com/#Calcium-Ion/new-api&Date)
i18n/en.json
deleted
100644 → 0
View file @
be5ed916
This diff is collapsed.
Click to expand it.
i18n/translate.py
deleted
100644 → 0
View file @
be5ed916
import
argparse
import
json
import
os
def
list_file_paths
(
path
):
file_paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
if
"node_modules"
in
dirs
:
dirs
.
remove
(
"node_modules"
)
if
"build"
in
dirs
:
dirs
.
remove
(
"build"
)
if
"i18n"
in
dirs
:
dirs
.
remove
(
"i18n"
)
for
file
in
files
:
file_path
=
os
.
path
.
join
(
root
,
file
)
if
file_path
.
endswith
(
"png"
)
or
file_path
.
endswith
(
"ico"
)
or
file_path
.
endswith
(
"db"
)
or
file_path
.
endswith
(
"exe"
):
continue
file_paths
.
append
(
file_path
)
for
dir
in
dirs
:
dir_path
=
os
.
path
.
join
(
root
,
dir
)
file_paths
+=
list_file_paths
(
dir_path
)
return
file_paths
def
replace_keys_in_repository
(
repo_path
,
json_file_path
):
with
open
(
json_file_path
,
'r'
,
encoding
=
"utf-8"
)
as
json_file
:
key_value_pairs
=
json
.
load
(
json_file
)
pairs
=
[]
for
key
,
value
in
key_value_pairs
.
items
():
pairs
.
append
((
key
,
value
))
pairs
.
sort
(
key
=
lambda
x
:
len
(
x
[
0
]),
reverse
=
True
)
files
=
list_file_paths
(
repo_path
)
print
(
'Total files: {}'
.
format
(
len
(
files
)))
for
file_path
in
files
:
replace_keys_in_file
(
file_path
,
pairs
)
def
replace_keys_in_file
(
file_path
,
pairs
):
try
:
with
open
(
file_path
,
'r'
,
encoding
=
"utf-8"
)
as
file
:
content
=
file
.
read
()
for
key
,
value
in
pairs
:
content
=
content
.
replace
(
key
,
value
)
with
open
(
file_path
,
'w'
,
encoding
=
"utf-8"
)
as
file
:
file
.
write
(
content
)
except
UnicodeDecodeError
:
print
(
'UnicodeDecodeError: {}'
.
format
(
file_path
))
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'Replace keys in repository.'
)
parser
.
add_argument
(
'--repository_path'
,
help
=
'Path to repository'
)
parser
.
add_argument
(
'--json_file_path'
,
help
=
'Path to JSON file'
)
args
=
parser
.
parse_args
()
replace_keys_in_repository
(
args
.
repository_path
,
args
.
json_file_path
)
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