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

Function extractResponsesAPIContent

sdk/cliproxy/auth/selector.go:804–822  ·  view source on GitHub ↗
(content gjson.Result)

Source from the content-addressed store, hash-verified

802}
803
804func extractResponsesAPIContent(content gjson.Result) string {
805 if !content.IsArray() {
806 return ""
807 }
808 var texts []string
809 content.ForEach(func(_, part gjson.Result) bool {
810 partType := part.Get("type").String()
811 if partType == "input_text" || partType == "output_text" || partType == "text" {
812 if text := part.Get("text").String(); text != "" {
813 texts = append(texts, text)
814 }
815 }
816 return true
817 })
818 if len(texts) > 0 {
819 return strings.Join(texts, " ")
820 }
821 return ""
822}
823
824// extractSessionID is kept for backward compatibility.
825// Deprecated: Use ExtractSessionID instead.

Callers 1

extractMessageHashIDsFunction · 0.85

Calls 2

StringMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected