Skip to content

Conversation

Dw9
Copy link
Contributor

@Dw9 Dw9 commented Aug 27, 2025

Pull Request Description (中文)

1、修改了一处typo
2、更新了readme
3、增加设置网页获取内容长度限制 以便获取更多的上下文 回答更精准

一个简单的例子: mcp inspector 监听所有网卡的提问 正确答案
image

但由于网页截断 原来的表现开始杜撰一些没有的参数
image

修改过后 效果达到预期
image

Summary by CodeRabbit

  • New Features

    • Added configurable "Web Content Length Limit" setting (0 = unlimited; range 0–50,000; default 3,000). Content extraction now respects this setting instead of a fixed cutoff.
  • Translations

    • Added localization entries for the new setting across multiple languages.
  • Documentation

    • Updated Supported Model Providers to include Groq with icon and link in README (EN/JP/ZH).

Copy link
Contributor

coderabbitai bot commented Aug 27, 2025

Walkthrough

Adds Groq to README provider tables and introduces a configurable webContentLengthLimit setting (default 3000) persisted in ElectronStore. Content truncation now respects this setting (0 = no limit). Adds a Settings UI control and i18n strings; minor comment change in minimaxProvider.

Changes

Cohort / File(s) Summary of changes
Docs: Supported providers
README.md, README.jp.md, README.zh.md
Insert Groq entry into the “Supported Model Providers” table; replace a previously empty cell with an icon and link to groq.com.
Config: App settings schema
src/main/presenter/configPresenter/index.ts
Add optional IAppSettings.webContentLengthLimit?: number and set default webContentLengthLimit: 3000 in ElectronStore defaults.
Content truncation logic
src/main/presenter/threadPresenter/contentEnricher.ts
Replace hardcoded truncation (3000) with configurable logic: 0 = no limit; if >0 and ≤50000 use it; on retrieval failure default to 3000.
Settings UI
src/renderer/src/components/settings/CommonSettings.vue
Add numeric input + reactive webContentLengthLimit (default 3000); load/save via configPresenter; add handler handleWebContentLengthLimitChange.
i18n additions
src/renderer/src/i18n/.../settings.json
en-US, fa-IR, fr-FR, ja-JP, ko-KR, ru-RU, zh-CN, zh-HK, zh-TW
Add keys: common.webContentLengthLimit, common.webContentLengthLimitHint, common.webContentLengthLimitTooltip (describe range 0–50000; 0 = no limit).
Provider comment tweak
src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
Minor constructor comment text updated (no functional change).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant S as Settings UI (CommonSettings.vue)
  participant C as ConfigPresenter
  participant E as ElectronStore

  U->>S: Update "Web Content Length Limit"
  S->>C: setSetting('webContentLengthLimit', value)
  C->>E: Persist value (default exists: 3000)
  E-->>C: OK
  C-->>S: OK (value stored)
  Note over S: Displays updated value (0 = unlimited, 1–50000)
Loading
sequenceDiagram
  autonumber
  participant CE as ContentEnricher
  participant C as ConfigPresenter
  participant E as ElectronStore
  participant W as WebContentSource

  CE->>W: Extract mainContent
  CE->>C: getSetting('webContentLengthLimit')
  C->>E: Read value
  E-->>C: value or undefined
  C-->>CE: value (or error)
  alt value == 0
    Note over CE: No truncation (return full content)
  else value in 1..50000
    Note over CE: Truncate to value characters
  else failure/invalid
    Note over CE: Fallback to 3000 chars
  end
  CE-->>CE: Return content (possibly truncated)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A nibble of bytes, a hop through the net,
I trim long pages—just the right set.
Zero means feast, I read every line,
Raise up the cap, I shorten the vine.
Groq joins our garden — hop, hop, let's shine! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/settings/CommonSettings.vue (1)

1-770: Fix Prettier issues breaking CI

The PR check fails on Prettier in this file. Please format to unblock CI.

