diff --git a/backend/application/knowledge/init.go b/backend/application/knowledge/init.go index 0497fa04..10c17ba7 100644 --- a/backend/application/knowledge/init.go +++ b/backend/application/knowledge/init.go @@ -335,8 +335,11 @@ func getEmbedding(ctx context.Context) (embedding.Embedder, error) { var ( arkEmbeddingBaseURL = os.Getenv("ARK_EMBEDDING_BASE_URL") arkEmbeddingModel = os.Getenv("ARK_EMBEDDING_MODEL") - arkEmbeddingAK = os.Getenv("ARK_EMBEDDING_AK") - arkEmbeddingDims = os.Getenv("ARK_EMBEDDING_DIMS") + arkEmbeddingApiKey = os.Getenv("ARK_EMBEDDING_API_KEY") + // deprecated: use ARK_EMBEDDING_API_KEY instead + // ARK_EMBEDDING_AK will be removed in the future + arkEmbeddingAK = os.Getenv("ARK_EMBEDDING_AK") + arkEmbeddingDims = os.Getenv("ARK_EMBEDDING_DIMS") ) dims, err := strconv.ParseInt(arkEmbeddingDims, 10, 64) @@ -345,7 +348,12 @@ func getEmbedding(ctx context.Context) (embedding.Embedder, error) { } emb, err = arkemb.NewArkEmbedder(ctx, &ark.EmbeddingConfig{ - APIKey: arkEmbeddingAK, + APIKey: func() string { + if arkEmbeddingApiKey != "" { + return arkEmbeddingApiKey + } + return arkEmbeddingAK + }(), Model: arkEmbeddingModel, BaseURL: arkEmbeddingBaseURL, }, dims, batchSize) diff --git a/docker/.env.debug.example b/docker/.env.debug.example index e58c0a54..d0ef95ff 100644 --- a/docker/.env.debug.example +++ b/docker/.env.debug.example @@ -111,7 +111,7 @@ export OPENAI_EMBEDDING_REQUEST_DIMS=1024 # ark embedding export ARK_EMBEDDING_MODEL="" -export ARK_EMBEDDING_AK="" +export ARK_EMBEDDING_API_KEY="" export ARK_EMBEDDING_DIMS="2048" export ARK_EMBEDDING_BASE_URL="" diff --git a/docker/.env.example b/docker/.env.example index de116589..fbf0d86f 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -111,7 +111,7 @@ export OPENAI_EMBEDDING_REQUEST_DIMS=1024 # ark embedding export ARK_EMBEDDING_MODEL="" -export ARK_EMBEDDING_AK="" +export ARK_EMBEDDING_API_KEY="" export ARK_EMBEDDING_DIMS="2048" export ARK_EMBEDDING_BASE_URL=""