From 14a97da33084c57eecafd543cd25bb7c859ba47a Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 14 Feb 2024 22:01:27 +0800 Subject: [PATCH] Update API mirror URL and fix test case --- .github/workflows/pr-test.yml | 4 ++-- .github/workflows/unit-test.yml | 4 ++-- pipe/pipe_test.go | 2 ++ utils/json/json.go | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 8c7d2817..81035241 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -40,7 +40,7 @@ env: OPENAI_TEST_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_SECRET: ${{ secrets.OPENAI_TEST_KEY }} - TEST_MOAPI_MIRROR: https://api.openai.com/v1 + TEST_MOAPI_MIRROR: https://api.openai.com TAB_NAME: "::PET ADMIN" PAGE_SIZE: "20" @@ -167,7 +167,7 @@ jobs: with: repository: yaoapp/page-builder-app token: ${{ secrets.YAO_TEST_TOKEN }} - path: page-builder-app + path: page-builder-app - name: Checkout Extension uses: actions/checkout@v3 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 10c88275..51261762 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -44,7 +44,7 @@ env: OPENAI_TEST_KEY: ${{ secrets.OPENAI_TEST_KEY }} TEST_MOAPI_SECRET: ${{ secrets.OPENAI_TEST_KEY }} - TEST_MOAPI_MIRROR: https://api.openai.com/v1 + TEST_MOAPI_MIRROR: https://api.openai.com TAB_NAME: "::PET ADMIN" PAGE_SIZE: "20" @@ -59,7 +59,7 @@ env: YAO_TEST_APPLICATION: ${{ github.WORKSPACE }}/../app YAO_EXTENSION_ROOT: ${{ github.WORKSPACE }}/../extension YAO_TEST_BUILDER_APPLICATION: ${{ github.WORKSPACE }}/../page-builder-app - + ## Runtime YAO_RUNTIME_MIN: 3 YAO_RUNTIME_MAX: 6 diff --git a/pipe/pipe_test.go b/pipe/pipe_test.go index 54ef7e9e..27a4f20b 100644 --- a/pipe/pipe_test.go +++ b/pipe/pipe_test.go @@ -2,6 +2,7 @@ package pipe import ( "context" + "fmt" "os" "testing" "time" @@ -51,6 +52,7 @@ func TestRun(t *testing.T) { func prepare(t *testing.T) { test.Prepare(t, config.Conf) mirror := os.Getenv("TEST_MOAPI_MIRROR") + fmt.Println(mirror) secret := os.Getenv("TEST_MOAPI_SECRET") share.App = share.AppInfo{ Moapi: share.Moapi{Channel: "stable", Mirrors: []string{mirror}, Secret: secret}, diff --git a/utils/json/json.go b/utils/json/json.go index 2af2b66e..48904231 100644 --- a/utils/json/json.go +++ b/utils/json/json.go @@ -8,8 +8,11 @@ import ( // **Warning** This process under developing, do not use it func ProcessValidate(process *process.Process) interface{} { process.ValidateArgNums(2) - data := process.ArgsMap(0, map[string]interface{}{}).Dot() + if _, ok := process.Args[0].(map[string]interface{}); !ok { + return false + } + data := process.ArgsMap(0, map[string]interface{}{}).Dot() rules := process.ArgsRecords(1) for _, rule := range rules { for method, value := range rule {