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
0e4f9e46
authored
Oct 22, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: able to set RELAY_TIMEOUT
parent
0c7b132d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletions
+11
-1
README.md
+1
-0
common/constants.go
+2
-0
controller/relay-text.go
+8
-1
No files found.
README.md
View file @
0e4f9e46
...
...
@@ -355,6 +355,7 @@ graph LR
14.
编码器缓存设置:
+
`TIKTOKEN_CACHE_DIR`
:默认程序启动时会联网下载一些通用的词元的编码,如:
`gpt-3.5-turbo`
,在一些网络环境不稳定,或者离线情况,可能会导致启动有问题,可以配置此目录缓存数据,可迁移到离线环境。
+
`DATA_GYM_CACHE_DIR`
:目前该配置作用与
`TIKTOKEN_CACHE_DIR`
一致,但是优先级没有它高。
15.
`RELAY_TIMEOUT`
:中继超时设置,单位为秒,默认不设置超时时间。
### 命令行参数
1.
`--port <port_number>`
: 指定服务器监听的端口号,默认为
`3000`
。
...
...
common/constants.go
View file @
0e4f9e46
...
...
@@ -95,6 +95,8 @@ var SyncFrequency = GetOrDefault("SYNC_FREQUENCY", 10*60) // unit is second
var
BatchUpdateEnabled
=
false
var
BatchUpdateInterval
=
GetOrDefault
(
"BATCH_UPDATE_INTERVAL"
,
5
)
var
RelayTimeout
=
GetOrDefault
(
"RELAY_TIMEOUT"
,
0
)
// unit is second
const
(
RequestIdKey
=
"X-Oneapi-Request-Id"
)
...
...
controller/relay-text.go
View file @
0e4f9e46
...
...
@@ -32,7 +32,14 @@ var httpClient *http.Client
var
impatientHTTPClient
*
http
.
Client
func
init
()
{
httpClient
=
&
http
.
Client
{}
if
common
.
RelayTimeout
==
0
{
httpClient
=
&
http
.
Client
{}
}
else
{
httpClient
=
&
http
.
Client
{
Timeout
:
time
.
Duration
(
common
.
RelayTimeout
)
*
time
.
Second
,
}
}
impatientHTTPClient
=
&
http
.
Client
{
Timeout
:
5
*
time
.
Second
,
}
...
...
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