File tree Expand file tree Collapse file tree 6 files changed +25
-25
lines changed
Expand file tree Collapse file tree 6 files changed +25
-25
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,7 @@ APPLE_CODESIGN_KEYCHAIN_PASSWORD="xxx"
1212
1313VITE_POSTHOG_API_KEY = xxx
1414VITE_POSTHOG_API_HOST = xxx
15- VITE_POSTHOG_UI_HOST = xxx
15+ VITE_POSTHOG_UI_HOST = xxx
16+
17+ # Use new LLM gateway locally (experimental, needs to be started in mprocs)
18+ LLM_GATEWAY_URL = http://localhost:3308
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -411,7 +411,12 @@ export class SessionManager {
411411 process . env . POSTHOG_AUTH_HEADER = `Bearer ${ credentials . apiKey } ` ;
412412 process . env . ANTHROPIC_API_KEY = credentials . apiKey ;
413413 process . env . ANTHROPIC_AUTH_TOKEN = credentials . apiKey ;
414- process . env . ANTHROPIC_BASE_URL = `${ credentials . apiHost } /api/projects/${ credentials . projectId } /llm_gateway` ;
414+
415+ const llmGatewayUrl =
416+ process . env . LLM_GATEWAY_URL ||
417+ `${ credentials . apiHost } /api/projects/${ credentials . projectId } /llm_gateway` ;
418+ process . env . ANTHROPIC_BASE_URL = llmGatewayUrl ;
419+
415420 // process.env.ELECTRON_RUN_AS_NODE = "1";
416421 process . env . CLAUDE_CODE_EXECUTABLE = getClaudeCliPath ( ) ;
417422
Original file line number Diff line number Diff line change @@ -142,7 +142,9 @@ async function testAgent() {
142142 POSTHOG_AUTH_HEADER : `Bearer ${ process . env . POSTHOG_API_KEY } ` ,
143143 ANTHROPIC_API_KEY : process . env . POSTHOG_API_KEY ,
144144 ANTHROPIC_AUTH_TOKEN : process . env . POSTHOG_API_KEY ,
145- ANTHROPIC_BASE_URL : `${ process . env . POSTHOG_API_URL } /api/projects/${ process . env . POSTHOG_PROJECT_ID } /llm_gateway` ,
145+ ANTHROPIC_BASE_URL :
146+ process . env . LLM_GATEWAY_URL ||
147+ `${ process . env . POSTHOG_API_URL } /api/projects/${ process . env . POSTHOG_PROJECT_ID } /llm_gateway` ,
146148 } ,
147149 } ,
148150 } ) ;
Original file line number Diff line number Diff line change @@ -673,12 +673,19 @@ export class ClaudeAcpAgent implements Agent {
673673 throw RequestError . authRequired ( ) ;
674674 }
675675
676- // For assistant messages , text/thinking are normally streamed via stream_event.
677- // But some gateways (like LiteLLM) don't stream, so we process all content .
676+ // When using the gateway service , text/thinking is streamed via stream_event,
677+ // so skip them here to avoid duplication .
678678 const content = message . message . content ;
679+ const isUsingGatewayService = ! ! process . env . LLM_GATEWAY_URL ;
680+ const contentToProcess =
681+ isUsingGatewayService && Array . isArray ( content )
682+ ? content . filter (
683+ ( block ) => block . type !== "text" && block . type !== "thinking" ,
684+ )
685+ : content ;
679686
680687 for ( const notification of toAcpNotifications (
681- content ,
688+ contentToProcess as typeof content ,
682689 message . message . role ,
683690 params . sessionId ,
684691 this . toolUseCache ,
Original file line number Diff line number Diff line change @@ -134,7 +134,8 @@ export class Agent {
134134 }
135135
136136 try {
137- const gatewayUrl = this . posthogAPI . getLlmGatewayUrl ( ) ;
137+ const gatewayUrl =
138+ process . env . LLM_GATEWAY_URL || this . posthogAPI . getLlmGatewayUrl ( ) ;
138139 const apiKey = this . posthogAPI . getApiKey ( ) ;
139140 process . env . ANTHROPIC_BASE_URL = gatewayUrl ;
140141 process . env . ANTHROPIC_AUTH_TOKEN = apiKey ;
You can’t perform that action at this time.
0 commit comments