@electerm/electerm-react 3.15.86 → 3.15.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,8 @@ async function callBackendAIchatWithTools (messages, config) {
41
41
  config.apiPathAI,
42
42
  config.apiKeyAI,
43
43
  config.proxyAI,
44
- agentTools
44
+ agentTools,
45
+ config.authHeaderNameAI
45
46
  )
46
47
  }
47
48
 
@@ -40,6 +40,7 @@ export default auto(function AIConfigModal ({ store }) {
40
40
  title='AI Config'
41
41
  width='80%'
42
42
  destroyOnClose
43
+ maskClosable={false}
43
44
  className='ai-config-modal'
44
45
  >
45
46
  <AIConfigForm
@@ -4,6 +4,7 @@ export const aiConfigsArr = [
4
4
  'modelAI',
5
5
  'roleAI',
6
6
  'apiKeyAI',
7
+ 'authHeaderNameAI',
7
8
  'apiPathAI',
8
9
  'languageAI',
9
10
  'proxyAI'
@@ -35,6 +35,14 @@ const proxyOptions = [
35
35
  { value: 'https://proxy.example.com:3128' }
36
36
  ]
37
37
 
38
+ const authHeaderOptions = [
39
+ { value: 'Authorization: Bearer' },
40
+ { value: 'x-api-key' },
41
+ { value: 'api-key' },
42
+ { value: 'Authorization: Api-Key' },
43
+ { value: 'Authorization' }
44
+ ]
45
+
38
46
  export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig }) {
39
47
  const [form] = Form.useForm()
40
48
  const [testing, setTesting] = useState(false)
@@ -68,7 +76,8 @@ export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig })
68
76
  values.apiPathAI,
69
77
  values.apiKeyAI,
70
78
  values.proxyAI,
71
- false
79
+ false,
80
+ values.authHeaderNameAI
72
81
  )
73
82
  if (res && res.error) {
74
83
  message.error(res.error)
@@ -190,6 +199,19 @@ export default function AIConfigForm ({ initialValues, onSubmit, showAIConfig })
190
199
  <Password placeholder='Enter your API key' />
191
200
  </Form.Item>
192
201
 
202
+ <Form.Item
203
+ label='Auth Header'
204
+ name='authHeaderNameAI'
205
+ tooltip='Header format for API authentication. e.g. "Authorization: Bearer" sends "Authorization: Bearer <key>", "x-api-key" sends "x-api-key: <key>"'
206
+ >
207
+ <AutoComplete
208
+ options={authHeaderOptions}
209
+ filterOption={filter}
210
+ >
211
+ <Input placeholder='e.g. Authorization: Bearer' />
212
+ </AutoComplete>
213
+ </Form.Item>
214
+
193
215
  <Form.Item
194
216
  label={e('roleAI')}
195
217
  name='roleAI'
@@ -82,7 +82,8 @@ export default function AIBookmarkForm (props) {
82
82
  config.apiPathAI,
83
83
  config.apiKeyAI,
84
84
  config.proxyAI,
85
- false // Disable streaming for structured response
85
+ false, // Disable streaming for structured response
86
+ config.authHeaderNameAI
86
87
  )
87
88
 
88
89
  if (aiResponse && aiResponse.error) {
@@ -71,7 +71,9 @@ export default class TerminalCmdSuggestions extends Component {
71
71
  config.roleAI,
72
72
  config.baseURLAI,
73
73
  config.apiPathAI,
74
- config.apiKeyAI
74
+ config.apiKeyAI,
75
+ false,
76
+ config.authHeaderNameAI
75
77
  ).catch(
76
78
  window.store.onError
77
79
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "3.15.86",
3
+ "version": "3.15.90",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",