Add new files - #1
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Streamlit frontend to automatically choose between live backend results and mock data, adds an optional “frontend live mode” path using Bright Data + Kimi directly from the UI, and aligns env loading so the repo root .env is preferred.
Changes:
- Add a unified frontend config reader (env + Streamlit secrets) and auto-mock behavior for Streamlit Cloud when
BACKEND_URLpoints to localhost. - Add frontend live mode integrations (Bright Data SERP + Kimi via OpenAI-compatible client) and backend
/healthchecking. - Update backend Daytona sandbox stage to support newer daytona-sdk config style with a logged local fallback.
Reviewed changes
Copilot reviewed 13 out of 64 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/settings.py | Adds shared config getter (env + Streamlit secrets) and cloud/localhost auto-mock logic. |
| frontend/services/llm_reasoning.py | Switches LLM reasoning to Kimi/OpenAI-compatible client and adds JSON normalization. |
| frontend/services/bright_data.py | Replaces placeholder with a real Bright Data SERP request + parsing + fallback. |
| frontend/app.py | Adds backend health-based data source resolution + frontend live mode flow + UI updates. |
| frontend/api_client.py | Adds get_health() endpoint call. |
| frontend/env_shared.py | Loads root .env first, then backend/.env for compatibility. |
| frontend/requirements.txt | Adds openai and httpx dependencies for live mode. |
| frontend/README.md | Documents new data source resolution behavior and config location. |
| backend/stages/stage3_sandbox.py | Supports new daytona-sdk initialization style with warning + local fallback. |
| backend/config.py | Loads settings from root .env + backend .env; adds Daytona server URL/target; updates default Kimi model. |
| backend/runs/RSR-20260617-001/checkpoint_subject_prep.json | Adds a run checkpoint artifact (should not be committed). |
| backend/runs/RSR-20260617-001/checkpoint_entity_resolution.json | Adds a run checkpoint artifact (should not be committed). |
| backend/runs/RSR-20260617-001/checkpoint_data_collection.json | Adds a run checkpoint artifact (should not be committed). |
| backend/logs/pipeline.log | Adds runtime log output (should not be committed). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
33
to
34
| | `POLL_INTERVAL_SECONDS` | `5` | Status poll interval | | ||
| | `POLL_TIMEOUT_SECONDS` | `900` | Max wait for pipeline completion | |
Comment on lines
+10
to
+14
| KIMI_API_KEY = os.getenv("KIMI_API_KEY") | ||
| KIMI_BASE_URL = os.getenv("KIMI_BASE_URL", "https://api.moonshot.ai/v1") | ||
| KIMI_MODEL = os.getenv("KIMI_MODEL", "moonshot-v1-auto") | ||
|
|
||
| client = OpenAI(api_key=OPENAI_API_KEY) if OPENAI_API_KEY else None | ||
| client = OpenAI(api_key=KIMI_API_KEY, base_url=KIMI_BASE_URL) if KIMI_API_KEY else None |
Comment on lines
+1
to
+5
| { | ||
| "run_id": "RSR-20260617-001", | ||
| "stage": "subject_prep", | ||
| "status": "complete", | ||
| "timestamp": "2026-06-17T11:32:36.886755+00:00", |
Comment on lines
+1
to
+5
| { | ||
| "run_id": "RSR-20260617-001", | ||
| "stage": "entity_resolution", | ||
| "status": "complete", | ||
| "timestamp": "2026-06-17T11:32:36.893025+00:00", |
Comment on lines
+1
to
+10
| { | ||
| "run_id": "RSR-20260617-001", | ||
| "stage": "data_collection", | ||
| "status": "complete", | ||
| "timestamp": "2026-06-17T11:32:44.721720+00:00", | ||
| "subject": { | ||
| "subject_type": "organization", | ||
| "primary_name": "Singapore Airlines", | ||
| "aliases": [], | ||
| "country": "Singapore", |
Comment on lines
363
to
365
| _init_state() | ||
| _resolve_data_source() | ||
| _poll_if_needed() |
Comment on lines
+13
to
+22
| def _api_key() -> str: | ||
| return (os.getenv("BRIGHT_DATA_API_KEY") or os.getenv("BRIGHTDATA_API_KEY") or "").strip() | ||
|
|
||
|
|
||
| def _serp_zone() -> str: | ||
| return (os.getenv("BRIGHT_DATA_SERP_ZONE") or "").strip() | ||
|
|
||
|
|
||
| def bright_data_configured() -> bool: | ||
| return bool(_api_key()) and bool(_serp_zone()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.