Merge pull request #1670 from QwenLM/fix/top-right-auth-not-updating

fix(ui): resolve auth not updating in top-right corner
This commit is contained in:
tanzhenxin 2026-02-05 20:38:02 +08:00 committed by GitHub
commit 1db0d0051a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View file

@ -30,6 +30,7 @@ export const useAuthCommand = (
settings: LoadedSettings,
config: Config,
addItem: (item: Omit<HistoryItem, 'id'>, timestamp: number) => void,
onAuthChange?: () => void,
) => {
const unAuthenticated = config.getAuthType() === undefined;
@ -136,11 +137,10 @@ export const useAuthCommand = (
setIsAuthDialogOpen(false);
setIsAuthenticating(false);
// Log authentication success
const authEvent = new AuthEvent(authType, 'manual', 'success');
logAuth(config, authEvent);
// Trigger UI refresh to update header information
onAuthChange?.();
// Show success message
// Add success message to history
addItem(
{
type: MessageType.INFO,
@ -150,8 +150,12 @@ export const useAuthCommand = (
},
Date.now(),
);
// Log authentication success
const authEvent = new AuthEvent(authType, 'manual', 'success');
logAuth(config, authEvent);
},
[settings, handleAuthFailure, config, addItem],
[settings, handleAuthFailure, config, addItem, onAuthChange],
);
const performAuth = useCallback(