File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -651,7 +651,10 @@ Important:
651651
652652 private configureEnvironment ( ) : void {
653653 const { apiKey, apiUrl, projectId } = this . config ;
654- const gatewayUrl = process . env . LLM_GATEWAY_URL || getLlmGatewayUrl ( apiUrl ) ;
654+ const product =
655+ this . config . mode === "background" ? "background_agents" : "twig" ;
656+ const gatewayUrl =
657+ process . env . LLM_GATEWAY_URL || getLlmGatewayUrl ( apiUrl , product ) ;
655658 const openaiBaseUrl = gatewayUrl . endsWith ( "/v1" )
656659 ? gatewayUrl
657660 : `${ gatewayUrl } /v1` ;
Original file line number Diff line number Diff line change 1- export function getLlmGatewayUrl ( posthogHost : string ) : string {
1+ export type GatewayProduct = "twig" | "background_agents" ;
2+
3+ export function getLlmGatewayUrl (
4+ posthogHost : string ,
5+ product : GatewayProduct = "twig" ,
6+ ) : string {
27 const url = new URL ( posthogHost ) ;
38 const hostname = url . hostname ;
49
510 // Local development (normalize 127.0.0.1 to localhost)
611 if ( hostname === "localhost" || hostname === "127.0.0.1" ) {
7- return `${ url . protocol } //localhost:3308/twig ` ;
12+ return `${ url . protocol } //localhost:3308/${ product } ` ;
813 }
914
1015 // Docker containers accessing host
1116 if ( hostname === "host.docker.internal" ) {
12- return `${ url . protocol } //host.docker.internal:3308/twig ` ;
17+ return `${ url . protocol } //host.docker.internal:3308/${ product } ` ;
1318 }
1419
1520 // Production - extract region from hostname, default to US
1621 const region = hostname . match ( / ^ ( u s | e u ) \. p o s t h o g \. c o m $ / ) ?. [ 1 ] ?? "us" ;
17- return `https://gateway.${ region } .posthog.com/twig ` ;
22+ return `https://gateway.${ region } .posthog.com/${ product } ` ;
1823}
You can’t perform that action at this time.
0 commit comments