修改: app/api/[provider]/[...path]/route.ts

修改:     app/api/auth.ts
	新文件:   app/api/bedrock.ts
	新文件:   app/api/bedrock/models.ts
	新文件:   app/api/bedrock/utils.ts
	修改:     app/client/api.ts
	新文件:   app/client/platforms/bedrock.ts
	修改:     app/components/settings.tsx
	修改:     app/config/server.ts
	修改:     app/constant.ts
	修改:     app/locales/cn.ts
	修改:     app/locales/en.ts
	修改:     app/store/access.ts
	修改:     app/utils.ts
	修改:     package.json
This commit is contained in:
glay
2024-10-29 22:20:26 +08:00
parent 613d67eada
commit ff356f0c8c
15 changed files with 1261 additions and 13 deletions

View File

@@ -12,6 +12,8 @@ export const RUNTIME_CONFIG_DOM = "danger-runtime-config";
export const STABILITY_BASE_URL = "https://api.stability.ai";
export const OPENAI_BASE_URL = "https://api.openai.com";
export const BEDROCK_BASE_URL =
"https://bedrock-runtime.us-west-2.amazonaws.com";
export const ANTHROPIC_BASE_URL = "https://api.anthropic.com";
export const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/";
@@ -49,6 +51,7 @@ export enum Path {
export enum ApiPath {
Cors = "",
Bedrock = "/api/bedrock",
Azure = "/api/azure",
OpenAI = "/api/openai",
Anthropic = "/api/anthropic",
@@ -115,6 +118,7 @@ export enum ServiceProvider {
Stability = "Stability",
Iflytek = "Iflytek",
XAI = "XAI",
Bedrock = "Bedrock",
}
// Google API safety settings, see https://ai.google.dev/gemini-api/docs/safety-settings
@@ -128,6 +132,7 @@ export enum GoogleSafetySettingsThreshold {
export enum ModelProvider {
Stability = "Stability",
Bedrock = "Bedrock",
GPT = "GPT",
GeminiPro = "GeminiPro",
Claude = "Claude",
@@ -304,6 +309,26 @@ const openaiModels = [
"o1-preview",
];
const bedrockModels = [
// Claude Models
"anthropic.claude-3-haiku-20240307-v1:0",
"anthropic.claude-3-sonnet-20240229-v1:0",
"anthropic.claude-3-opus-20240229-v1:0",
"anthropic.claude-3-5-sonnet-20240620-v1:0",
"anthropic.claude-3-5-sonnet-20241022-v2:0",
// Amazon Titan Models
"amazon.titan-text-express-v1",
"amazon.titan-text-lite-v1",
// Meta Llama Models
"meta.llama3-2-1b-instruct-v1:0",
"meta.llama3-2-3b-instruct-v1:0",
"meta.llama3-2-11b-instruct-v1:0",
//Mistral
"mistral.mistral-7b-instruct-v0:2",
"mistral.mixtral-8x7b-instruct-v0:1",
"mistral.mistral-large-2407-v1:0",
];
const googleModels = [
"gemini-1.0-pro",
"gemini-1.5-pro-latest",
@@ -499,6 +524,17 @@ export const DEFAULT_MODELS = [
sorted: 11,
},
})),
...bedrockModels.map((name) => ({
name,
available: true,
sorted: seq++,
provider: {
id: "bedrock",
providerName: "Bedrock",
providerType: "bedrock",
sorted: 12,
},
})),
] as const;
export const CHAT_PAGE_SIZE = 15;