Skip to content

fix: support component brwoser - #16848

Merged
yuzhichang merged 3 commits into
infiniflow:mainfrom
Haruko386:master
Jul 13, 2026
Merged

yuzhichang merged 3 commits into
infiniflow:mainfrom
Haruko386:master

Conversation

@Haruko386

Copy link
Copy Markdown
Member

Summary

As title
Unable to test it since I don't have apiKey for openai , Anthropic and Gemini


image

@Haruko386 Haruko386 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 13, 2026
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48facbaf-ecce-4e5d-9c22-768d618bb71c

📥 Commits

Reviewing files that changed from the base of the PR and between db2529b and 1e12166.

📒 Files selected for processing (3)
  • internal/agent/component/browser.go
  • internal/agent/component/browser_test.go
  • internal/agent/component/categorize_test.go

📝 Walkthrough

Walkthrough

Browser extraction now reads tenant_id, supports prompt overrides, resolves tenant models with legacy fallback, normalizes Stagehand model and base URL values, enriches runtime errors, and supplies model options for extraction and task execution. Tests cover the updated flow and helper behavior.

Changes

Browser extraction resolution

Layer / File(s) Summary
Browser invocation and model resolution
internal/agent/component/browser.go
Invocation reads tenant-scoped state, supports prompt overrides, resolves provider/model credentials with fallback, normalizes model names and base URLs, and adds contextual extraction errors.
Stagehand task and extraction model configuration
internal/agent/component/stagehand_runtime.go
Task and extraction requests construct OpenAI-compatible model options and omit whitespace-only base URLs.
Browser and Stagehand configuration tests
internal/agent/component/browser_test.go, internal/agent/component/stagehand_runtime_test.go, internal/agent/component/categorize_test.go
Tests cover tenant state, request forwarding, model resolution, contextual errors, provider mappings, URL sanitization, model naming, extraction options, and TenantModel schema setup.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant TenantModel
  participant TenantLLM
  participant Stagehand
  Browser->>TenantModel: Resolve tenant model configuration
  TenantModel-->>Browser: Provider, model, credentials, base URL
  Browser->>TenantLLM: Fallback legacy tenant_llm resolution
  TenantLLM-->>Browser: Legacy model configuration
  Browser->>Stagehand: Run extraction with normalized model options
  Stagehand-->>Browser: Result or contextual error
Loading

Possibly related PRs

Suggested reviewers: wangq8, xugangqiang

Poem

I’m a rabbit tuning models bright,
Tenant paths now lead just right.
Prompts hop in, URLs trim,
Stagehand’s options follow him.
Errors bloom with clues to share—
Tests leave carrots everywhere.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is mostly generic and does not explain the PR purpose or background beyond repeating the title. Replace it with a brief summary of the browser changes and include the problem being solved, key behavior changes, and any relevant context from the screenshot.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main browser support changes, even with a typo.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@Haruko386
Haruko386 marked this pull request as draft July 13, 2026 05:24
@Haruko386
Haruko386 marked this pull request as ready for review July 13, 2026 05:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/agent/component/browser.go`:
- Around line 439-446: Update the doc comment above resolveBrowserLLM to remove
the migration/compatibility explanation about older DSLs, tenant_llm, and
fallback lookup; retain only concise documentation of the current runtime
behavior and relevant test override details.
- Around line 299-302: Update the output map’s `"prompt"` value in the browser
component to use the resolved `prompts` variable instead of `b.param.Prompts`,
so it reflects any non-empty `inputs["prompts"]` override while preserving the
configured default otherwise.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9cb15faa-bdf8-40be-96f4-499ca29ed554

📥 Commits

Reviewing files that changed from the base of the PR and between ed27b5f and e4dd35d.

📒 Files selected for processing (4)
  • internal/agent/component/browser.go
  • internal/agent/component/browser_test.go
  • internal/agent/component/stagehand_runtime.go
  • internal/agent/component/stagehand_runtime_test.go

Comment thread internal/agent/component/browser.go Resolved
Comment thread internal/agent/component/browser.go Resolved
@Haruko386
Haruko386 marked this pull request as draft July 13, 2026 06:43
@Haruko386
Haruko386 marked this pull request as ready for review July 13, 2026 08:05
@yuzhichang
yuzhichang merged commit 466f33e into infiniflow:main Jul 13, 2026
3 checks passed
@Haruko386
Haruko386 deleted the master branch July 16, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants