bothAuthMethodsNotice top-level property
Both auth methods set at once.
Implementation
final StatusNoticeDefinition bothAuthMethodsNotice = StatusNoticeDefinition(
id: 'both-auth-methods',
type: StatusNoticeType.warning,
isActive: (ctx) =>
ctx.apiKeySource != null &&
ctx.apiKeySource != 'none' &&
ctx.authTokenSource != null &&
ctx.authTokenSource != 'none' &&
!(ctx.apiKeySource == 'apiKeyHelper' &&
ctx.authTokenSource == 'apiKeyHelper'),
render: (ctx, context) {
final theme = Theme.of(context);
return Container(
margin: const EdgeInsets.only(top: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Icon(
Icons.warning_amber,
size: 16,
color: theme.colorScheme.error,
),
const SizedBox(width: 6),
Expanded(
child: Text(
'Auth conflict: Both a token (${ctx.authTokenSource}) and an API key '
'(${ctx.apiKeySource}) are set. This may lead to unexpected behavior.',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.error,
),
),
),
],
),
Padding(
padding: const EdgeInsets.only(left: 22, top: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'\u00B7 Trying to use ${ctx.authTokenSource == "neomage.ai" ? "neomage.ai" : ctx.authTokenSource}? '
'${ctx.apiKeySource == "ANTHROPIC_API_KEY" ? "Unset the ANTHROPIC_API_KEY environment variable." : "neomage /logout"}',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.error,
),
),
Text(
'\u00B7 Trying to use ${ctx.apiKeySource}? '
'${ctx.authTokenSource == "neomage.ai" ? "neomage /logout to sign out of neomage.ai." : "Unset the ${ctx.authTokenSource} environment variable."}',
style: TextStyle(
fontSize: 12,
color: theme.colorScheme.error,
),
),
],
),
),
],
),
);
},
);