mirror of
https://github.com/alibaba/higress.git
synced 2026-06-26 02:35:02 +08:00
chore: fix typos (#2770)
This commit is contained in:
@@ -704,9 +704,9 @@ func TestK8sObject_ResolveK8sConflict(t *testing.T) {
|
|||||||
t.Run(tt.desc, func(t *testing.T) {
|
t.Run(tt.desc, func(t *testing.T) {
|
||||||
newObj := tt.o1.ResolveK8sConflict()
|
newObj := tt.o1.ResolveK8sConflict()
|
||||||
if !newObj.Equal(tt.o2) {
|
if !newObj.Equal(tt.o2) {
|
||||||
newObjjson, _ := newObj.JSON()
|
newObjJson, _ := newObj.JSON()
|
||||||
wantedObjjson, _ := tt.o2.JSON()
|
wantedObjJson, _ := tt.o2.JSON()
|
||||||
t.Errorf("Got: %s, want: %s", string(newObjjson), string(wantedObjjson))
|
t.Errorf("Got: %s, want: %s", string(newObjJson), string(wantedObjJson))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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 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] 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 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,stauts is map[A:0 B:0 C:0 D:1 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,stauts is map[A:0 B:0 C:0 D:0 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] 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 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] 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
|
[api-workflow] source is E,target is end,workflow is end
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ func recursive(edge Edge, headers [][2]string, body []byte, depth uint32, config
|
|||||||
if next.Target != TaskContinue && next.Target != TaskEnd {
|
if next.Target != TaskContinue && next.Target != TaskEnd {
|
||||||
|
|
||||||
nextStatus[next.Target] = nextStatus[next.Target] - 1
|
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 {
|
if nextStatus[next.Target] > 0 {
|
||||||
ctx.SetContext(WorkflowExecStatus, nextStatus)
|
ctx.SetContext(WorkflowExecStatus, nextStatus)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ type MyConfig struct {
|
|||||||
ApiKey string
|
ApiKey string
|
||||||
PromptParam string
|
PromptParam string
|
||||||
ChatgptPath string
|
ChatgptPath string
|
||||||
HumainId string
|
HumanId string
|
||||||
AIId string
|
AIId string
|
||||||
client wrapper.HttpClient
|
client wrapper.HttpClient
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,12 @@ func parseConfig(json gjson.Result, config *MyConfig, log log.Log) error {
|
|||||||
if config.PromptParam == "" {
|
if config.PromptParam == "" {
|
||||||
config.PromptParam = "prompt"
|
config.PromptParam = "prompt"
|
||||||
}
|
}
|
||||||
config.HumainId = json.Get("HumainId").String()
|
config.HumanId = json.Get("HumanId").String()
|
||||||
if config.HumainId == "" {
|
if config.HumanId == "" {
|
||||||
config.HumainId = "Humain:"
|
config.HumanId = json.Get("HumainId").String() // for compatible
|
||||||
|
}
|
||||||
|
if config.HumanId == "" {
|
||||||
|
config.HumanId = "Human:"
|
||||||
}
|
}
|
||||||
config.AIId = json.Get("AIId").String()
|
config.AIId = json.Get("AIId").String()
|
||||||
if config.AIId == "" {
|
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)
|
proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.empty_query_string", nil, []byte("1-need prompt param"), -1)
|
||||||
return types.ActionContinue
|
return types.ActionContinue
|
||||||
}
|
}
|
||||||
querys, err := url.ParseQuery(pairs[1])
|
queries, err := url.ParseQuery(pairs[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.bad_query_string", nil, []byte("2-need prompt param"), -1)
|
proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.bad_query_string", nil, []byte("2-need prompt param"), -1)
|
||||||
return types.ActionContinue
|
return types.ActionContinue
|
||||||
}
|
}
|
||||||
var prompt []string
|
var prompt []string
|
||||||
var ok bool
|
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)
|
proxywasm.SendHttpResponseWithDetail(http.StatusBadRequest, "chatgpt-proxy.no_prompt", nil, []byte("3-need prompt param"), -1)
|
||||||
return types.ActionContinue
|
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{
|
err = config.client.Post(config.ChatgptPath, [][2]string{
|
||||||
{"Content-Type", "application/json"},
|
{"Content-Type", "application/json"},
|
||||||
{"Authorization", "Bearer " + config.ApiKey},
|
{"Authorization", "Bearer " + config.ApiKey},
|
||||||
|
|||||||
Reference in New Issue
Block a user