diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1473a2d..fe1a2a8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -122,7 +122,7 @@ jobs: -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/StatPan/dlfrnaos19-infra/dispatches \ -d "{ - \"event_type\": \"deploy-assemblymcp\", + \"event_type\": \"deploy-assemblymcp-oracle\", \"client_payload\": { \"image_tag\": \"$IMAGE_TAG\", \"repository\": \"${{ github.repository }}\", diff --git a/assemblymcp/services.py b/assemblymcp/services.py index 271a52d..84cccf2 100644 --- a/assemblymcp/services.py +++ b/assemblymcp/services.py @@ -254,13 +254,19 @@ async def get_bill_info( """ params = { "AGE": age, # REQUIRED - "BILL_ID": bill_id, "BILL_NAME": bill_name, "PROPOSE_DT": propose_dt, "PROC_RESULT_CD": proc_status, "pIndex": page, "pSize": limit, } + + if bill_id: + # Check if bill_id is numeric (likely a BILL_NO) + if bill_id.isdigit(): + params["BILL_NO"] = bill_id + else: + params["BILL_ID"] = bill_id # Filter out None values params = {k: v for k, v in params.items() if v is not None} @@ -322,20 +328,12 @@ async def get_bill_details(self, bill_id: str, age: str | None = None) -> BillDe target_bill = bills[0] else: # Strategy: Try to find the bill in recent sessions - # If bill_id looks like a numeric ID (e.g. 2214308), we can't search by BILL_ID in - # get_bill_info because get_bill_info expects the alphanumeric ID (PRC_...). - # However, we can try to find it by BILL_NO if we had a way to search by BILL_NO. - # The current get_bill_info implementation maps `bill_id` arg to `BILL_ID` param. - - # Heuristic: If ID is numeric and length is around 7, it's likely a BILL_NO. - is_numeric_id = bill_id.isdigit() and len(bill_id) < 10 - - if not is_numeric_id: - for probe_age in ["22", "21"]: - bills = await self.get_bill_info(age=probe_age, bill_id=bill_id) - if bills: - target_bill = bills[0] - break + # Now that get_bill_info supports BILL_NO, we can try searching directly + for probe_age in ["22", "21"]: + bills = await self.get_bill_info(age=probe_age, bill_id=bill_id) + if bills: + target_bill = bills[0] + break # If we didn't find a bill object but have a numeric ID, we might still be able to fetch # details directly using the numeric ID as BILL_NO. diff --git a/uv.lock b/uv.lock index 632858a..8ba7068 100644 --- a/uv.lock +++ b/uv.lock @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "assemblymcp" -version = "0.2.3" +version = "0.2.4" source = { editable = "." } dependencies = [ { name = "assembly-api-client" },