diff --git a/internal/provider/gemini-web/state.go b/internal/provider/gemini-web/state.go index e7b86aef..cd6c5af5 100644 --- a/internal/provider/gemini-web/state.go +++ b/internal/provider/gemini-web/state.go @@ -34,6 +34,7 @@ type GeminiWebState struct { cfg *config.Config token *gemini.GeminiWebTokenStorage storagePath string + authLabel string stableClientID string accountID string @@ -55,11 +56,12 @@ type GeminiWebState struct { pendingMatch *conversation.MatchResult } -func NewGeminiWebState(cfg *config.Config, token *gemini.GeminiWebTokenStorage, storagePath string) *GeminiWebState { +func NewGeminiWebState(cfg *config.Config, token *gemini.GeminiWebTokenStorage, storagePath, authLabel string) *GeminiWebState { state := &GeminiWebState{ cfg: cfg, token: token, storagePath: storagePath, + authLabel: strings.TrimSpace(authLabel), convStore: make(map[string][]string), convData: make(map[string]ConversationRecord), convIndex: make(map[string]string), @@ -117,6 +119,9 @@ func (s *GeminiWebState) Label() string { return lbl } } + if lbl := strings.TrimSpace(s.authLabel); lbl != "" { + return lbl + } if s.storagePath != "" { base := strings.TrimSuffix(filepath.Base(s.storagePath), filepath.Ext(s.storagePath)) if base != "" { diff --git a/internal/runtime/executor/gemini_web_executor.go b/internal/runtime/executor/gemini_web_executor.go index 4b0db143..d7023f2d 100644 --- a/internal/runtime/executor/gemini_web_executor.go +++ b/internal/runtime/executor/gemini_web_executor.go @@ -196,7 +196,7 @@ func (e *GeminiWebExecutor) stateFor(auth *cliproxyauth.Auth) (*geminiwebapi.Gem storagePath = p } } - state := geminiwebapi.NewGeminiWebState(cfg, ts, storagePath) + state := geminiwebapi.NewGeminiWebState(cfg, ts, storagePath, auth.Label) runtime := &geminiWebRuntime{state: state} auth.Runtime = runtime return state, nil