fix: not login can not show model
This commit is contained in:
parent
32c6f68734
commit
3f7fa33aa1
|
|
@ -37,6 +37,7 @@ import { generateMachineId, saveCoStrictCredentials } from '../../costrict/provi
|
||||||
import { extractExpiryFromJWT } from '../../costrict/provider/token.js';
|
import { extractExpiryFromJWT } from '../../costrict/provider/token.js';
|
||||||
import { updateSettingsForSource } from '../../utils/settings/settings.js';
|
import { updateSettingsForSource } from '../../utils/settings/settings.js';
|
||||||
import { useSetAppState as useSetGlobalAppState } from '../../state/AppState.js';
|
import { useSetAppState as useSetGlobalAppState } from '../../state/AppState.js';
|
||||||
|
import { isNotLoggedIn } from '../../utils/logoV2Utils.js';
|
||||||
|
|
||||||
function ModelPickerWrapper({
|
function ModelPickerWrapper({
|
||||||
onDone,
|
onDone,
|
||||||
|
|
@ -339,6 +340,15 @@ export const call: LocalJSXCommandCall = async (onDone, _context, args) => {
|
||||||
return <SetModelAndClose args={args} onDone={onDone} />;
|
return <SetModelAndClose args={args} onDone={onDone} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if user is logged in before showing model picker
|
||||||
|
if (isNotLoggedIn()) {
|
||||||
|
// User is not logged in, redirect to login
|
||||||
|
onDone('You need to login first. Use /login to authenticate.', {
|
||||||
|
display: 'system',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return <ModelPickerWrapper onDone={onDone} />;
|
return <ModelPickerWrapper onDone={onDone} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,8 @@ export function ConsoleOAuthFlow({
|
||||||
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
||||||
// Clear costrict env var to prevent conflicts
|
// Clear costrict env var to prevent conflicts
|
||||||
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
||||||
|
// Reset AppState model so logo reflects the new provider default
|
||||||
|
setAppState(prev => ({ ...prev, mainLoopModel: null, mainLoopModelForSession: null }))
|
||||||
|
|
||||||
setOAuthStatus({ state: 'success' })
|
setOAuthStatus({ state: 'success' })
|
||||||
void sendNotification(
|
void sendNotification(
|
||||||
|
|
@ -734,6 +736,8 @@ function OAuthStatusMessage({
|
||||||
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
||||||
// Set default model to sonnet for this provider
|
// Set default model to sonnet for this provider
|
||||||
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
||||||
|
// Reset AppState model so logo reflects the new provider default
|
||||||
|
setAppState(prev => ({ ...prev, mainLoopModel: null, mainLoopModelForSession: null }))
|
||||||
setOAuthStatus({ state: 'success' })
|
setOAuthStatus({ state: 'success' })
|
||||||
void onDone()
|
void onDone()
|
||||||
}
|
}
|
||||||
|
|
@ -958,6 +962,8 @@ function OAuthStatusMessage({
|
||||||
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
||||||
// Set default model to sonnet for this provider
|
// Set default model to sonnet for this provider
|
||||||
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
||||||
|
// Reset AppState model so logo reflects the new provider default
|
||||||
|
setAppState(prev => ({ ...prev, mainLoopModel: null, mainLoopModelForSession: null }))
|
||||||
setOAuthStatus({ state: 'success' })
|
setOAuthStatus({ state: 'success' })
|
||||||
void onDone()
|
void onDone()
|
||||||
}
|
}
|
||||||
|
|
@ -1195,6 +1201,8 @@ function OAuthStatusMessage({
|
||||||
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
delete process.env.CLAUDE_CODE_USE_COSTRICT
|
||||||
// Set default model to sonnet for this provider
|
// Set default model to sonnet for this provider
|
||||||
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
updateSettingsForSource('userSettings', { model: getDefaultSonnetModel() } as any)
|
||||||
|
// Reset AppState model so logo reflects the new provider default
|
||||||
|
setAppState(prev => ({ ...prev, mainLoopModel: null, mainLoopModelForSession: null }))
|
||||||
setOAuthStatus({ state: 'success' })
|
setOAuthStatus({ state: 'success' })
|
||||||
void onDone()
|
void onDone()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user