chore: fix typos (#2770)

This commit is contained in:
co63oc
2025-08-20 10:38:03 +08:00
committed by GitHub
parent eaea782693
commit 9186b5505d
4 changed files with 18 additions and 15 deletions

View File

@@ -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))
}
})
}

View File

@@ -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
```

View File

@@ -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)

View File

@@ -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},