diff --git a/hgctl/pkg/helm/object/objects_test.go b/hgctl/pkg/helm/object/objects_test.go index a91a75881..348ed8237 100644 --- a/hgctl/pkg/helm/object/objects_test.go +++ b/hgctl/pkg/helm/object/objects_test.go @@ -704,9 +704,9 @@ func TestK8sObject_ResolveK8sConflict(t *testing.T) { t.Run(tt.desc, func(t *testing.T) { newObj := tt.o1.ResolveK8sConflict() if !newObj.Equal(tt.o2) { - newObjjson, _ := newObj.JSON() - wantedObjjson, _ := tt.o2.JSON() - t.Errorf("Got: %s, want: %s", string(newObjjson), string(wantedObjjson)) + newObjJson, _ := newObj.JSON() + wantedObjJson, _ := tt.o2.JSON() + t.Errorf("Got: %s, want: %s", string(newObjJson), string(wantedObjJson)) } }) } diff --git a/plugins/wasm-go/extensions/api-workflow/README.md b/plugins/wasm-go/extensions/api-workflow/README.md index 9819b3688..775ad8b52 100644 --- a/plugins/wasm-go/extensions/api-workflow/README.md +++ b/plugins/wasm-go/extensions/api-workflow/README.md @@ -373,12 +373,12 @@ curl -v '127.0.0.1:8080' -H 'Accept: application/json, text/event-stream' -H [api-workflow] workflow exec task,source is start,target is A, body is {"input":{"texts":["higress项目主仓库的github地址是什么"]},"model":"text-embedding-v2","parameters":{"text_type":"query"}},header is [[Authorization Bearer sk-b98f4628125xxxxxxxxxxxxxxxx] [Content-Type application/json]] [api-workflow] workflow exec task,source is start,target is B, body is {"embeddings":"default","msg":"default request body","sk":"sk-xxxxxx"},header is [[AK ak-xxxxxxxxxxxxxxxxxxxx] [Content-Type application/json]] [api-workflow] workflow exec task,source is start,target is C, body is ,header is [] -[api-workflow] source is B,target is D,stauts is map[A:0 B:0 C:0 D:2 E:1] -[api-workflow] source is C,target is D,stauts is map[A:0 B:0 C:0 D:1 E:1] -[api-workflow] source is A,target is D,stauts is map[A:0 B:0 C:0 D:0 E:1] +[api-workflow] source is B,target is D,status is map[A:0 B:0 C:0 D:2 E:1] +[api-workflow] source is C,target is D,status is map[A:0 B:0 C:0 D:1 E:1] +[api-workflow] source is A,target is D,status is map[A:0 B:0 C:0 D:0 E:1] [api-workflow] workflow exec task,source is A,target is D, body is,header is [] [api-workflow] source is D,target is end,workflow is pass -[api-workflow] source is D,target is E,stauts is map[A:0 B:0 C:0 D:0 E:0] +[api-workflow] source is D,target is E,status is map[A:0 B:0 C:0 D:0 E:0] [api-workflow] workflow exec task,source is D,target is E, body is {"save":"{\"A_result\":0.007155838584362588,\"B_result\":\"this is b\",\"C_result\":\"this is c\"}"},header is [] [api-workflow] source is E,target is end,workflow is end ``` diff --git a/plugins/wasm-go/extensions/api-workflow/main.go b/plugins/wasm-go/extensions/api-workflow/main.go index 8e5f264f6..22a825ac0 100644 --- a/plugins/wasm-go/extensions/api-workflow/main.go +++ b/plugins/wasm-go/extensions/api-workflow/main.go @@ -255,7 +255,7 @@ func recursive(edge Edge, headers [][2]string, body []byte, depth uint32, config if next.Target != TaskContinue && next.Target != TaskEnd { nextStatus[next.Target] = nextStatus[next.Target] - 1 - log.Debugf("source is %s,target is %s,stauts is %v", next.Source, next.Target, nextStatus) + log.Debugf("source is %s,target is %s,status is %v", next.Source, next.Target, nextStatus) // 还有没执行完的边 if nextStatus[next.Target] > 0 { ctx.SetContext(WorkflowExecStatus, nextStatus) diff --git a/plugins/wasm-go/extensions/chatgpt-proxy/main.go b/plugins/wasm-go/extensions/chatgpt-proxy/main.go index 0a31c5d19..944b74d05 100644 --- a/plugins/wasm-go/extensions/chatgpt-proxy/main.go +++ b/plugins/wasm-go/extensions/chatgpt-proxy/main.go @@ -29,7 +29,7 @@ type MyConfig struct { ApiKey string PromptParam string ChatgptPath string - HumainId string + HumanId string AIId string client wrapper.HttpClient } @@ -69,9 +69,12 @@ func parseConfig(json gjson.Result, config *MyConfig, log log.Log) error { if config.PromptParam == "" { config.PromptParam = "prompt" } - config.HumainId = json.Get("HumainId").String() - if config.HumainId == "" { - config.HumainId = "Humain:" + config.HumanId = json.Get("HumanId").String() + if config.HumanId == "" { + config.HumanId = json.Get("HumainId").String() // for compatible + } + if config.HumanId == "" { + config.HumanId = "Human:" } config.AIId = json.Get("AIId").String() if config.AIId == "" { @@ -100,18 +103,18 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config MyConfig, log log.Log) proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.empty_query_string", nil, []byte("1-need prompt param"), -1) return types.ActionContinue } - querys, err := url.ParseQuery(pairs[1]) + queries, err := url.ParseQuery(pairs[1]) if err != nil { proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.bad_query_string", nil, []byte("2-need prompt param"), -1) return types.ActionContinue } var prompt []string var ok bool - if prompt, ok = querys[config.PromptParam]; !ok || len(prompt) == 0 { + if prompt, ok = queries[config.PromptParam]; !ok || len(prompt) == 0 { proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.no_prompt", nil, []byte("3-need prompt param"), -1) return types.ActionContinue } - body := fmt.Sprintf(bodyTemplate, config.Model, prompt[0], config.HumainId, config.AIId) + body := fmt.Sprintf(bodyTemplate, config.Model, prompt[0], config.HumanId, config.AIId) err = config.client.Post(config.ChatgptPath, [][2]string{ {"Content-Type", "application/json"}, {"Authorization", "Bearer " + config.ApiKey},