MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / parseAIRequest

Function parseAIRequest

module/service/parse.go:97–115  ·  view source on GitHub ↗
(ori string)

Source from the content-addressed store, hash-verified

95}
96
97func parseAIRequest(ori string) string {
98 type aiRequest struct {
99 Messages []struct {
100 Role string `json:"role"`
101 Content string `json:"content"`
102 } `json:"messages"`
103 }
104 var req aiRequest
105 err := json.Unmarshal([]byte(ori), &req)
106 if err != nil {
107 return ori
108 }
109 size := len(req.Messages)
110 if size == 0 {
111 return ""
112 }
113
114 return req.Messages[size-1].Content
115}

Callers 1

AILogInfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected