-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix log error handle and db bugs (#85)
* fix db and test case * fix log error handle * chore: clean code * update docs
- Loading branch information
Showing
17 changed files
with
882 additions
and
816 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,58 @@ | ||
# 示例与解释见 .env.example | ||
# Sample and explanation can be found in .env.example | ||
|
||
# `LOG_CHAT`: 是否记录日志 | ||
#LOG_CHAT=true | ||
# `LOG_CHAT`: Whether to log the chat | ||
LOG_CHAT=true | ||
|
||
CACHE_CHAT_COMPLETION=true | ||
#CACHE_CHAT_COMPLETION=true | ||
|
||
# `CACHE_BACKEND`: MEMORY, LMDB, ROCKSDB, LevelDB | ||
# `CACHE_BACKEND`: Options (MEMORY, LMDB, ROCKSDB, LevelDB) | ||
CACHE_BACKEND=MEMORY | ||
|
||
#BENCHMARK_MODE=true | ||
|
||
# `OPENAI_BASE_URL`: 转发openai风格的任何服务地址,允许指定多个, 以逗号隔开。 | ||
# 如果指定超过一个,则任何OPENAI_ROUTE_PREFIX/EXTRA_ROUTE_PREFIX都不能为根路由/ | ||
#OPENAI_BASE_URL=https://api.openai-forward.com | ||
# `OPENAI_BASE_URL`: Forward any service address in the style of OpenAI; multiple can be specified, separated by commas. | ||
# If more than one is specified, neither OPENAI_ROUTE_PREFIX nor EXTRA_ROUTE_PREFIX can be the root route/ | ||
OPENAI_BASE_URL=https://api.openai.com | ||
|
||
# `OPENAI_ROUTE_PREFIX`: 可指定所有openai风格(为记录日志)服务的转发路由前缀 | ||
OPENAI_ROUTE_PREFIX= | ||
# `OPENAI_ROUTE_PREFIX`: Specify the forwarding route prefix for all services in OpenAI style (for logging purposes) | ||
#OPENAI_ROUTE_PREFIX= | ||
|
||
OPENAI_API_KEY= | ||
FORWARD_KEY= | ||
#OPENAI_API_KEY= | ||
#FORWARD_KEY= | ||
|
||
CHAT_COMPLETION_ROUTE=/v1/chat/completions | ||
COMPLETION_ROUTE=/v1/completions | ||
|
||
# `EXTRA_BASE_URL`: 可指定任意服务转发 | ||
EXTRA_BASE_URL= | ||
# `EXTRA_ROUTE_PREFIX`: 与 EXTRA_BASE_URL 匹配的路由前缀 | ||
EXTRA_ROUTE_PREFIX= | ||
# `EXTRA_BASE_URL`: Specify any service for forwarding | ||
#EXTRA_BASE_URL= | ||
# `EXTRA_ROUTE_PREFIX`: Route prefix matching EXTRA_BASE_URL | ||
#EXTRA_ROUTE_PREFIX= | ||
|
||
# `REQ_RATE_LIMIT`: i.e. 对指定路由的请求速率限制, 区分用户 | ||
# `REQ_RATE_LIMIT`: i.e., Request rate limit for specified routes, user specific | ||
# format: {route: ratelimit-string} | ||
# ratelimit-string format [count] [per|/] [n (optional)] [second|minute|hour|day|month|year] :ref:`ratelimit-string`: https://limits.readthedocs.io/en/stable/quickstart.html#rate-limit-string-notation | ||
REQ_RATE_LIMIT={"/v1/chat/completions":"100/2minutes", "/v1/completions":"60/minute;600/hour"} | ||
|
||
# rate limit后端: [memory, redis, memcached, ...] :ref: https://limits.readthedocs.io/en/stable/storage.html# | ||
# Backend for rate limiting: [memory, redis, memcached, ...] :ref: https://limits.readthedocs.io/en/stable/storage.html# | ||
#REQ_RATE_LIMIT_BACKEND=redis://localhost:6379 | ||
|
||
# `GLOBAL_RATE_LIMIT`: 限制所有`REQ_RATE_LIMIT`没有指定的路由. 不填默认无限制 | ||
# `GLOBAL_RATE_LIMIT`: Limits all routes not specified by `REQ_RATE_LIMIT`. If not set, there's no limit by default. | ||
GLOBAL_RATE_LIMIT=100/minute | ||
|
||
#`RATE_LIMIT_STRATEGY` Options: (fixed-window, fixed-window-elastic-expiry, moving-window) :ref: https://limits.readthedocs.io/en/latest/strategies.html | ||
# `fixed-window`: most memory efficient strategy; `moving-window`:most effective for preventing bursts but higher memory cost. | ||
# `fixed-window`: most memory efficient strategy; `moving-window`:most effective for preventing bursts but has higher memory cost. | ||
RATE_LIMIT_STRATEGY=moving-window | ||
|
||
# 返回的token速率限制 | ||
# Rate limit for returned tokens | ||
TOKEN_RATE_LIMIT={"/v1/chat/completions":"60/second","/v1/completions":"60/second"} | ||
|
||
|
||
# TCP连接的超时时间(秒) | ||
# TCP connection timeout duration (in seconds) | ||
TIMEOUT=6 | ||
|
||
ITER_CHUNK_TYPE=one-by-one | ||
#ITER_CHUNK_TYPE=efficiency | ||
|
||
IP_BLACKLIST= | ||
#IP_BLACKLIST= | ||
|
||
# 设定时区 | ||
# Set timezone | ||
TZ=Asia/Shanghai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
config.yaml | ||
lite_example |
Oops, something went wrong.