Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Added fallback to default the Node.JS AWS SDK's `fromNodeProviderChain` when no credentials are provided for a bedrock config. [#513](https://github.com/sourcebot-dev/sourcebot/pull/513)

### Fixed
- Fixed "At least one project, user, or group must be specified" for GitLab configs with `all` in web configurator. [#512](https://github.com/sourcebot-dev/sourcebot/pull/512)

Expand Down
25 changes: 13 additions & 12 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
"stripe:listen": "stripe listen --forward-to http://localhost:3000/api/stripe"
},
"dependencies": {
"@ai-sdk/amazon-bedrock": "^3.0.3",
"@ai-sdk/anthropic": "^2.0.1",
"@ai-sdk/azure": "^2.0.5",
"@ai-sdk/deepseek": "^1.0.2",
"@ai-sdk/google": "^2.0.3",
"@ai-sdk/google-vertex": "^3.0.4",
"@ai-sdk/mistral": "^2.0.1",
"@ai-sdk/openai": "^2.0.5",
"@ai-sdk/openai-compatible": "^1.0.2",
"@ai-sdk/react": "^2.0.8",
"@ai-sdk/xai": "^2.0.2",
"@ai-sdk/amazon-bedrock": "^3.0.22",
"@ai-sdk/anthropic": "^2.0.17",
"@ai-sdk/azure": "^2.0.32",
"@ai-sdk/deepseek": "^1.0.18",
"@ai-sdk/google": "^2.0.14",
"@ai-sdk/google-vertex": "^3.0.27",
"@ai-sdk/mistral": "^2.0.14",
"@ai-sdk/openai": "^2.0.32",
"@ai-sdk/openai-compatible": "^1.0.18",
"@ai-sdk/react": "^2.0.45",
"@ai-sdk/xai": "^2.0.20",
"@auth/prisma-adapter": "^2.7.4",
"@aws-sdk/credential-providers": "^3.890.0",
"@codemirror/commands": "^6.6.0",
"@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-css": "^6.3.0",
Expand Down Expand Up @@ -109,7 +110,7 @@
"@vercel/otel": "^1.13.0",
"@viz-js/lang-dot": "^1.0.4",
"@xiechao/codemirror-lang-handlebars": "^1.0.4",
"ai": "^5.0.8",
"ai": "^5.0.45",
"ajv": "^8.17.1",
"bcryptjs": "^3.0.2",
"chokidar": "^4.0.3",
Expand Down
8 changes: 7 additions & 1 deletion packages/web/src/features/chat/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ import { createOpenAI, OpenAIResponsesProviderOptions } from "@ai-sdk/openai";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { LanguageModelV2 as AISDKLanguageModelV2 } from "@ai-sdk/provider";
import { createXai } from '@ai-sdk/xai';
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
import { createOpenRouter } from '@openrouter/ai-sdk-provider';
import { getTokenFromConfig } from "@sourcebot/crypto";
import { ChatVisibility, OrgRole, Prisma, PrismaClient } from "@sourcebot/db";
import { LanguageModel } from "@sourcebot/schemas/v3/languageModel.type";
import { Token } from "@sourcebot/schemas/v3/shared.type";
import { loadConfig } from "@sourcebot/shared";
import { generateText, JSONValue } from "ai";
import fs from 'fs';
import { StatusCodes } from "http-status-codes";
import path from 'path';
import { LanguageModelInfo, SBChatMessage } from "./types";
import { Token } from "@sourcebot/schemas/v3/shared.type";

export const createChat = async (domain: string) => sew(() =>
withAuth((userId) =>
Expand Down Expand Up @@ -396,6 +397,11 @@ export const _getAISDKLanguageModelAndOptions = async (config: LanguageModel, or
headers: config.headers
? await extractLanguageModelKeyValuePairs(config.headers, orgId, prisma)
: undefined,
// Fallback to the default Node.js credential provider chain if no credentials are provided.
// See: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-credential-providers/#fromnodeproviderchain
credentialProvider: !config.accessKeyId && !config.accessKeySecret && !config.sessionToken
? fromNodeProviderChain()
: undefined,
});

return {
Expand Down
Loading