fix: Add header to anthropic get models api
This commit is contained in:
parent
404f40cc23
commit
86c7122f90
@ -82,7 +82,7 @@
|
|||||||
"remark-math": "6.0.0",
|
"remark-math": "6.0.0",
|
||||||
"sonner": "2.0.5",
|
"sonner": "2.0.5",
|
||||||
"tailwindcss": "4.1.4",
|
"tailwindcss": "4.1.4",
|
||||||
"token.js": "npm:token.js-fork@0.7.27",
|
"token.js": "npm:token.js-fork@0.7.29",
|
||||||
"tw-animate-css": "1.2.8",
|
"tw-animate-css": "1.2.8",
|
||||||
"ulidx": "2.4.1",
|
"ulidx": "2.4.1",
|
||||||
"unified": "11.0.5",
|
"unified": "11.0.5",
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export const predefinedProviders = [
|
|||||||
{
|
{
|
||||||
active: true,
|
active: true,
|
||||||
api_key: '',
|
api_key: '',
|
||||||
base_url: 'https://api.anthropic.com',
|
base_url: 'https://api.anthropic.com/v1',
|
||||||
provider: 'anthropic',
|
provider: 'anthropic',
|
||||||
explore_models_url:
|
explore_models_url:
|
||||||
'https://docs.anthropic.com/en/docs/about-claude/models',
|
'https://docs.anthropic.com/en/docs/about-claude/models',
|
||||||
@ -127,6 +127,16 @@ export const predefinedProviders = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
models: [],
|
models: [],
|
||||||
|
custom_header: [
|
||||||
|
{
|
||||||
|
header: 'anthropic-version',
|
||||||
|
value: '2023-06-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'anthropic-dangerous-direct-browser-access',
|
||||||
|
value: 'true'
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
active: true,
|
active: true,
|
||||||
|
|||||||
@ -151,6 +151,12 @@ export class TauriProvidersService extends DefaultProvidersService {
|
|||||||
headers['Authorization'] = `Bearer ${provider.api_key}`
|
headers['Authorization'] = `Bearer ${provider.api_key}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider.custom_header) {
|
||||||
|
provider.custom_header.forEach((header) => {
|
||||||
|
headers[header.header] = header.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Always use Tauri's fetch to avoid CORS issues
|
// Always use Tauri's fetch to avoid CORS issues
|
||||||
const response = await fetchTauri(`${provider.base_url}/models`, {
|
const response = await fetchTauri(`${provider.base_url}/models`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
6
web-app/src/types/modelProviders.d.ts
vendored
6
web-app/src/types/modelProviders.d.ts
vendored
@ -48,6 +48,7 @@ type ProviderObject = {
|
|||||||
settings: ProviderSetting[]
|
settings: ProviderSetting[]
|
||||||
models: Model[]
|
models: Model[]
|
||||||
persist?: boolean
|
persist?: boolean
|
||||||
|
custom_header: ProviderCustomHeader[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,3 +72,8 @@ type ProxyOptions = {
|
|||||||
verifyHostSSL: boolean
|
verifyHostSSL: boolean
|
||||||
noProxy: string
|
noProxy: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProviderCustomHeader = {
|
||||||
|
header: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user