MCPcopy
hub / github.com/QuantumNous/new-api / decodeListModelsResponse

Function decodeListModelsResponse

controller/model_list_test.go:126–140  ·  view source on GitHub ↗
(t *testing.T, recorder *httptest.ResponseRecorder)

Source from the content-addressed store, hash-verified

124}
125
126func decodeListModelsResponse(t *testing.T, recorder *httptest.ResponseRecorder) map[string]struct{} {
127 t.Helper()
128
129 require.Equal(t, http.StatusOK, recorder.Code)
130 var payload listModelsResponse
131 require.NoError(t, common.Unmarshal(recorder.Body.Bytes(), &payload))
132 require.True(t, payload.Success)
133 require.Equal(t, "list", payload.Object)
134
135 ids := make(map[string]struct{}, len(payload.Data))
136 for _, item := range payload.Data {
137 ids[item.Id] = struct{}{}
138 }
139 return ids
140}
141
142func pricingByModelName(pricings []model.Pricing) map[string]model.Pricing {
143 byName := make(map[string]model.Pricing, len(pricings))

Calls 3

UnmarshalFunction · 0.92
EqualMethod · 0.80
BytesMethod · 0.65

Tested by

no test coverage detected