From 984b0acba9e51e5bbea27f328eb4e94393d8b4ab Mon Sep 17 00:00:00 2001 From: Ryo Date: Wed, 29 Oct 2025 14:07:49 +0800 Subject: [PATCH] feat: if .venv python not found ues system python (#2404) --- backend/bizpkg/fileutil/pyutil.go | 7 ++++++- backend/go.mod | 2 +- backend/go.sum | 2 ++ backend/infra/es/impl/es/es8.go | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/bizpkg/fileutil/pyutil.go b/backend/bizpkg/fileutil/pyutil.go index b75e8a292..aeae99c8d 100644 --- a/backend/bizpkg/fileutil/pyutil.go +++ b/backend/bizpkg/fileutil/pyutil.go @@ -40,5 +40,10 @@ func GetPython3Path() string { return ".venv/bin/python3" } - return filepath.Join(cwd, ".venv/bin/python3") + filePath := filepath.Join(cwd, ".venv/bin/python3") + if _, err := os.Stat(filePath); err == nil { + return filePath + } + + return "python3" // use system python3 } diff --git a/backend/go.mod b/backend/go.mod index b01dfd839..15243ed15 100755 --- a/backend/go.mod +++ b/backend/go.mod @@ -33,7 +33,7 @@ require ( github.com/cloudwego/hertz v0.10.2 github.com/dimchansky/utfbom v1.1.1 github.com/elastic/go-elasticsearch/v7 v7.17.10 - github.com/elastic/go-elasticsearch/v8 v8.18.0 + github.com/elastic/go-elasticsearch/v8 v8.19.0 github.com/extrame/xls v0.0.1 github.com/getkin/kin-openapi v0.118.0 github.com/go-resty/resty/v2 v2.16.5 diff --git a/backend/go.sum b/backend/go.sum index c13a936f6..d4b5080cc 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -343,6 +343,8 @@ github.com/elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxx github.com/elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elastic/go-elasticsearch/v8 v8.18.0 h1:ANNq1h7DEiPUaALb8+5w3baQzaS08WfHV0DNzp0VG4M= github.com/elastic/go-elasticsearch/v8 v8.18.0/go.mod h1:WLqwXsJmQoYkoA9JBFeEwPkQhCfAZuUvfpdU/NvSSf0= +github.com/elastic/go-elasticsearch/v8 v8.19.0 h1:VmfBLNRORY7RZL+9hTxBD97ehl9H8Nxf2QigDh6HuMU= +github.com/elastic/go-elasticsearch/v8 v8.19.0/go.mod h1:F3j9e+BubmKvzvLjNui/1++nJuJxbkhHefbaT0kFKGY= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= diff --git a/backend/infra/es/impl/es/es8.go b/backend/infra/es/impl/es/es8.go index c2b2f1fe2..28f268898 100644 --- a/backend/infra/es/impl/es/es8.go +++ b/backend/infra/es/impl/es/es8.go @@ -243,8 +243,8 @@ func (c *es8Client) CreateIndex(ctx context.Context, index string, properties ma Properties: propertiesMap, }, Settings: &types.IndexSettings{ - NumberOfShards: getEnvDefaultIntSetting("ES_NUMBER_OF_SHARDS", "1"), - NumberOfReplicas: getEnvDefaultIntSetting("ES_NUMBER_OF_REPLICAS", "1"), + NumberOfShards: ptr.Of(getEnvDefaultIntSetting("ES_NUMBER_OF_SHARDS", "1")), + NumberOfReplicas: ptr.Of(getEnvDefaultIntSetting("ES_NUMBER_OF_REPLICAS", "1")), }, }).Do(ctx); err != nil { return err