feat: support aws bedrockruntime claude3

closes #622, closes #749, closes #1300
This commit is contained in:
Laisky.Cai
2024-04-18 02:50:12 +00:00
parent b638a2fcbd
commit 4e1bfe4879
19 changed files with 458 additions and 21 deletions

View File

@@ -18,7 +18,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && mv -f build ../build/default",
"build": "react-scripts build && rm -rf ../build/default && mv -f build ../build/default",
"test": "react-scripts test",
"eject": "react-scripts eject"
},

View File

@@ -1,6 +1,7 @@
export const CHANNEL_OPTIONS = [
{ key: 1, text: 'OpenAI', value: 1, color: 'green' },
{ key: 14, text: 'Anthropic Claude', value: 14, color: 'black' },
{ key: 33, text: 'AWS Claude', value: 33, color: 'black' },
{ key: 3, text: 'Azure OpenAI', value: 3, color: 'olive' },
{ key: 11, text: 'Google PaLM2', value: 11, color: 'orange' },
{ key: 24, text: 'Google Gemini', value: 24, color: 'orange' },
@@ -31,4 +32,4 @@ export const CHANNEL_OPTIONS = [
{ key: 9, text: '代理AI.LS', value: 9, color: 'yellow' },
{ key: 12, text: '代理API2GPT', value: 12, color: 'blue' },
{ key: 13, text: '代理AIGC2D', value: 13, color: 'purple' }
];
];

View File

@@ -144,6 +144,13 @@ const EditChannel = () => {
}, []);
const submit = async () => {
// some provider as AWS need both AK and SK rather than a single key,
// so we need to combine them into a single key to achieve the best compatibility.
if (inputs.ak && inputs.sk) {
console.log(`combine ak ${inputs.ak} and sk ${inputs.sk}`, inputs.ak, inputs.sk);
inputs.key = `${inputs.ak}\n${inputs.sk}`;
}
if (!isEdit && (inputs.name === '' || inputs.key === '')) {
showInfo('请填写渠道名称和渠道密钥!');
return;
@@ -392,7 +399,40 @@ const EditChannel = () => {
/>
</Form.Field>
{
batch ? <Form.Field>
inputs.type === 33 && (
<Form.Field>
<Form.Input
label='Region'
name='base_url'
required
placeholder={'regione.g. us-west-2'}
onChange={handleInputChange}
value={inputs.base_url}
autoComplete=''
/>
<Form.Input
label='AK'
name='ak'
required
placeholder={'AWS IAM Access Key'}
onChange={handleInputChange}
value={inputs.ak}
autoComplete=''
/>
<Form.Input
label='SK'
name='sk'
required
placeholder={'AWS IAM Secret Key'}
onChange={handleInputChange}
value={inputs.sk}
autoComplete=''
/>
</Form.Field>
)
}
{
inputs.type !== 33 && (batch ? <Form.Field>
<Form.TextArea
label='密钥'
name='key'
@@ -413,10 +453,10 @@ const EditChannel = () => {
value={inputs.key}
autoComplete='new-password'
/>
</Form.Field>
</Form.Field>)
}
{
!isEdit && (
inputs.type !== 33 && !isEdit && (
<Form.Checkbox
checked={batch}
label='批量创建'
@@ -426,7 +466,7 @@ const EditChannel = () => {
)
}
{
inputs.type !== 3 && inputs.type !== 8 && inputs.type !== 22 && (
inputs.type !== 3 && inputs.type !== 33 && inputs.type !== 8 && inputs.type !== 22 && (
<Form.Field>
<Form.Input
label='代理'