server: continue to handle gin.H values until they are removed

This commit is contained in:
jmorganca 2025-10-08 17:33:12 -07:00
parent 6a62b894c7
commit 4c87a31ced
1 changed files with 18 additions and 0 deletions

View File

@ -555,6 +555,15 @@ func (s *Server) GenerateHandler(c *gin.Context) {
case error:
c.JSON(http.StatusInternalServerError, gin.H{"error": t.Error()})
return
// TODO (jmorganca): remove use of gin.H here and instead expect
// api.StatusError to be send in the channel
case gin.H:
if msg, ok := t["error"].(string); ok {
c.JSON(http.StatusInternalServerError, gin.H{"error": msg})
return
}
c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"})
return
default:
c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"})
return
@ -2099,6 +2108,15 @@ func (s *Server) ChatHandler(c *gin.Context) {
case error:
c.JSON(http.StatusInternalServerError, gin.H{"error": t.Error()})
return
// TODO (jmorganca): remove use of gin.H here and instead expect
// api.StatusError to be send in the channel
case gin.H:
if msg, ok := t["error"].(string); ok {
c.JSON(http.StatusInternalServerError, gin.H{"error": msg})
return
}
c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"})
return
default:
c.JSON(http.StatusInternalServerError, gin.H{"error": "unexpected response"})
return