fix: pre-download tiktoken encoding files in Dockerfile for offline support#2
Merged
cmcxn merged 1 commit intoJun 1, 2026
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
容器启动时
InitTokenEncoders()会从openaipublic.blob.core.windows.net下载 tiktoken 编码文件,在无外网环境下导致 FATAL 报错并退出。改动
builder2阶段用wget预下载两个编码文件,按 tiktoken-go 的缓存命名规则(SHA1(url))存入/tiktoken_cache/:cl100k_base.tiktoken(gpt-3.5-turbo / gpt-4)o200k_base.tiktoken(gpt-4o)/tiktoken_cache复制进最终 Alpine 镜像ENV TIKTOKEN_CACHE_DIR=/tiktoken_cache,tiktoken-go 启动时直接读取本地文件,跳过网络请求我已确认该 PR 已自测通过,相关截图如下:
(离线环境无网络访问,容器可正常启动,不再出现
failed to get gpt-3.5-turbo token encoderFATAL 错误)