File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Frontend/src/App/CodeEditor Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ export default function AskAIPanel() {
3838 } , 100 ) ;
3939 } ;
4040
41+ const getToken = ( ) => {
42+ const storageKey = `sb-${
43+ import . meta. env . VITE_SUPABASE_PROJECT_ID
44+ } -auth-token`;
45+ const sessionDataString = localStorage . getItem ( storageKey ) ;
46+ const sessionData = JSON . parse ( sessionDataString || "null" ) ;
47+ return sessionData ?. access_token || "" ;
48+ } ;
49+
4150 useEffect ( ( ) => {
4251 scrollToBottom ( ) ;
4352 } , [ messages , isLoading ] ) ; // Also scroll when loading state changes
@@ -56,6 +65,7 @@ export default function AskAIPanel() {
5665 method : "POST" ,
5766 headers : {
5867 "Content-Type" : "application/json" ,
68+ Authorization : getToken ( ) ,
5969 } ,
6070 body : JSON . stringify ( { messages : [ ...messages , userMessage ] } ) ,
6171 } ) ;
You can’t perform that action at this time.
0 commit comments