mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
feat(gemini-web): Enable config hot-reload and fix Gem selection
This commit is contained in:
@@ -380,6 +380,15 @@ func (c *GeminiClient) generateOnce(prompt string, files []string, model Model,
|
||||
}
|
||||
|
||||
inner := []any{item0, nil, item2}
|
||||
// Attach Gem first to keep index alignment with reference implementation
|
||||
// so the Gemini Web UI can recognize the selected Gem.
|
||||
if gem != nil {
|
||||
// pad with 16 nils then gem ID
|
||||
for i := 0; i < 16; i++ {
|
||||
inner = append(inner, nil)
|
||||
}
|
||||
inner = append(inner, gem.ID)
|
||||
}
|
||||
requestedModel := strings.ToLower(model.Name)
|
||||
if chat != nil && chat.RequestedModel() != "" {
|
||||
requestedModel = chat.RequestedModel()
|
||||
@@ -388,13 +397,6 @@ func (c *GeminiClient) generateOnce(prompt string, files []string, model Model,
|
||||
inner = ensureAnyLen(inner, 49)
|
||||
inner[49] = 14
|
||||
}
|
||||
if gem != nil {
|
||||
// pad with 16 nils then gem ID
|
||||
for i := 0; i < 16; i++ {
|
||||
inner = append(inner, nil)
|
||||
}
|
||||
inner = append(inner, gem.ID)
|
||||
}
|
||||
innerJSON, _ := json.Marshal(inner)
|
||||
outer := []any{nil, string(innerJSON)}
|
||||
outerJSON, _ := json.Marshal(outer)
|
||||
|
||||
@@ -1030,3 +1030,10 @@ func FindReusableSessionIn(items map[string]ConversationRecord, index map[string
|
||||
}
|
||||
return ConversationRecord{}, nil, 0, false
|
||||
}
|
||||
|
||||
// SetConfig updates the configuration reference used by the state.
|
||||
// This allows hot-reload of configuration to take effect for existing
|
||||
// runtime states that were cached on auth during previous requests.
|
||||
func (s *GeminiWebState) SetConfig(cfg *config.Config) {
|
||||
s.cfg = cfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user