Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Jan 8, 2026

Summary by CodeRabbit

  • Refactor
    • Removed URL content enrichment from message processing. The system no longer extracts and enriches prompts with content from external URLs. Message token calculations have been simplified accordingly.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

The PR removes URL content enrichment functionality from the message processing pipeline. This includes eliminating the urlResults parameter from preparePromptContent, removing ContentEnricher logic, and narrowing the return type of processUserMessageContent to exclude URL-related data across three presenter layer files.

Changes

Cohort / File(s) Summary
Message building core logic
src/main/presenter/agentPresenter/message/messageBuilder.ts
Removed urlResults parameter from PreparePromptContentParams interface and function signature; eliminated ContentEnricher import and enrichedUserMessage processing logic; simplified token calculation to account only for userContent.
Message processing integration
src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
Narrowed processUserMessageContent() return type from { userContent, urlResults, imageFiles } to { userContent, imageFiles }; removed URL enrichment processing and all references to urlResults throughout data flow; removed ContentEnricher and normalization-related imports.
Utility call sites
src/main/presenter/agentPresenter/utility/utilityHandler.ts
Removed empty urlResults: [] field from the argument object passed to preparePromptContent in getMessageRequestPreview().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • feat: better system prompt #1258: Modifies preparePromptContent() signature in the same file (messageBuilder.ts), indicating related changes to the core message preparation logic.

Poem

A rabbit hops through cleaner code,
Shedding URL-enrichment's load,
Simpler tokens, lighter flow—
Less complexity, more we know! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing URL extraction/enrichment logic from multiple files across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b0d392 and 26ea81c.

📒 Files selected for processing (3)
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/utility/utilityHandler.ts
💤 Files with no reviewable changes (1)
  • src/main/presenter/agentPresenter/utility/utilityHandler.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for logs and comments in TypeScript/JavaScript code

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use TypeScript with strict type checking enabled

Use OxLint for linting JavaScript and TypeScript files; ensure lint-staged hooks and typecheck pass before commits

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/main/presenter/**/*.ts: Use EventBus to broadcast events from main to renderer via mainWindow.webContents.send()
Implement one presenter per functional domain in the main process

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
src/main/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/main/**/*.ts: Use EventBus from src/main/eventbus.ts for decoupled inter-process communication
Context isolation must be enabled with preload scripts for secure IPC communication

Electron main process code should reside in src/main/, with presenters organized in presenter/ subdirectory (Window, Tab, Thread, Mcp, Config, LLMProvider), and app events managed via eventbus.ts

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
**/*.{js,ts,tsx,jsx,vue,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

All logs and comments must be in English

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
**/*.{js,ts,tsx,jsx,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Use OxLint as the linter

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
**/*.{js,ts,tsx,jsx,vue,json,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Use Prettier as the code formatter

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,vue}: Use camelCase for variable and function names; use PascalCase for types and classes; use SCREAMING_SNAKE_CASE for constants
Configure Prettier with single quotes, no semicolons, and line width of 100 characters. Run pnpm run format after completing features

Files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
🧠 Learnings (3)
📚 Learning: 2025-06-21T15:49:17.044Z
Learnt from: neoragex2002
Repo: ThinkInAIXYZ/deepchat PR: 550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both `text` and `content` properties in the `handleMeetingInstruction` function's `sendMessage` call, even though they are redundant, rather than removing the `content` property.

Applied to files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
📚 Learning: 2026-01-05T02:40:52.831Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-05T02:40:52.831Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Custom prompts are managed independently of MCP through config data source using `configPresenter.getCustomPrompts()`

Applied to files:

  • src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts
  • src/main/presenter/agentPresenter/message/messageBuilder.ts
📚 Learning: 2026-01-05T02:40:52.831Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-05T02:40:52.831Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/**/*.ts : MCP tool implementations must be registered in `mcpPresenter/index.ts` after implementation

Applied to files:

  • src/main/presenter/agentPresenter/message/messageBuilder.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-check (x64)
🔇 Additional comments (4)
src/main/presenter/agentPresenter/message/messageBuilder.ts (1)

112-112: LGTM: Token calculation correctly simplified.

The token calculation now only counts userContent, which accurately reflects the removal of URL enrichment content from the message pipeline.

src/main/presenter/agentPresenter/streaming/streamGenerationHandler.ts (3)

12-12: LGTM: Import cleanup is consistent with URL enrichment removal.

The imports have been appropriately simplified to include only the functions needed after removing the ContentEnricher and URL processing logic.


87-89: LGTM: Return value destructuring correctly updated.

The destructuring of processUserMessageContent now correctly extracts only userContent and imageFiles, matching the narrowed return type and eliminating URL-related data.


469-483: No issues found. The single call site at line 87 is already correctly updated to destructure the new return structure { userContent, imageFiles }, and there are no stale references to urlResults in the codebase.


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.

@zerob13 zerob13 merged commit cf25523 into dev Jan 8, 2026
2 checks passed
zerob13 added a commit that referenced this pull request Jan 8, 2026
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.

2 participants