Skip to content

Commit 2aa62fe

Browse files
Asaif AliAsaif Ali
authored andcommitted
Support direct cloud LLM endpoint
1 parent eb2a2d5 commit 2aa62fe

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ def animate_count(placeholder, label: str, icon: str, target: int, duration: flo
229229
# Local development can keep using the LiteLLM gateway. Cloud deployments
230230
# can bypass it and call any OpenAI-compatible endpoint directly (for
231231
# example OpenRouter) by setting OPENAI_BASE_URL / OPENAI_API_KEY.
232-
gateway_url = os.getenv("LLM_BASE_URL", "") or os.getenv("LLM_GATEWAY_URL", "")
233-
gateway_key = os.getenv("LLM_API_KEY", "") or os.getenv("LLM_GATEWAY_API_KEY", "")
232+
gateway_url = os.getenv("LLM_GATEWAY_URL", "")
233+
gateway_key = st.session_state.get("llm_gateway_session_token", "") or os.getenv("LLM_GATEWAY_API_KEY", "")
234234
direct_url = os.getenv("OPENAI_BASE_URL", "")
235235
direct_key = os.getenv("OPENAI_API_KEY", "")
236236
gateway_enabled = (
@@ -249,8 +249,8 @@ def animate_count(placeholder, label: str, icon: str, target: int, duration: flo
249249
llm_base_url = gateway_url or direct_url or "https://openrouter.ai/api/v1"
250250
llm_api_key = gateway_key or direct_key
251251
llm_model = (
252-
os.getenv("LLM_MODEL", "")
253-
or os.getenv("LLM_GATEWAY_MODEL", "")
252+
("" if st.session_state.get("llm_gateway_session_token") else os.getenv("LLM_GATEWAY_MODEL", ""))
253+
or os.getenv("LLM_MODEL", "")
254254
or os.getenv("OPENAI_MODEL", "")
255255
or os.getenv("OPENAI_MODEL_ID", "")
256256
or "openrouter/free"

crawler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ async def _summarize_via_gateway(self, content: str) -> str:
581581
)
582582
prompt = prompt[:4000].rsplit(" ", 1)[0] + "..." if len(prompt) > 4000 else prompt
583583
payload = {
584-
"model": self.llm_model,
584+
**({"model": self.llm_model} if self.llm_model else {}),
585585
"messages": [
586586
{"role": "system", "content": "Summarize only the supplied webpage content."},
587587
{"role": "user", "content": prompt},

0 commit comments

Comments
 (0)