fix(studio): self-hosted assistant authorization header (#35804)

This commit is contained in:
Alaister Young authored and GitHub committed 2025-05-21 22:33:47 +08:00
1 parent 521979748b
commit c9ee6bc9c2
3 files changed
+16 -5

No files matched your search

@@ -500,8 +500,10 @@ export const SQLEditor = () => {
}))
const headerData = await constructHeaders()
const authorizationHeader = headerData.get('Authorization')
await complete(prompt, {
headers: { Authorization: headerData.get('Authorization') ?? '' },
...(authorizationHeader ? { headers: { Authorization: authorizationHeader } } : undefined),
body: {
completionMetadata: {
textBeforeCursor: context.beforeSelection,
@@ -221,9 +221,16 @@ export const AIAssistant = ({ className }: AIAssistantProps) => {
// Store the user message in the ref before appending
lastUserMessageRef.current = payload
append(payload, {
headers: { Authorization: headerData.get('Authorization') ?? '' },
})
const authorizationHeader = headerData.get('Authorization')
append(
payload,
authorizationHeader
? {
headers: { Authorization: authorizationHeader },
}
: undefined
)
setValue('')
+3 -1
View File
@@ -195,8 +195,10 @@ const AIEditor = ({
}))
const headerData = await constructHeaders()
const authorizationHeader = headerData.get('Authorization')
await complete(prompt, {
headers: { Authorization: headerData.get('Authorization') ?? '' },
...(authorizationHeader ? { headers: { Authorization: authorizationHeader } } : undefined),
body: {
...aiMetadata,
completionMetadata: {