MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / handleUpdateTelegramModel

Method handleUpdateTelegramModel

api/handler_telegram.go:84–105  ·  view source on GitHub ↗

handleUpdateTelegramModel updates only the AI model used for Telegram replies (no token re-entry needed)

(c *gin.Context)

Source from the content-addressed store, hash-verified

82
83// handleUpdateTelegramModel updates only the AI model used for Telegram replies (no token re-entry needed)
84func (s *Server) handleUpdateTelegramModel(c *gin.Context) {
85 var req struct {
86 ModelID string `json:"model_id"`
87 }
88 if err := c.ShouldBindJSON(&req); err != nil {
89 c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
90 return
91 }
92
93 cfg, err := s.store.TelegramConfig().Get()
94 if err != nil {
95 c.JSON(http.StatusBadRequest, gin.H{"error": "no Telegram config found, save a bot token first"})
96 return
97 }
98
99 if err := s.store.TelegramConfig().Save(cfg.BotToken, req.ModelID); err != nil {
100 c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to save model config"})
101 return
102 }
103
104 c.JSON(http.StatusOK, gin.H{"success": true, "model_id": req.ModelID})
105}

Callers

nothing calls this directly

Calls 3

TelegramConfigMethod · 0.80
GetMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected