mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 05:03:26 +00:00
feat(ai): add AWS ECS/IRSA credential detection for Bedrock, fixes #848
Added support for additional AWS credential environment variables: - AWS_CONTAINER_CREDENTIALS_RELATIVE_URI (ECS task roles) - AWS_CONTAINER_CREDENTIALS_FULL_URI (ECS task roles) - AWS_WEB_IDENTITY_TOKEN_FILE (IRSA for Kubernetes) Also fixed undefined currentModel variable in OAuth error handling.
This commit is contained in:
parent
cd0df4c0dd
commit
2b04aefa6d
3 changed files with 17 additions and 6 deletions
|
|
@ -641,17 +641,18 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|||
}
|
||||
const key = await modelRegistry.getApiKeyForProvider(resolvedProvider);
|
||||
if (!key) {
|
||||
const isOAuth = modelRegistry.isUsingOAuth(currentModel);
|
||||
const model = agent.state.model;
|
||||
const isOAuth = model && modelRegistry.isUsingOAuth(model);
|
||||
if (isOAuth) {
|
||||
throw new Error(
|
||||
`Authentication failed for "${currentModel.provider}". ` +
|
||||
`Authentication failed for "${resolvedProvider}". ` +
|
||||
`Credentials may have expired or network is unavailable. ` +
|
||||
`Run '/login ${currentModel.provider}' to re-authenticate.`,
|
||||
`Run '/login ${resolvedProvider}' to re-authenticate.`,
|
||||
);
|
||||
}
|
||||
throw new Error(
|
||||
`No API key found for "${currentModel.provider}". ` +
|
||||
`Set an API key environment variable or run '/login ${currentModel.provider}'.`,
|
||||
`No API key found for "${resolvedProvider}". ` +
|
||||
`Set an API key environment variable or run '/login ${resolvedProvider}'.`,
|
||||
);
|
||||
}
|
||||
return key;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue