Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Jul 17, 2025

去掉pyodide支持,改用e2b 沙盒

Summary by CodeRabbit

  • Bug Fixes

    • Removed local Python code execution functionality, including the ability to run Python scripts within the app.
    • Removed the "pyodide" dependency and related configuration.
  • Style

    • Improved code formatting and readability in several areas, including server configuration and comments.
    • Updated arrow function syntax and conditional formatting for consistency.
  • Chores

    • Cleaned up unused files and dependencies related to Python code execution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

This update removes all support for local Python code execution using Pyodide, including dependency management and code runner logic. It eliminates related dependencies and configuration, and cleans up the codebase by removing schemas, handlers, and tool registrations for Python execution. Additional changes are limited to code formatting and style improvements across several files.

Changes

File(s) Change Summary
electron.vite.config.ts, package.json Removed 'pyodide' from build config and deleted it from dependencies.
src/main/presenter/mcpPresenter/pythonRunner/index.ts, pythonRunner/prepareEnv.ts Deleted all Pyodide-based Python code execution and environment preparation logic.
src/main/presenter/mcpPresenter/inMemoryServers/powerpackServer.ts Removed all local Python execution support, schemas, handlers, and tool registration.
src/main/presenter/configPresenter/mcpConfHelper.ts, src/main/presenter/upgradePresenter/index.ts, src/renderer/src/components/message/MessageItemUser.vue, src/renderer/src/stores/upgrade.ts Minor code formatting and style adjustments only.
src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts Refactored and cleaned up code formatting; no logic changes.

Poem

🐇
Goodbye, Pyodide, you’ve hopped away,
No more Python tricks in local play.
The code is tidied, the scripts are neat,
Formatting changes—what a treat!
Now onward we bound, with lighter feet,
Toward new adventures, swift and sweet!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts (2)

760-765: this.CONFIG in static context trips lint – use the class name

Static methods rely on this.CONFIG, triggering noThisInStatic errors.
Swap to an explicit reference so it’s unambiguous and linter-clean:

- maxEventsPerCalendar: this.CONFIG.MAX_EVENTS_PER_CALENDAR
+ maxEventsPerCalendar: CalendarUtils.CONFIG.MAX_EVENTS_PER_CALENDAR

Apply the same change in getEvents and createEvent.


604-606: Downgrade expected flow logs from error to info/debug

console.error('searchEvents - Processing calendars …') is not an error.
Use an appropriate level to avoid log fatigue; reserve error for exceptional paths.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fdf288 and 6c0cfb9.

📒 Files selected for processing (10)
  • electron.vite.config.ts (2 hunks)
  • package.json (0 hunks)
  • src/main/presenter/configPresenter/mcpConfHelper.ts (2 hunks)
  • src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts (46 hunks)
  • src/main/presenter/mcpPresenter/inMemoryServers/powerpackServer.ts (0 hunks)
  • src/main/presenter/mcpPresenter/pythonRunner/index.ts (0 hunks)
  • src/main/presenter/mcpPresenter/pythonRunner/prepareEnv.ts (0 hunks)
  • src/main/presenter/upgradePresenter/index.ts (1 hunks)
  • src/renderer/src/components/message/MessageItemUser.vue (2 hunks)
  • src/renderer/src/stores/upgrade.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • package.json
  • src/main/presenter/mcpPresenter/pythonRunner/prepareEnv.ts
  • src/main/presenter/mcpPresenter/inMemoryServers/powerpackServer.ts
  • src/main/presenter/mcpPresenter/pythonRunner/index.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/renderer/src/**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/i18n.mdc
src/renderer/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/pinia-best-practices.mdc
🧠 Learnings (6)
src/main/presenter/upgradePresenter/index.ts (3)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/renderer/src/composables/usePresenter.ts : The IPC in the renderer process is implemented in usePresenter.ts, allowing direct calls to the presenter-related interfaces exposed by the main process
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use context isolation for improved security
src/renderer/src/components/message/MessageItemUser.vue (5)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use arrow functions for methods and computed properties to ensure concise and consistent syntax.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#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.
electron.vite.config.ts (1)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Node.js >= 22
src/renderer/src/stores/upgrade.ts (1)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 优雅降级处理
src/main/presenter/configPresenter/mcpConfHelper.ts (7)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use context isolation for improved security
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : `src/main/presenter/llmProviderPresenter/index.ts` should manage the overall Agent loop, conversation history, tool execution via `McpPresenter`, and communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper inter-process communication (IPC) patterns
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 优雅降级处理
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use TypeScript for all code, preferring types over interfaces, and avoid enums in favor of const objects.
src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts (4)
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Maintain separation of concerns by centralizing Agent loop logic in `index.ts` and keeping provider files focused on API interaction and event standardization.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Log和注释使用英文书写
🪛 Biome (1.9.4)
src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts

[error] 145-145: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 147-147: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 617-617: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 783-783: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 802-802: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 974-974: Using this in a static context can be confusing.

this refers to the class.
Unsafe fix: Use the class name instead.

(lint/complexity/noThisInStatic)


[error] 1873-1875: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🔇 Additional comments (11)
electron.vite.config.ts (2)

15-15: LGTM! Clean removal of Pyodide from build exclusions.

The removal of 'pyodide' from the exclude array in externalizeDepsPlugin is consistent with the PR objective to remove Pyodide support. This ensures that Pyodide is no longer treated as an exception during dependency externalization.


26-26: LGTM! Proper cleanup of Pyodide from external dependencies.

The removal of 'pyodide' from the external array in the Rollup build options is appropriate and aligns with the broader cleanup of Pyodide-related code. This ensures that Pyodide is no longer marked as an external dependency in the build process.

src/renderer/src/stores/upgrade.ts (1)

100-100: Good formatting improvement!

Adding the space after the if keyword improves code consistency and follows standard JavaScript/TypeScript formatting conventions.

src/main/presenter/upgradePresenter/index.ts (1)

233-236: Documentation formatting improvement!

Removing trailing spaces in JSDoc comments improves code cleanliness and consistency.

src/renderer/src/components/message/MessageItemUser.vue (2)

143-143: Consistent arrow function parameter syntax!

Adding parentheses around the single parameter improves code consistency and follows the project's preferred arrow function style.


161-161: Consistent arrow function parameter syntax!

Adding parentheses around the single parameter improves code consistency and follows the project's preferred arrow function style.

src/main/presenter/configPresenter/mcpConfHelper.ts (4)

34-47: Improved readability with multi-line formatting!

The multi-line formatting of the macOS platform-specific server configuration makes the code much more readable and easier to understand.


50-63: Improved readability with multi-line formatting!

The multi-line formatting of the Windows platform-specific server configuration (even though commented out) maintains consistency and readability.


66-79: Improved readability with multi-line formatting!

The multi-line formatting of the Linux platform-specific server configuration maintains consistency with the other platform configurations.


344-347: Improved readability with multi-line conditional formatting!

Breaking the complex conditional statement into multiple lines with proper indentation makes the logic much easier to follow and understand.

src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts (1)

120-126: Placeholder parsing logic – add TODO or implement real parser

The AppleScript result handling still returns hard-coded sample data.
Either implement proper parsing now or clearly mark with a TODO so callers don’t assume real data.

Comment on lines +45 to 48
console.error(
'Cannot access Contacts app. Please grant access in System Preferences > Security & Privacy > Privacy > Contacts.'
)
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace ad-hoc console.error with structured logging

Guidelines require structured logs with timestamp, level, stack-trace, etc. Direct console.error calls (here and throughout the file) break that rule and also emit error-level noise for normal control-flow situations.
Introduce a central logger (e.g. @electron/log, pino, or the project’s chosen wrapper) and emit at info/warn/error levels as appropriate.

🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts around lines
45 to 48, replace the direct console.error call with the project's centralized
structured logger. Import the logger used in the project (such as @electron/log
or pino), then log the message at an appropriate level like warn or info instead
of error, including any relevant metadata if needed. This ensures consistent,
structured logging with timestamps and levels, avoiding misuse of error logs for
normal control flow.

Comment on lines +1873 to +1878
text: `Found ${listReminders.length} reminders in list ${parsedArgs.listId}:\n\n${listReminders
.map(
(reminder) =>
`• ${reminder.name} - ${reminder.completed ? 'Completed' : 'Pending'}`
)
.join('\n')}`
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Variable leaks across switch clauses – wrap case in its own block

Lint flags that listReminders can bleed into other cases.
Wrap the entire clause in braces to constrain scope:

-        case 'listById':
+        case 'listById': {
           if (!parsedArgs.listId) {
@@
           }
           return {
@@
           }
+        }

This prevents accidental access from sibling branches and silences noSwitchDeclarations.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
text: `Found ${listReminders.length} reminders in list ${parsedArgs.listId}:\n\n${listReminders
.map(
(reminder) =>
`• ${reminder.name} - ${reminder.completed ? 'Completed' : 'Pending'}`
)
.join('\n')}`
case 'listById': {
if (!parsedArgs.listId) {
throw new Error('List ID is required');
}
const listReminders = /* existing logic to fetch reminders */;
return {
text: `Found ${listReminders.length} reminders in list ${parsedArgs.listId}:\n\n${listReminders
.map(
(reminder) =>
`• ${reminder.name} - ${reminder.completed ? 'Completed' : 'Pending'}`
)
.join('\n')}`
};
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1873-1875: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/inMemoryServers/appleServer.ts around lines
1873 to 1878, the variable listReminders declared in a switch case can leak into
other cases, causing scope issues. To fix this, wrap the entire switch case
block containing listReminders in curly braces {} to create a new block scope,
preventing the variable from being accessible outside this case and resolving
the noSwitchDeclarations lint warning.

@zerob13 zerob13 merged commit e22ad5c into dev Jul 21, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 11, 2025
@zerob13 zerob13 deleted the refactor/remove-pyodide branch September 21, 2025 15:15
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