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

Function FetchUpstreamModels

controller/channel.go:221–248  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

219}
220
221func FetchUpstreamModels(c *gin.Context) {
222 id, err := strconv.Atoi(c.Param("id"))
223 if err != nil {
224 common.ApiError(c, err)
225 return
226 }
227
228 channel, err := model.GetChannelById(id, true)
229 if err != nil {
230 common.ApiError(c, err)
231 return
232 }
233
234 ids, err := fetchChannelUpstreamModelIDs(channel)
235 if err != nil {
236 c.JSON(http.StatusOK, gin.H{
237 "success": false,
238 "message": fmt.Sprintf("获取模型列表失败: %s", err.Error()),
239 })
240 return
241 }
242
243 c.JSON(http.StatusOK, gin.H{
244 "success": true,
245 "message": "",
246 "data": ids,
247 })
248}
249
250func FixChannelsAbilities(c *gin.Context) {
251 success, fails, err := model.FixAbility()

Callers

nothing calls this directly

Calls 4

ApiErrorFunction · 0.92
GetChannelByIdFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected