@@ -124,8 +124,6 @@ app.get('/config/project-overrides', (req, res) => {
124124 name : 'evaluationAnalyticsServerUrl' ,
125125 value : process . env . EVALUATION_ANALYTICS_SERVER_URL ,
126126 } ,
127- { name : 'gramProjectSlug' , value : process . env . GRAM_PROJECT_SLUG } ,
128- { name : 'gramMcpUrl' , value : process . env . GRAM_MCP_URL } ,
129127 ]
130128 let output = values . map ( getVariable ) . join ( '' )
131129 res . setHeader ( 'Cache-Control' , 's-max-age=1, stale-while-revalidate' )
@@ -233,46 +231,6 @@ if (process.env.FLAGSMITH_PROXY_API_URL) {
233231
234232app . use ( bodyParser . json ( ) )
235233
236- // Gram Elements chat session endpoint
237- if ( process . env . GRAM_API_KEY ) {
238- const { createElementsServerHandlers } = require ( '@gram-ai/elements/server' )
239- const gramHandlers = createElementsServerHandlers ( )
240-
241- app . post ( '/api/gram/session' , async ( req , res ) => {
242- const token = req . headers . authorization
243- if ( ! token ) {
244- return res . status ( 401 ) . json ( { error : 'Authentication required' } )
245- }
246-
247- const apiUrl = process . env . FLAGSMITH_PROXY_API_URL
248- ? process . env . FLAGSMITH_PROXY_API_URL . replace ( / \/ ? $ / , '/' )
249- : process . env . FLAGSMITH_API_URL || 'https://api.flagsmith.com/'
250-
251- try {
252- const userResponse = await fetch ( `${ apiUrl } api/v1/auth/users/me/` , {
253- headers : { Authorization : token } ,
254- } )
255- if ( ! userResponse . ok ) {
256- return res . status ( 401 ) . json ( { error : 'Invalid authentication token' } )
257- }
258- const user = await userResponse . json ( )
259-
260- return gramHandlers . session ( req , res , {
261- embedOrigin :
262- req . headers . origin ||
263- ( req . headers . referer && req . headers . referer . replace ( / \/ $ / , '' ) ) ||
264- '*' ,
265- userIdentifier : String ( user . id ) ,
266- expiresAfter : 3600 ,
267- } )
268- } catch ( err ) {
269- // eslint-disable-next-line
270- console . error ( 'Gram session error:' , err )
271- return res . status ( 500 ) . json ( { error : 'Failed to create chat session' } )
272- }
273- } )
274- }
275-
276234app . use ( spm )
277235const genericWebsite = ( url ) => {
278236 if ( ! url ) return true
0 commit comments