Run:

pnpm run format:write
# or
pnpm run format

If you prefer a targeted fix:

  • Ensure consistent spacing around attributes and remove trailing spaces.
  • Keep imports grouped per existing conventions; Prettier will handle line wraps.
🧹 Nitpick comments (11)
src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts (1)

7-7: Use English for code comments per repo guideline.

Replace the Chinese comment with English to keep consistency.

-    // 初始化minimax AI模型配置
+    // Initialize Minimax AI model configuration
src/renderer/src/i18n/zh-HK/settings.json (1)

48-50: Nit: unify “Token” capitalization

Elsewhere in this locale file “Tokens” is capitalized. Consider “token” → “Token” for consistency.

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

48-50: Nit: unify “token” capitalization

This file often uses “Tokens”. Consider capitalizing here as well for consistency.

src/main/presenter/configPresenter/index.ts (2)

50-51: Comment language: use English per codebase guideline

Change the inline comment to English.

Apply this diff:

-  webContentLengthLimit?: number // 网页内容截断长度限制,默认3000字符
+  webContentLengthLimit?: number // Web content truncation length limit; default 3000 characters

50-51: Optional: add typed getter/setter to centralize validation and avoid “stringly-typed” access

Provide first-class APIs so callers don’t duplicate range checks or magic keys.

Example (add inside ConfigPresenter):

private static readonly WEB_LEN_MIN = 0;
private static readonly WEB_LEN_MAX = 50000;
getWebContentLengthLimit(): number {
  const v = this.getSetting<number>('webContentLengthLimit');
  if (typeof v !== 'number' || !Number.isFinite(v)) return 3000;
  if (v === 0) return 0;
  return Math.min(Math.max(v, 1), ConfigPresenter.WEB_LEN_MAX);
}
setWebContentLengthLimit(value: number): void {
  const v = Number.isFinite(value) ? Math.floor(value) : 3000;
  const clamped = v === 0 ? 0 : Math.min(Math.max(v, 1), ConfigPresenter.WEB_LEN_MAX);
  this.setSetting('webContentLengthLimit', clamped);
}

Also applies to: 113-114

src/main/presenter/threadPresenter/contentEnricher.ts (1)

181-183: Nit: comment language

Use English for comments per repo guideline.

Apply this diff:

-    } catch (error) {
-      // 忽略错误,使用默认值
-    }
+    } catch (error) {
+      // Ignore error and fall back to default lengthLimit
+    }
src/renderer/src/i18n/zh-CN/settings.json (1)

51-53: Unify “Token” capitalization to match existing CN locale usage.

Elsewhere in zh-CN we use “Token/Tokens”; align the tooltip for consistency.

-    "webContentLengthLimitTooltip": "设置从网页提取的文本内容长度上限(字符数),范围:0-50000。设置为0表示不限制长度,获取完整网页内容;较大的值可以获取更完整的网页内容,但可能增加处理时间和token消耗。",
+    "webContentLengthLimitTooltip": "设置从网页提取的文本内容长度上限(字符数),范围:0-50000。设置为0表示不限制长度,获取完整网页内容;较大的值可以获取更完整的网页内容,但可能增加处理时间和Token消耗。",
src/renderer/src/i18n/fr-FR/settings.json (1)

48-50: Style nit: capitalize “Web” when used as the medium in French.

Minor editorial tweak for standard French tech style.

-    "webContentLengthLimitTooltip": "Définir la longueur maximale du contenu textuel extrait des pages web (nombre de caractères), plage : 0-50000. Définir à 0 signifie aucune limite et récupère le contenu web complet ; des valeurs plus élevées fournissent un contenu web plus complet mais peuvent augmenter le temps de traitement et l'utilisation de jetons.",
+    "webContentLengthLimitTooltip": "Définir la longueur maximale du contenu textuel extrait des pages Web (nombre de caractères), plage : 0-50000. Définir à 0 signifie aucune limite et récupère le contenu Web complet ; des valeurs plus élevées fournissent un contenu Web plus complet mais peuvent augmenter le temps de traitement et l'utilisation de jetons.",
src/renderer/src/components/settings/CommonSettings.vue (3)

55-76: Replace hardcoded placeholder and consider a tooltip

  • The string placeholder "3000" violates the i18n rule for renderer user-visible text. Either remove it or switch to an i18n key. Also consider using the new tooltip key to surface "0 = unlimited" without cluttering the label.

Apply this minimal diff to drop the hardcoded placeholder:

           :model-value="webContentLengthLimit"
           @update:model-value="handleWebContentLengthLimitChange"
           class="text-right"
-          placeholder="3000"
         />

Optional: add a tooltip using i18n key settings.common.webContentLengthLimitTooltip next to the label. I can draft the snippet if you want it.


417-419: Use English for comments (repo-wide rule) and avoid magic numbers

  • Comment is in Chinese; the repo guideline requires English for logs/comments.
  • The default 3000 duplicates the main-side default; consider extracting a shared constant or reading on mount only to avoid drift.
-// 网页内容长度限制
+// Web content length limit (0 = unlimited)
 const webContentLengthLimit = ref(3000)

If you want, I can propose a small shared constants module to remove the duplication.


55-55: Translate HTML comment to English

Inline template comment is in Chinese; repo guideline requires English for comments.

-<!-- 网页内容长度限制 -->
+<!-- Web content length limit -->
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between be76652 and 1c5d7e5.

📒 Files selected for processing (16)
  • README.jp.md (1 hunks)
  • README.md (1 hunks)
  • README.zh.md (1 hunks)
  • src/main/presenter/configPresenter/index.ts (2 hunks)
  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts (1 hunks)
  • src/main/presenter/threadPresenter/contentEnricher.ts (2 hunks)
  • src/renderer/src/components/settings/CommonSettings.vue (6 hunks)
  • src/renderer/src/i18n/en-US/settings.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/settings.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/settings.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (18)
**/*.{js,jsx,ts,tsx}

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

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

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.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/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.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

From main to renderer, broadcast events via EventBus using mainWindow.webContents.send()

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.ts
**/*.{ts,tsx}

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

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

Enable and adhere to strict TypeScript type checking

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.ts
src/main/presenter/llmProviderPresenter/providers/*.ts

📄 CodeRabbit inference engine (.cursor/rules/llm-agent-loop.mdc)

src/main/presenter/llmProviderPresenter/providers/*.ts: Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Provider implementations must use a coreStream method that yields standardized stream events to decouple the main loop from provider-specific details.
The coreStream method in each Provider must perform a single streaming API request per conversation round and must not contain multi-round tool call loop logic.
Provider files should implement helper methods such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed for provider-specific logic.
All provider implementations must parse provider-specific data chunks and yield standardized events for text, reasoning, tool calls, usage, errors, stop reasons, and image data.
When a provider does not support native function calling, it must prepare messages using prompt wrapping (e.g., prepareFunctionCallPrompt) before making the API call.
When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
Provider implementations should aggregate and yield usage events as part of the standardized stream.
Provider implementations should yield image data events in the standardized format when applicable.
Provider implementations should yield reasoning events in the standardized format when applicable.
Provider implementations should yield tool call events (tool_call_start, tool_call_chunk, tool_call_end) in the standardized format.
Provider implementations should yield stop events with appropriate stop_reason in the standardized format.
Provider implementations should yield error events in the standardized format...

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
src/main/**/*.{ts,js,tsx,jsx}

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

主进程代码放在 src/main

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.ts
src/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.ts
  • src/renderer/src/components/settings/CommonSettings.vue
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain one presenter per functional domain in src/main/presenter/

Files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/threadPresenter/contentEnricher.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/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/components/settings/CommonSettings.vue
src/renderer/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/components/settings/CommonSettings.vue
src/main/presenter/configPresenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Centralize configuration logic under configPresenter/

Files:

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

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

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/components/settings/CommonSettings.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/components/settings/CommonSettings.vue
src/renderer/src/**/*.vue

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

Use scoped styles to prevent CSS conflicts between components

src/renderer/src/**/*.vue: Follow existing component patterns when creating new UI components
Ensure responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states to UI components

Files:

  • src/renderer/src/components/settings/CommonSettings.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/components/settings/CommonSettings.vue
src/renderer/**/*.{vue,ts}

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

Implement lazy loading for routes and components.

Files:

  • src/renderer/src/components/settings/CommonSettings.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.

src/renderer/**/*.{ts,vue}: Use Pinia for frontend state management
From renderer to main, call presenters via the usePresenter.ts composable

Files:

  • src/renderer/src/components/settings/CommonSettings.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: Use Vue 3 Composition API for all components
Use Tailwind CSS with scoped styles for component styling

Files:

  • src/renderer/src/components/settings/CommonSettings.vue
🧠 Learnings (4)
📚 Learning: 2025-08-26T14:13:46.601Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T14:13:46.601Z
Learning: Applies to src/main/presenter/configPresenter/providers.ts : Add new provider configuration entries in configPresenter/providers.ts

Applied to files:

  • src/main/presenter/llmProviderPresenter/providers/minimaxProvider.ts
📚 Learning: 2025-07-21T01:46:30.354Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/common.json : Shared translation keys must be placed in 'src/renderer/src/i18n/common.json'

Applied to files:

  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
📚 Learning: 2025-07-21T01:46:30.354Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : When adding new translations, add shared keys to 'common.json' and language-specific keys to the respective language file; keep all language files' keys consistent

Applied to files:

  • src/renderer/src/i18n/ru-RU/settings.json
📚 Learning: 2025-08-26T14:13:46.601Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T14:13:46.601Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Centralize configuration logic under configPresenter/

Applied to files:

  • src/main/presenter/configPresenter/index.ts
🧬 Code graph analysis (1)
src/main/presenter/threadPresenter/contentEnricher.ts (1)
src/main/presenter/index.ts (1)
  • presenter (188-188)
🪛 GitHub Actions: PR Check
src/renderer/src/components/settings/CommonSettings.vue

[warning] 1-1: Prettier formatting issue detected in this file. Run 'prettier --write' to fix.


[error] 1-1: Command 'pnpm run format:check' failed with exit code 1. Prettier reported formatting issues in the file.

🔇 Additional comments (14)
README.zh.md (1)

210-213: Groq icon asset presence verified

The file src/renderer/src/assets/llm-icons/groq.svg exists and is correctly referenced in README.md, README.zh.md, and README.jp.md. No further action needed.

README.jp.md (1)

210-213: Asset path verified – no changes required.

The groq.svg file exists at src/renderer/src/assets/llm-icons/groq.svg and matches the path used in README.jp.md (line 211), so the image link will render correctly.

README.md (1)

212-215: Groq icon verified — documentation update approved

  • Confirmed groq.svg exists at src/renderer/src/assets/llm-icons/groq.svg.
  • README (line 213) correctly references this icon path.
src/renderer/src/i18n/zh-HK/settings.json (1)

48-50: LGTM: added i18n keys for web content length limit

Keys and wording align with the new setting.

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

48-50: LGTM: added i18n keys for web content length limit

Translations look good and match UI usage.

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

113-114: LGTM: persisted default = 3000

Default value wired into ElectronStore as expected.

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

46-48: LGTM: i18n strings for the new setting

Clear label, hint, and tooltip; matches product behavior (0 = unlimited, 0–50,000 range).

src/main/presenter/threadPresenter/contentEnricher.ts (1)

