mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
fix(studio): self-hosted assistant authorization header (#35804)
This commit is contained in:
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('')
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user