File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 10651065 .element-chat-popup-thread {
10661066 display : flex;
10671067 flex-direction : column;
1068- gap : 4 px ;
1068+ gap : 6 px ;
10691069 max-height : 160px ;
10701070 overflow-y : auto;
1071- padding : 2 px 14px 0 ;
1071+ padding : 4 px 14px 14 px ;
10721072 }
10731073
10741074 .element-chat-popup-line {
10841084
10851085 .element-chat-popup-line--assistant {
10861086 color : rgba (17 , 17 , 17 , 0.55 );
1087+ padding-bottom : 2px ;
10871088 }
10881089
10891090 .element-chat-popup-line--status {
10901091 color : rgba (17 , 17 , 17 , 0.35 );
1092+ padding-bottom : 2px ;
10911093 }
10921094
10931095 .element-chat-popup-line--error {
Original file line number Diff line number Diff line change @@ -4,11 +4,27 @@ import type { ElementContext } from "./element-context";
44const SESSION_ID_KEY = "popped.dev:agent-session-id" ;
55const AGENT_ID_KEY = "popped.dev:agent-id" ;
66
7- const API_BASE =
8- ( typeof process !== "undefined" && process . env . NEXT_PUBLIC_AGENT_API_URL ) || "" ;
7+ /** Pages hosts have no /api — call the Worker directly (works when popped.dev is blocked). */
8+ const PAGES_AGENT_API = "https://popped-dev-agent-api.parse-nip.workers.dev" ;
9+
10+ function isPagesDevHost ( hostname : string ) : boolean {
11+ return hostname === "popped-dev.pages.dev" || hostname . endsWith ( "--popped-dev.pages.dev" ) ;
12+ }
13+
14+ function getApiBase ( ) : string {
15+ const fromEnv =
16+ typeof process !== "undefined" ? process . env . NEXT_PUBLIC_AGENT_API_URL ?. trim ( ) : "" ;
17+ if ( fromEnv ) return fromEnv ;
18+
19+ if ( typeof window !== "undefined" && isPagesDevHost ( window . location . hostname ) ) {
20+ return PAGES_AGENT_API ;
21+ }
22+
23+ return "" ;
24+ }
925
1026function apiUrl ( path : string ) : string {
11- return `${ API_BASE } ${ path } ` ;
27+ return `${ getApiBase ( ) } ${ path } ` ;
1228}
1329
1430export function getContributorName ( ) : string {
Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ app.use(
3636 ) {
3737 return origin ;
3838 }
39+ // Cloudflare Pages default + branch preview URLs (no Worker on *.pages.dev).
40+ if (
41+ origin === "https://popped-dev.pages.dev" ||
42+ / ^ h t t p s : \/ \/ [ ^ / ] + - - p o p p e d - d e v \. p a g e s \. d e v $ / . test ( origin )
43+ ) {
44+ return origin ;
45+ }
3946 return c . env . CORS_ORIGIN || "https://popped.dev" ;
4047 } ,
4148 allowMethods : [ "GET" , "POST" , "OPTIONS" ] ,
You can’t perform that action at this time.
0 commit comments