6-6: No circular dependency detected
I searched all src/main imports and found that while contentEnricher.ts imports the presenter root (@/presenter) and powerpackServer.ts imports contentEnricher, there are no imports of contentEnricher (or powerpackServer) in the presenter’s root module (src/main/presenter/index.ts) or any other module that would complete a cycle. This change is safe to merge.

src/renderer/src/i18n/ru-RU/settings.json (2)

46-48: LGTM — translations read naturally and match feature semantics.


46-48: Locale parity confirmed across all settings.json files.
All locale files under src/renderer/src/i18n/*/settings.json include the webContentLengthLimit, webContentLengthLimitHint, and webContentLengthLimitTooltip keys in their common section, and every tooltip consistently references the “0-50000” range.

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

33-35: LGTM — clear and consistent with the feature behavior.

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

48-50: LGTM — translation and terminology are consistent.

src/renderer/src/components/settings/CommonSettings.vue (2)

692-708: Harden parsing, clamp range, and use English logs

Handle NaN and floats, clamp to [0, 50000] with 0 meaning unlimited. Remove Chinese logs.
[Suggest_essential_refactor]

-// 处理网页内容长度限制变更
-const handleWebContentLengthLimitChange = async (value: string | number) => {
-  const numValue = typeof value === 'string' ? parseInt(value, 10) : value
-  if ((numValue >= 1 && numValue <= 50000) || numValue === 0) {
-    try {
-      const displayText = numValue === 0 ? '无限制' : `${numValue}字符`
-      console.log('设置网页内容长度限制:', displayText)
-      // 直接调用presenter设置,不依赖store
-      await configPresenter.setSetting('webContentLengthLimit', numValue)
-      // 更新响应式变量
-      webContentLengthLimit.value = numValue
-    } catch (error) {
-      console.error('设置网页内容长度限制失败:', error)
-    }
-  }
-}
+// Handle web content length limit change
+const handleWebContentLengthLimitChange = async (value: string | number) => {
+  const raw = typeof value === 'string' ? Number(value) : value
+  if (!Number.isFinite(raw)) return
+  const normalized = Math.floor(raw)
+  const clamped = normalized <= 0 ? 0 : Math.min(50000, normalized)
+  try {
+    await configPresenter.setSetting('webContentLengthLimit', clamped)
+    webContentLengthLimit.value = clamped
+  } catch (error) {
+    console.error('Failed to set web content length limit:', error)
+  }
+}

Optional UX: debounce updates or persist on blur to avoid frequent writes while typing; I can draft that if desired.


179-180: No-op change

Whitespace-only change. Nothing to address.

Comment on lines +48 to +50
"webContentLengthLimit": "محدودیت طول محتوای وب",
"webContentLengthLimitHint": "(تنظیم بر 0 برای بدون محدودیت)",
"webContentLengthLimitTooltip": "حداکثر طول محتوای متنی استخراج شده از صفحات وب (تعداد نویسه) را تنظیم کنید، محدوده: 0-50000. تنظیم بر 0 به معنای بدون محدودیت و بازیابی محتوای کامل وب است؛ مقادیر بزرگتر محتوای وب کامل‌تری ارائه می‌دهند اما ممکن است زمان پردازش و استفاده از رمزینه‌ها را افزایش دهند.",
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

New i18n keys added — LGTM; ensure parity across locales and UI usage.

Confirm all locales define webContentLengthLimit* keys and the settings UI references them.


🏁 Script executed:

#!/bin/bash
# Expect these keys in all locale settings files and usage in CommonSettings.vue
rg -n '"webContentLengthLimit"' src/renderer/src/i18n
rg -n '"webContentLengthLimitHint"' src/renderer/src/i18n
rg -n '"webContentLengthLimitTooltip"' src/renderer/src/i18n
rg -nP 'settings\.common\.(webContentLengthLimit|webContentLengthLimitHint|webContentLengthLimitTooltip)' src/renderer/src/components/settings/CommonSettings.vue

Length of output: 4752


Ensure tooltip i18n key is surfaced in the Settings UI

All locale files include the three new webContentLengthLimit* keys, and the settings screen already displays the limit and its hint. However, the tooltip key isn’t referenced in the component, so end users won’t see the detailed description you added.

• File: src/renderer/src/components/settings/CommonSettings.vue
– Line 59: renders t('settings.common.webContentLengthLimit')
– Line 61: renders t('settings.common.webContentLengthLimitHint')
Missing: t('settings.common.webContentLengthLimitTooltip')

Please update this component to use the tooltip string—e.g. add a tooltip icon or a title/aria-label binding with t('settings.common.webContentLengthLimitTooltip')—so the full description is available.

🤖 Prompt for AI Agents
In src/renderer/src/components/settings/CommonSettings.vue around lines 59-61,
the UI renders t('settings.common.webContentLengthLimit') and
t('settings.common.webContentLengthLimitHint') but never surfaces
t('settings.common.webContentLengthLimitTooltip'); update the component to bind
that tooltip string to the displayed control (for example add a tooltip icon or
set title/aria-label on the label/input using
t('settings.common.webContentLengthLimitTooltip')), ensure the i18n
instance/import is available in the component, and use an accessible attribute
(title and/or aria-label) so screen readers and hover tooltips show the full
description.

@zerob13 zerob13 changed the title 增加网页获取内容长度限制 以便获取更多的上下文 回答更精准 feat: Increase the content length limit for web retrieval to capture more context and provide more accurate responses Aug 27, 2025
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 (1)
src/renderer/src/components/settings/CommonSettings.vue (1)

534-542: Sanitize persisted value; clamp and log in English

Clamp [0, MAX], coerce to int, persist back if corrected, and log in English. Mirrors prior feedback.

-  // 加载网页内容长度限制设置
-  try {
-    const savedLimit = await configPresenter.getSetting<number>('webContentLengthLimit')
-    if (savedLimit !== undefined && savedLimit !== null) {
-      webContentLengthLimit.value = savedLimit
-    }
-  } catch (error) {
-    console.error('加载网页内容长度限制设置失败:', error)
-  }
+  // Load and sanitize webContentLengthLimit (0 = unlimited)
+  try {
+    const raw = await configPresenter.getSetting<number>('webContentLengthLimit')
+    if (typeof raw === 'number' && Number.isFinite(raw)) {
+      const sanitized =
+        raw === 0 ? 0 : Math.max(1, Math.min(WEB_CONTENT_LENGTH_MAX, Math.floor(raw)))
+      webContentLengthLimit.value = sanitized
+      if (sanitized !== raw) {
+        await configPresenter.setSetting('webContentLengthLimit', sanitized)
+      }
+    } else {
+      webContentLengthLimit.value = WEB_CONTENT_LENGTH_DEFAULT
+    }
+  } catch (error) {
+    console.error('Failed to load webContentLengthLimit:', error)
+  }
🧹 Nitpick comments (3)
src/renderer/src/components/settings/CommonSettings.vue (3)

55-77: Replace magic numbers and hardcoded placeholder; derive from shared constants

Use shared constants for min/max/step and avoid the hardcoded "3000" placeholder. Also switch the template comment to English.

-      <!-- 网页内容长度限制 -->
+      <!-- Web content length limit -->
@@
-          <Input
-            type="number"
-            :min="0"
-            :max="50000"
-            :step="1000"
-            :model-value="webContentLengthLimit"
-            @update:model-value="handleWebContentLengthLimitChange"
-            class="text-right"
-            placeholder="3000"
-          />
+          <Input
+            type="number"
+            :min="WEB_CONTENT_LENGTH_MIN"
+            :max="WEB_CONTENT_LENGTH_MAX"
+            :step="WEB_CONTENT_LENGTH_STEP"
+            :model-value="webContentLengthLimit"
+            @update:model-value="handleWebContentLengthLimitChange"
+            class="text-right"
+            :placeholder="String(WEB_CONTENT_LENGTH_DEFAULT)"
+          />

If preferred, you can use an i18n placeholder key instead.


415-417: Introduce shared constants and English comment; type the ref

Centralize limits, follow English-only comments, and type the ref.

-// 网页内容长度限制
-const webContentLengthLimit = ref(3000)
+// Web content length limit
+const WEB_CONTENT_LENGTH_MIN = 0 as const
+const WEB_CONTENT_LENGTH_MAX = 50000 as const
+const WEB_CONTENT_LENGTH_STEP = 1000 as const
+const WEB_CONTENT_LENGTH_DEFAULT = 3000 as const
+const webContentLengthLimit = ref<number>(WEB_CONTENT_LENGTH_DEFAULT)

688-704: Sanitize/clamp user input; log in English; persist only on change

Handle NaN, coerce to int, clamp to [1, MAX] or 0 (unlimited), and avoid unnecessary writes.

-// 处理网页内容长度限制变更
-const handleWebContentLengthLimitChange = async (value: string | number) => {
-  const numValue = typeof value === 'string' ? parseInt(value, 10) : value
-  if ((numValue >= 1 && numValue <= 50000) || numValue === 0) {
-    try {
-      const displayText = numValue === 0 ? '无限制' : `${numValue}字符`
-      console.log('设置网页内容长度限制:', displayText)
-      // 直接调用presenter设置,不依赖store
-      await configPresenter.setSetting('webContentLengthLimit', numValue)
-      // 更新响应式变量
-      webContentLengthLimit.value = numValue
-    } catch (error) {
-      console.error('设置网页内容长度限制失败:', error)
-    }
-  }
-}
+// Handle web content length limit change
+const handleWebContentLengthLimitChange = async (value: string | number) => {
+  const parsed = typeof value === 'string' ? Number(value) : value
+  if (!Number.isFinite(parsed)) return
+  const sanitized =
+    parsed === 0 ? 0 : Math.max(1, Math.min(WEB_CONTENT_LENGTH_MAX, Math.floor(parsed)))
+  try {
+    if (sanitized !== webContentLengthLimit.value) {
+      console.log('Set webContentLengthLimit:', sanitized === 0 ? 'unlimited' : `${sanitized} chars`)
+      await configPresenter.setSetting('webContentLengthLimit', sanitized)
+      webContentLengthLimit.value = sanitized
+    }
+  } catch (error) {
+    console.error('Failed to set webContentLengthLimit:', error)
+  }
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1c5d7e5 and 44ccd49.

📒 Files selected for processing (1)
  • src/renderer/src/components/settings/CommonSettings.vue (4 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
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/components/settings/CommonSettings.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}

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

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/components/settings/CommonSettings.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/components/settings/CommonSettings.vue
src/renderer/src/**/*.vue

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

Use scoped styles to prevent CSS conflicts between components

src/renderer/src/**/*.vue: Follow existing component patterns when creating new UI components
Ensure responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states to UI components

Files:

  • src/renderer/src/components/settings/CommonSettings.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/components/settings/CommonSettings.vue
src/renderer/**/*.{vue,ts}

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

Implement lazy loading for routes and components.

Files:

  • src/renderer/src/components/settings/CommonSettings.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.

src/renderer/**/*.{ts,vue}: Use Pinia for frontend state management
From renderer to main, call presenters via the usePresenter.ts composable

Files:

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

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/renderer/src/components/settings/CommonSettings.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: Use Vue 3 Composition API for all components
Use Tailwind CSS with scoped styles for component styling

Files:

  • src/renderer/src/components/settings/CommonSettings.vue
src/renderer/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • src/renderer/src/components/settings/CommonSettings.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)

@zerob13 zerob13 merged commit 5140116 into ThinkInAIXYZ:dev Aug 27, 2025
2 checks passed
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