fix(config): dedupe and normalize Gemini keys and headers

This commit is contained in:
hkfires
2025-10-31 13:20:10 +08:00
parent 7c1c4ee60b
commit 16be3f0a12
3 changed files with 107 additions and 51 deletions

View File

@@ -12,7 +12,13 @@ import (
)
func (h *Handler) GetConfig(c *gin.Context) {
c.JSON(200, h.cfg)
if h == nil || h.cfg == nil {
c.JSON(200, gin.H{})
return
}
cfgCopy := *h.cfg
cfgCopy.GlAPIKey = geminiKeyStringsFromConfig(h.cfg)
c.JSON(200, &cfgCopy)
}
func (h *Handler) GetConfigYAML(c *gin.Context) {