Skip to content

fix rust example ui#82

Merged
RadeenXALNW merged 1 commit into
mainfrom
rad/rust_example
Nov 8, 2025
Merged

fix rust example ui#82
RadeenXALNW merged 1 commit into
mainfrom
rad/rust_example

Conversation

@RadeenXALNW
Copy link
Copy Markdown
Collaborator

@RadeenXALNW RadeenXALNW commented Nov 8, 2025

Summary by CodeRabbit

  • New Features

    • Agent ID is now automatically managed internally; users no longer need to provide it during setup.
  • Updates

    • Simplified configuration interface by removing the agent ID input field.
    • API connections now use relative paths for better portability.
    • Server startup is more flexible with improved port handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR removes the agent_id parameter from the lead-agent application. The backend replaces dynamic agent_id handling with a hardcoded RUNAGENT_ID constant, while the frontend removes agent_id from its state and API requests. The frontend also switches from hardcoded localhost URLs to relative paths, and the vite configuration enables port fallback for development.

Changes

Cohort / File(s) Summary
Backend agent_id removal and RunAgent integration
examples/lead-agent/backend-rust/src/main.rs
Introduces RUNAGENT_ID constant; changes ScoreLeadsRequest.agent_id and ScoreSingleRequest.agent_id from String to Option<String> with deprecation comments; removes agent_id validation; replaces request.agent_id with hardcoded RUNAGENT_ID in client initialization; adds candidate JSON normalization with debug logging; enhances RunAgent result logging with JSON parsing and fallback handling; expands CORS allowed origins to include port 5174 variants.
Frontend agent_id state and API changes
examples/lead-agent/frontend/src/App.tsx
Removes RunAgent agent_id state, UI input field, and related help text from Configuration step; removes agent_id from API request payload; changes API endpoint from hardcoded localhost URL to relative path (/api/score-leads); simplifies Continue button disabled state logic to remove agentId dependency.
Development server configuration
examples/lead-agent/frontend/vite.config.ts
Changes strictPort setting from true to false to enable automatic fallback to next available port on startup.

Sequence Diagram

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant RunAgent

    Note over Frontend: Old: User enters agent_id in UI
    Note over Frontend: New: agent_id removed from UI

    User->>Frontend: Upload candidates & job description
    Frontend->>Frontend: Form validation (no agent_id required)
    Frontend->>Backend: POST /api/score-leads (candidates, job_description, top_n, generate_emails)
    
    Note over Backend: Uses hardcoded RUNAGENT_ID constant
    Backend->>Backend: Normalize candidate JSON
    Backend->>RunAgent: Call with RUNAGENT_ID (not from request)
    RunAgent-->>Backend: Results
    Backend->>Backend: Parse & log results as JSON
    Backend-->>Frontend: Scored results
    Frontend->>User: Display results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Agent_id API contract changes: Verify the transition from required String to optional Option<String> doesn't break existing clients; confirm deprecation comment is sufficient.
  • Hardcoded RUNAGENT_ID approach: Ensure this architectural decision aligns with intended deployment model and security posture.
  • Candidate normalization logic: Review JSON parsing robustness and edge cases for malformed candidates.
  • CORS configuration changes: Verify port 5174 variants are correct and the expansion doesn't introduce unintended access.

Possibly related PRs

Suggested reviewers

  • sawradip

Poem

🐰 Agent ID's gone, the config grows lean,
Constants now reign where variables had been!
No more localhost, just paths so divine,
Port fallback blooms—let the bunnies align! 🌸

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rad/rust_example

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29beaba and 0c98eec.

📒 Files selected for processing (3)
  • examples/lead-agent/backend-rust/src/main.rs (5 hunks)
  • examples/lead-agent/frontend/src/App.tsx (2 hunks)
  • examples/lead-agent/frontend/vite.config.ts (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RadeenXALNW RadeenXALNW merged commit 56ee39e into main Nov 8, 2025
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Nov 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant