MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / parseResponsesResponse

Function parseResponsesResponse

cmd/inject-cli/main.go:1066–1093  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

1064}
1065
1066func parseResponsesResponse(raw string) {
1067 output := gjson.Get(raw,"output")
1068 if output.Exists() && output.IsArray() {
1069 for _, item := range output.Array() {
1070 itemType := item.Get("type").String()
1071 switch itemType {
1072 case "message":
1073 content := item.Get("content")
1074 if content.IsArray() {
1075 for _, c := range content.Array() {
1076 text := c.Get("text").String()
1077 if text != "" {
1078 fmt.Printf(" \033[36massistant:\033[0m %s\n", truncate(text, 200))
1079 }
1080 }
1081 }
1082 case "function_call":
1083 name := item.Get("name").String()
1084 args := item.Get("arguments").String()
1085 fmt.Printf(" \033[36m[function_call: %s]\033[0m %s\n", name, truncate(args, 150))
1086 default:
1087 fmt.Printf(" \033[36m[%s]\033[0m %s\n", itemType, truncate(item.Raw, 100))
1088 }
1089 }
1090 return
1091 }
1092 printTruncated(raw, 500)
1093}
1094
1095// helpers for observe parsing
1096

Callers 1

printObserveEventFunction · 0.70

Calls 4

printTruncatedFunction · 0.85
truncateFunction · 0.70
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected