mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 19:32:12 +00:00
fix(dashboard): use deployment LangGraph client for review style analysis (#1317)
Hardcoded localhost:2024 caused httpx.ConnectError when starting the review_style_analyzer graph in production. Resolve the SDK URL from LANGGRAPH_URL / LANGGRAPH_URL_PROD like webapp, otherwise get_client(). Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
82852f9eda
commit
5ddce73b06
1 changed files with 11 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from langgraph_sdk import get_client
|
from langgraph_sdk import get_client
|
||||||
|
|
@ -22,7 +23,14 @@ from .review_styles import (
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
_ASSISTANT_ID = "review_style_analyzer"
|
_ASSISTANT_ID = "review_style_analyzer"
|
||||||
_LANGGRAPH_URL = "http://localhost:2024"
|
|
||||||
|
|
||||||
|
def _client():
|
||||||
|
"""LangGraph SDK client for the current deployment (same resolution as webapp)."""
|
||||||
|
url = os.environ.get("LANGGRAPH_URL") or os.environ.get("LANGGRAPH_URL_PROD")
|
||||||
|
if url:
|
||||||
|
return get_client(url=url)
|
||||||
|
return get_client()
|
||||||
|
|
||||||
|
|
||||||
async def start_review_style_analysis(
|
async def start_review_style_analysis(
|
||||||
|
|
@ -48,7 +56,7 @@ async def start_review_style_analysis(
|
||||||
samples_text = format_samples_for_analyzer(samples)
|
samples_text = format_samples_for_analyzer(samples)
|
||||||
thread_id = generate_review_style_thread_id(owner, repo)
|
thread_id = generate_review_style_thread_id(owner, repo)
|
||||||
|
|
||||||
client = get_client(url=_LANGGRAPH_URL)
|
client = _client()
|
||||||
configurable: dict[str, Any] = {
|
configurable: dict[str, Any] = {
|
||||||
"thread_id": thread_id,
|
"thread_id": thread_id,
|
||||||
"review_style_full_name": full_name,
|
"review_style_full_name": full_name,
|
||||||
|
|
@ -121,7 +129,7 @@ async def sync_review_style_run_status(full_name: str) -> dict[str, Any]:
|
||||||
if not isinstance(thread_id, str) or not thread_id:
|
if not isinstance(thread_id, str) or not thread_id:
|
||||||
return record
|
return record
|
||||||
|
|
||||||
client = get_client(url=_LANGGRAPH_URL)
|
client = _client()
|
||||||
try:
|
try:
|
||||||
if isinstance(run_id, str) and run_id:
|
if isinstance(run_id, str) and run_id:
|
||||||
run = await client.runs.get(thread_id, run_id)
|
run = await client.runs.get(thread_id, run_id)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue