Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Oct 27, 2025

Summary

  • add an empty system prompt option and clear actions in the system prompt settings UI
  • allow the config presenter to persist the new empty system prompt selection
  • localize the empty system prompt labels across the existing promptSetting translations

Testing

  • pnpm run lint

https://chatgpt.com/codex/tasks/task_e_68ff77b674c8832ca3d7602f401b3168

Summary by CodeRabbit

  • New Features

    • Option to start conversations without a system prompt ("No System Prompt"), empty-state UI, and live updates when the default system prompt changes.
  • Localization

    • Added translations for the empty-system-prompt option and description across multiple locales.
  • Bug Fixes / UX

    • Improved default-prompt selection and fallback behavior when switching to/from the empty option.
  • Chores

    • Removed legacy "clear" prompt-related translation strings in several locales.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Adds an explicit "no system prompt" option end-to-end: presenter accepts an 'empty' default ID and clears stored system prompt state; settings UI exposes an empty option and disables editing when selected; i18n entries for the empty option were added and several clear-related settings translations were removed.

Changes

Cohort / File(s) Summary
Presenter: config logic
src/main/presenter/configPresenter/index.ts
Handle promptId === 'empty' in setDefaultSystemPromptId to clear default flags and persisted system prompt, emit an empty payload to renderers and return; when setting a real default, mark isDefault, persist and call setDefaultSystemPrompt; change getDefaultSystemPromptId fallback to return 'empty' when stored default is missing/empty.
Renderer: System Prompt settings UI
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
Introduce EMPTY_SYSTEM_PROMPT_ID and an empty selectable option; build selectableSystemPrompts; render empty-state description and disable editor when selected; update handlers to clear currentSystemPrompt, toggle isDefault flags, guard save/update for empty selection, and show error toast on save failure.
Renderer: NewThread IPC listener
src/renderer/src/components/NewThread.vue
Add IPC subscription to CONFIG_EVENTS.DEFAULT_SYSTEM_PROMPT_CHANGED, update systemPrompt from IPC payload and clean up listener on unmount.
Events: new event constant
src/main/events.ts, src/renderer/src/events.ts
Add DEFAULT_SYSTEM_PROMPT_CHANGED / 'config:default-system-prompt-changed' to config events (trailing commas adjusted).
i18n: promptSetting additions
src/renderer/src/i18n/*/promptSetting.json
src/renderer/src/i18n/en-US/promptSetting.json, fa-IR, fr-FR, ja-JP, ko-KR, pt-BR, ru-RU, zh-CN, zh-HK, zh-TW
Add emptySystemPromptOption and emptySystemPromptDescription keys (label and helper text) across listed locales to support the "No System Prompt" option and description.
i18n: settings keys removed/updated
src/renderer/src/i18n/*/settings.json
Remove or trim various promptSetting.clear, promptSetting.clearSuccess, promptSetting.clearFailed and related keys across multiple locales; some locales add/retain resetToDefaultFailed or adjust presence of reset-related keys.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as SystemPromptSettingsSection (renderer)
    participant Presenter as configPresenter (main)

    User->>UI: Open dropdown / select option
    UI->>UI: build selectableSystemPrompts (includes "empty")
    alt Select "No System Prompt" (id: 'empty')
      User->>UI: select 'empty'
      UI->>Presenter: setDefaultSystemPromptId('empty')
      activate Presenter
      Presenter->>Presenter: clear default flags & persisted systemPrompt
      Presenter-->>UI: emit DEFAULT_SYSTEM_PROMPT_CHANGED { id: 'empty', content: '' }
      deactivate Presenter
      UI->>UI: render empty description, disable editor
    else Select real prompt
      User->>UI: select prompt 'xyz'
      UI->>Presenter: setDefaultSystemPromptId('xyz')
      activate Presenter
      Presenter->>Presenter: mark isDefault, persist, call setDefaultSystemPrompt(content)
      Presenter-->>UI: emit DEFAULT_SYSTEM_PROMPT_CHANGED { id: 'xyz', content }
      deactivate Presenter
      UI->>UI: render editor with content
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Pay attention to:
    • src/main/presenter/configPresenter/index.ts — persisted state changes, early-return correctness, and emitted payload shape.
    • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue — UI state transitions, save-guards for the empty option, and error-toast paths.
    • IPC event additions and listener lifecycle in NewThread.vue.
    • Consistency of new/removed i18n keys across locales.

Possibly related PRs

Poem

🐰
I hop where prompts once firmly stood,
I leave a gentle quiet, soft and good.
Empty space for new chats to start,
A calming pause, a brand-new art.
Hooray — a blank to warm the heart. ✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: add empty system prompt option" accurately and directly describes the main change in the changeset. The primary objective is to introduce a new empty system prompt option in the UI that allows users to opt out of having a default system prompt, which is reflected in the UI modifications to SystemPromptSettingsSection.vue, the backend logic changes in configPresenter/index.ts, and the supporting translations across multiple i18n files. The title is specific, concise, and avoids unnecessary noise while clearly conveying the feature being implemented.
✨ 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 codex/add-clear-option-for-empty-system-prompt

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.

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: 1

🧹 Nitpick comments (4)
src/main/presenter/configPresenter/index.ts (2)

1419-1424: Deduplicate sentinel with a shared constant.

Avoid magic string 'empty' across main/renderer. Define a single exported constant and reuse here to prevent drift.

@@
-  async setDefaultSystemPromptId(promptId: string): Promise<void> {
+  const EMPTY_SYSTEM_PROMPT_ID = 'empty' as const
+  async setDefaultSystemPromptId(promptId: string): Promise<void> {
@@
-    if (promptId === 'empty') {
+    if (promptId === EMPTY_SYSTEM_PROMPT_ID) {
       await this.setSystemPrompts(updatedPrompts)
       await this.clearSystemPrompt()
       return
     }
@@
-      await this.setDefaultSystemPrompt(updatedPrompts[targetIndex].content)
+      await this.setDefaultSystemPrompt(updatedPrompts[targetIndex].content)

Also applies to: 1429-1432


1438-1448: Harden fallback to avoid phantom 'default' IDs.

If the 'default' prompt was removed, returning 'default' yields a non-existent selection. Prefer returning 'empty' when not found.

-    return prompts.find((p) => p.id === 'default')?.id || 'default'
+    const defaultId = prompts.find((p) => p.id === 'default')?.id
+    return defaultId ?? 'empty'
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (2)

111-118: Prefer type alias over interface per guideline.

Project guideline prefers types over interfaces. Consider:

-interface SystemPromptItem {
-type SystemPromptItem = {
   id: string
   name: string
   content: string
   isDefault?: boolean
   createdAt?: number
   updatedAt?: number
-}
+}

Also applies to: 141-149


154-167: Single source for sentinel ID across app.

Renderer defines EMPTY_SYSTEM_PROMPT_ID; main uses a raw 'empty'. Export a shared constant (e.g., @shared/constants) and import it here and in ConfigPresenter to avoid drift.

Also applies to: 168-175

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6fe43d and 70178f0.

📒 Files selected for processing (12)
  • src/main/presenter/configPresenter/index.ts (1 hunks)
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (5 hunks)
  • src/renderer/src/i18n/en-US/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/pt-BR/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/promptSetting.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/promptSetting.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (18)
src/renderer/src/**/*

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system

Files:

  • src/renderer/src/i18n/zh-TW/promptSetting.json
  • src/renderer/src/i18n/ko-KR/promptSetting.json
  • src/renderer/src/i18n/zh-CN/promptSetting.json
  • src/renderer/src/i18n/pt-BR/promptSetting.json
  • src/renderer/src/i18n/fa-IR/promptSetting.json
  • src/renderer/src/i18n/ru-RU/promptSetting.json
  • src/renderer/src/i18n/zh-HK/promptSetting.json
  • src/renderer/src/i18n/en-US/promptSetting.json
  • src/renderer/src/i18n/fr-FR/promptSetting.json
  • src/renderer/src/i18n/ja-JP/promptSetting.json
src/renderer/src/**

📄 CodeRabbit inference engine (AGENTS.md)

Place Vue 3 app source under src/renderer/src (components, stores, views, i18n, lib)

Files:

  • src/renderer/src/i18n/zh-TW/promptSetting.json
  • src/renderer/src/i18n/ko-KR/promptSetting.json
  • src/renderer/src/i18n/zh-CN/promptSetting.json
  • src/renderer/src/i18n/pt-BR/promptSetting.json
  • src/renderer/src/i18n/fa-IR/promptSetting.json
  • src/renderer/src/i18n/ru-RU/promptSetting.json
  • src/renderer/src/i18n/zh-HK/promptSetting.json
  • src/renderer/src/i18n/en-US/promptSetting.json
  • src/renderer/src/i18n/fr-FR/promptSetting.json
  • src/renderer/src/i18n/ja-JP/promptSetting.json
src/renderer/src/i18n/**/*.{ts,json,yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Store i18n resources under src/renderer/src/i18n

Files:

  • src/renderer/src/i18n/zh-TW/promptSetting.json
  • src/renderer/src/i18n/ko-KR/promptSetting.json
  • src/renderer/src/i18n/zh-CN/promptSetting.json
  • src/renderer/src/i18n/pt-BR/promptSetting.json
  • src/renderer/src/i18n/fa-IR/promptSetting.json
  • src/renderer/src/i18n/ru-RU/promptSetting.json
  • src/renderer/src/i18n/zh-HK/promptSetting.json
  • src/renderer/src/i18n/en-US/promptSetting.json
  • src/renderer/src/i18n/fr-FR/promptSetting.json
  • src/renderer/src/i18n/ja-JP/promptSetting.json
**/*.{ts,tsx,js,jsx,vue,css,scss,md,json,yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Prettier style: single quotes, no semicolons, print width 100; run pnpm run format

Files:

  • src/renderer/src/i18n/zh-TW/promptSetting.json
  • src/renderer/src/i18n/ko-KR/promptSetting.json
  • src/renderer/src/i18n/zh-CN/promptSetting.json
  • src/renderer/src/i18n/pt-BR/promptSetting.json
  • src/renderer/src/i18n/fa-IR/promptSetting.json
  • src/renderer/src/i18n/ru-RU/promptSetting.json
  • src/renderer/src/i18n/zh-HK/promptSetting.json
  • src/renderer/src/i18n/en-US/promptSetting.json
  • src/renderer/src/i18n/fr-FR/promptSetting.json
  • src/main/presenter/configPresenter/index.ts
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
  • src/renderer/src/i18n/ja-JP/promptSetting.json
**/*.{js,jsx,ts,tsx}

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

**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写

Files:

  • src/main/presenter/configPresenter/index.ts
src/{main,renderer}/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging

Files:

  • src/main/presenter/configPresenter/index.ts
src/main/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

Use Electron's built-in APIs for file system and native dialogs

Files:

  • src/main/presenter/configPresenter/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-logging.mdc)

**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别

Files:

  • src/main/presenter/configPresenter/index.ts
src/main/**/*.{ts,js,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

主进程代码放在 src/main

Files:

  • src/main/presenter/configPresenter/index.ts
**/*.{ts,tsx,js,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Enable and adhere to strict TypeScript typing (avoid implicit any, prefer precise types)

Use PascalCase for TypeScript types and classes

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Place Electron main-process presenters under src/main/presenter/ (Window, Tab, Thread, Mcp, Config, LLMProvider)

Files:

  • src/main/presenter/configPresenter/index.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,vue}: Use OxLint for JS/TS code; keep lint clean
Use camelCase for variables and functions
Use SCREAMING_SNAKE_CASE for constants

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

渲染进程代码放在 src/renderer

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{vue,ts}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Implement lazy loading for routes and components.

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{ts,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.

Use Pinia for frontend state management (do not introduce alternative state libraries)

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

Name Vue component files in PascalCase (e.g., ChatInput.vue)

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
🪛 GitHub Actions: PR Check
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue

[error] 1-1: Prettier formatting check failed for src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue. Run 'prettier --write' to fix. The check was triggered by 'pnpm run format:check' and exited with code 1.

🔇 Additional comments (13)
src/renderer/src/i18n/fr-FR/promptSetting.json (1)

79-80: Localization key placement and translation look good.

The new French translations for the empty system prompt option are semantically clear and properly positioned within the file structure.

src/renderer/src/i18n/zh-TW/promptSetting.json (1)

76-77: Traditional Chinese translations are consistent and properly placed.

The new translation keys maintain terminology consistency with existing system prompt strings in the file.

src/renderer/src/i18n/zh-CN/promptSetting.json (1)

79-80: Simplified Chinese translations are clear and consistent.

The new keys follow established terminology patterns in the file with proper regional Chinese character conventions.

src/renderer/src/i18n/ja-JP/promptSetting.json (1)

76-77: Japanese translations are grammatically sound and semantically clear.

The new localization keys maintain consistency with existing Japanese prompt management terminology in the file.

src/renderer/src/i18n/pt-BR/promptSetting.json (1)

79-80: Portuguese (Brazil) translations are natural and properly integrated.

The new keys fit seamlessly within the existing prompt management terminology used throughout the file.

src/renderer/src/i18n/fa-IR/promptSetting.json (1)

76-77: Persian translations are properly formatted and semantically aligned.

The new keys follow established terminology conventions in the Persian locale file.

src/renderer/src/i18n/ru-RU/promptSetting.json (1)

76-77: Russian translations are grammatically correct and consistent with existing terminology.

The new keys integrate well within the Russian locale's system prompt management strings.

src/renderer/src/i18n/ko-KR/promptSetting.json (1)

76-77: Korean translations are clear and maintain terminology consistency.

The new localization keys follow established conventions in the Korean prompt management UI strings.

src/renderer/src/i18n/en-US/promptSetting.json (1)

79-80: LGTM: new empty-option strings are clear and consistent.

src/renderer/src/i18n/zh-HK/promptSetting.json (1)

76-77: LGTM: empty-option translations look good.

src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (3)

18-24: LGTM: empty option injected at the top via selectableSystemPrompts.


44-49: Empty‑state UX verified and approved.

All locale keys (promptSetting.emptySystemPromptDescription) are present across 10 supported languages. Prettier formatting applied successfully. Code correctly handles empty selection by displaying description and avoiding edit UI. No issues found.


1-390: No formatting issues found.

The file passes Prettier's code style checks and is already properly formatted according to the repository guidelines (single quotes, no semicolons, width 100). The original review comment's claim that the Prettier check is failing is inaccurate.

Likely an incorrect or invalid review comment.

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: 0

♻️ Duplicate comments (2)
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (2)

23-29: i18n key inconsistency (already flagged).

The past review comment has already identified the issue with t('settings.promptSetting.clear') - it should use promptSetting.clear to match the namespace used elsewhere in this component.


207-225: i18n key inconsistency (already flagged).

The past review comment has already identified the issue with t('settings.promptSetting.clearSuccess') and t('settings.promptSetting.clearFailed') at lines 214 and 221 - these should use the promptSetting.* namespace.

🧹 Nitpick comments (1)
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (1)

227-231: Remove redundant state updates.

Lines 229-230 manually set state that applyEmptySystemPromptloadSystemPromptsupdateCurrentSystemPrompt already handles. The manual assignments are unnecessary and could lead to inconsistencies if the loading logic changes.

Apply this diff:

 const handleClearSystemPrompt = async () => {
   await applyEmptySystemPrompt(true)
-  selectedSystemPromptId.value = EMPTY_SYSTEM_PROMPT_ID
-  currentSystemPrompt.value = null
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70178f0 and 89b68f4.

📒 Files selected for processing (1)
  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (5 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
src/renderer/**/*.{vue,ts,js,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

渲染进程代码放在 src/renderer

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{vue,ts}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Implement lazy loading for routes and components.

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.{ts,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.

Use Pinia for frontend state management (do not introduce alternative state libraries)

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
**/*.{ts,tsx,js,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Enable and adhere to strict TypeScript typing (avoid implicit any, prefer precise types)

Use PascalCase for TypeScript types and classes

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
**/*.{ts,tsx,js,jsx,vue,css,scss,md,json,yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Prettier style: single quotes, no semicolons, print width 100; run pnpm run format

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,vue}: Use OxLint for JS/TS code; keep lint clean
Use camelCase for variables and functions
Use SCREAMING_SNAKE_CASE for constants

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

Name Vue component files in PascalCase (e.g., ChatInput.vue)

Files:

  • src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue
⏰ 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 (7)
src/renderer/settings/components/prompt/SystemPromptSettingsSection.vue (7)

18-22: LGTM!

The dropdown now correctly uses selectableSystemPrompts which includes the empty option.


35-39: LGTM!

The empty state description provides good UX feedback and uses the correct i18n namespace.


41-41: LGTM!

Correctly changed to v-else-if to ensure the textarea block and empty description block are mutually exclusive.


103-103: LGTM!

Added computed import as required for the new computed properties.


145-166: LGTM!

The constant and computed properties follow TypeScript and naming conventions correctly. The empty option is properly typed as SystemPromptItem and integrated into the selectable prompts list.


179-182: LGTM!

Correctly guards against the empty prompt selection and clears the current system prompt.


190-193: LGTM!

Correctly handles the empty prompt selection and appropriately suppresses the toast notification when changed via dropdown.

@zerob13
Copy link
Collaborator Author

zerob13 commented Oct 27, 2025

fix #1055

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6438db and db8a658.

📒 Files selected for processing (4)
  • src/main/events.ts (1 hunks)
  • src/main/presenter/configPresenter/index.ts (1 hunks)
  • src/renderer/src/components/NewThread.vue (3 hunks)
  • src/renderer/src/events.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/presenter/configPresenter/index.ts
🧰 Additional context used
📓 Path-based instructions (21)
**/*.{js,jsx,ts,tsx}

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

**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写

Files:

  • src/renderer/src/events.ts
  • src/main/events.ts
src/{main,renderer}/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging

Files:

  • src/renderer/src/events.ts
  • src/main/events.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-logging.mdc)

**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别

Files:

  • src/renderer/src/events.ts
  • src/main/events.ts
src/renderer/src/**/*

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)

src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/**/*.{vue,ts}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Implement lazy loading for routes and components.

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/**/*.{ts,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.

Use Pinia for frontend state management (do not introduce alternative state libraries)

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
**/*.{ts,tsx,js,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
  • src/main/events.ts
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Enable and adhere to strict TypeScript typing (avoid implicit any, prefer precise types)

Use PascalCase for TypeScript types and classes

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
  • src/main/events.ts
src/renderer/src/**

📄 CodeRabbit inference engine (AGENTS.md)

Place Vue 3 app source under src/renderer/src (components, stores, views, i18n, lib)

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
src/renderer/src/**/*.{vue,ts}

📄 CodeRabbit inference engine (AGENTS.md)

All user-facing strings must use vue-i18n ($t/keys) rather than hardcoded literals

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
**/*.{ts,tsx,js,jsx,vue,css,scss,md,json,yml,yaml}

📄 CodeRabbit inference engine (AGENTS.md)

Prettier style: single quotes, no semicolons, print width 100; run pnpm run format

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
  • src/main/events.ts
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,vue}: Use OxLint for JS/TS code; keep lint clean
Use camelCase for variables and functions
Use SCREAMING_SNAKE_CASE for constants

Files:

  • src/renderer/src/events.ts
  • src/renderer/src/components/NewThread.vue
  • src/main/events.ts
src/renderer/src/**/*.vue

📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)

Use scoped styles to prevent CSS conflicts between components

Files:

  • src/renderer/src/components/NewThread.vue
src/renderer/{src,shell,floating}/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/{src,shell,floating}/**/*.vue: Use Vue 3 Composition API for all components
All user-facing strings must use i18n keys via vue-i18n (no hard-coded UI strings)
Use Tailwind CSS utilities and ensure styles are scoped in Vue components

Files:

  • src/renderer/src/components/NewThread.vue
src/renderer/src/components/**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Organize UI components by feature within src/renderer/src/

Files:

  • src/renderer/src/components/NewThread.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

Name Vue component files in PascalCase (e.g., ChatInput.vue)

Files:

  • src/renderer/src/components/NewThread.vue
src/main/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

Use Electron's built-in APIs for file system and native dialogs

Files:

  • src/main/events.ts
src/main/**/*.{ts,js,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

主进程代码放在 src/main

Files:

  • src/main/events.ts
🔇 Additional comments (5)
src/main/events.ts (1)

37-38: LGTM!

The new event constant follows the established naming convention and is properly integrated into the CONFIG_EVENTS object. The trailing comma addition improves maintainability for future changes.

src/renderer/src/events.ts (1)

27-28: LGTM!

The event constant correctly mirrors the main process definition, ensuring proper IPC communication. The event string matches exactly with src/main/events.ts line 38, which is essential for cross-process event handling.

src/renderer/src/components/NewThread.vue (3)

107-107: LGTM!

The new imports are necessary for the IPC integration: onBeforeUnmount enables proper listener cleanup, IpcRendererEvent provides correct typing, and CONFIG_EVENTS supplies the event constant. All are properly utilized in the component.

Also applies to: 113-114


400-405: LGTM!

The IPC listener registration properly uses optional chaining to guard against missing Electron APIs and subscribes to the correct event. The placement after the initial system prompt fetch (lines 407-409) ensures proper initialization order.


414-419: LGTM!

The listener cleanup in onBeforeUnmount properly prevents memory leaks by removing the IPC listener. The optional chaining ensures safe cleanup even if the Electron API is unavailable, and the event constant and handler correctly match the registration.

Comment on lines +155 to +166
const handleDefaultSystemPromptChange = async (
_event: IpcRendererEvent,
payload: { promptId?: string; content?: string }
) => {
if (typeof payload?.content === 'string') {
systemPrompt.value = payload.content
return
}

const prompt = await configPresenter.getDefaultSystemPrompt()
systemPrompt.value = prompt
}
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 | 🟠 Major

Add error handling for async call.

The configPresenter.getDefaultSystemPrompt() call (line 164) lacks error handling. As per coding guidelines, async operations should be wrapped in try-catch blocks to handle potential errors gracefully.

Apply this diff to add error handling:

 const handleDefaultSystemPromptChange = async (
   _event: IpcRendererEvent,
   payload: { promptId?: string; content?: string }
 ) => {
   if (typeof payload?.content === 'string') {
     systemPrompt.value = payload.content
     return
   }
 
-  const prompt = await configPresenter.getDefaultSystemPrompt()
-  systemPrompt.value = prompt
+  try {
+    const prompt = await configPresenter.getDefaultSystemPrompt()
+    systemPrompt.value = prompt
+  } catch (error) {
+    console.error('Failed to get default system prompt:', error)
+  }
 }

Based on coding guidelines.

📝 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
const handleDefaultSystemPromptChange = async (
_event: IpcRendererEvent,
payload: { promptId?: string; content?: string }
) => {
if (typeof payload?.content === 'string') {
systemPrompt.value = payload.content
return
}
const prompt = await configPresenter.getDefaultSystemPrompt()
systemPrompt.value = prompt
}
const handleDefaultSystemPromptChange = async (
_event: IpcRendererEvent,
payload: { promptId?: string; content?: string }
) => {
if (typeof payload?.content === 'string') {
systemPrompt.value = payload.content
return
}
try {
const prompt = await configPresenter.getDefaultSystemPrompt()
systemPrompt.value = prompt
} catch (error) {
console.error('Failed to get default system prompt:', error)
}
}
🤖 Prompt for AI Agents
In src/renderer/src/components/NewThread.vue around lines 155 to 166, the async
call to configPresenter.getDefaultSystemPrompt() lacks error handling; wrap the
await call in a try-catch, assign systemPrompt.value to the fetched prompt on
success, and in the catch log the error (using the component/logger utility or
console.error) and set systemPrompt.value to a sensible fallback (e.g., empty
string or existing default) so the UI remains stable.

@zerob13 zerob13 merged commit d74c911 into dev Oct 27, 2025
2 checks passed
@zerob13
Copy link
Collaborator Author

zerob13 commented Oct 27, 2025

close #1055

@zerob13 zerob13 deleted the codex/add-clear-option-for-empty-system-prompt branch November 6, 2025 10:52
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