Skip to content

Conversation

@yyhhyyyyyy
Copy link
Collaborator

@yyhhyyyyyy yyhhyyyyyy commented Aug 29, 2025

update Doubao provider with new models
CleanShot 2025-08-29 at 17 03 19@2x

Summary by CodeRabbit

  • New Features
    • Added multiple DeepSeek models with expanded context windows and higher token limits.
    • Introduced six Doubao Seed models featuring vision, reasoning, and function calling.
  • Improvements
    • Standardized capability flags (vision, reasoning, function calling) across supported models.
    • Expanded model matching and aliases for easier selection and compatibility.
  • Compatibility
    • No changes to public APIs; existing workflows continue to function.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

Walkthrough

The change updates Doubao-related model configurations: populates providerModelSettings with DeepSeek and Doubao Seed variants and revises doubaoProvider’s model list to include DeepSeek entries (with flags) and six new Doubao Seed models. No API signatures, logic, or control flow changed.

Changes

Cohort / File(s) Summary
Provider model settings expansion
src/main/presenter/configPresenter/providerModelSettings.ts
Populates previously empty Doubao models array with 11 configurations: multiple DeepSeek variants and six Doubao Seed variants, specifying ids, names, temps, token/context limits, match aliases, and flags (vision/functionCall/reasoning).
Doubao provider models update
src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
Replaces/augments provider model list: updates DeepSeek entries (group set to deepseek, adds reasoning/functionCall/vision flags, adjusts contextLength/maxTokens) and adds six new Doubao Seed models (vision/functionCall/reasoning enabled, 256k context, 32k maxTokens). No API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my whiskers, models bloom anew,
Doubao seeds and DeepSeek join the crew.
Flags set right—vision, thoughts, and calls—
Bigger contexts stretch the halls.
In rows of ids I softly cheer,
Hop-hop, release day’s almost here! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/update-doubao-models

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 @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit 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 @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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: 2

Caution

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

⚠️ Outside diff range comments (2)
src/main/presenter/configPresenter/providerModelSettings.ts (1)

2791-2806: Make model-id matching deterministic (avoid substring collisions).

Using includes() can select the wrong config (e.g., 'deepseek-v3' matches 'deepseek-v3-1-250821'). Prefer “longest prefix” matching.

-  // 遍历该提供商的模型数组,查找匹配的模型配置
-  for (const config of providerSetting.models) {
-    // 检查是否有任何匹配条件符合
-    if (config.match.some((matchStr) => lowerModelId.includes(matchStr.toLowerCase()))) {
-      return {
-        maxTokens: config.maxTokens,
-        contextLength: config.contextLength,
-        temperature: config.temperature, // 保持可选,某些模型不支持
-        vision: config.vision || false,
-        functionCall: config.functionCall || false,
-        reasoning: config.reasoning || false,
-        type: config.type || ModelType.Chat,
-        reasoningEffort: config.reasoningEffort,
-        verbosity: config.verbosity,
-        maxCompletionTokens: config.maxCompletionTokens
-      }
-    }
-  }
+  // Prefer the most specific (longest) prefix match to avoid collisions
+  let best: ProviderModelSetting | undefined
+  let bestLen = -1
+  for (const config of providerSetting.models) {
+    for (const matchStr of config.match) {
+      const m = matchStr.toLowerCase()
+      if (lowerModelId === m || lowerModelId.startsWith(m)) {
+        if (m.length > bestLen) {
+          best = config
+          bestLen = m.length
+        }
+      }
+    }
+  }
+  if (best) {
+    return {
+      maxTokens: best.maxTokens,
+      contextLength: best.contextLength,
+      temperature: best.temperature,
+      vision: best.vision || false,
+      functionCall: best.functionCall || false,
+      reasoning: best.reasoning || false,
+      type: best.type || ModelType.Chat,
+      reasoningEffort: best.reasoningEffort,
+      verbosity: best.verbosity,
+      maxCompletionTokens: best.maxCompletionTokens
+    }
+  }
src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts (1)

155-162: Add try-catch with structured logging; don’t swallow errors.

Main-process TS must handle errors with meaningful, structured logs and rethrow.

   async completions(
     messages: ChatMessage[],
     modelId: string,
     temperature?: number,
     maxTokens?: number
   ): Promise<LLMResponse> {
-    return this.openAICompletion(messages, modelId, temperature, maxTokens)
+    try {
+      return await this.openAICompletion(messages, modelId, temperature, maxTokens)
+    } catch (err) {
+      console.error('[ERROR]', {
+        ts: new Date().toISOString(),
+        level: 'ERROR',
+        code: 'DOUBAO_COMPLETIONS_ERROR',
+        provider: this.provider.id,
+        modelId,
+        message: err instanceof Error ? err.message : String(err),
+        stack: err instanceof Error ? err.stack : undefined
+      })
+      throw err
+    }
   }
@@
   async generateText(
     prompt: string,
     modelId: string,
     temperature?: number,
     maxTokens?: number
   ): Promise<LLMResponse> {
-    return this.openAICompletion(
-      [
-        {
-          role: 'user',
-          content: prompt
-        }
-      ],
-      modelId,
-      temperature,
-      maxTokens
-    )
+    try {
+      return await this.openAICompletion(
+        [{ role: 'user', content: prompt }],
+        modelId,
+        temperature,
+        maxTokens
+      )
+    } catch (err) {
+      console.error('[ERROR]', {
+        ts: new Date().toISOString(),
+        level: 'ERROR',
+        code: 'DOUBAO_GENERATE_TEXT_ERROR',
+        provider: this.provider.id,
+        modelId,
+        message: err instanceof Error ? err.message : String(err),
+        stack: err instanceof Error ? err.stack : undefined
+      })
+      throw err
+    }
   }

Also applies to: 164-181

🧹 Nitpick comments (2)
src/main/presenter/configPresenter/providerModelSettings.ts (1)

176-184: Standardize display names (remove mixed date parentheticals).

Name formatting is inconsistent; two entries append dates in parentheses while peers don’t. Unify for UX consistency.

-        name: 'Doubao Seed 1.6 Flash (250615)',
+        name: 'Doubao Seed 1.6 Flash',
@@
-        name: 'Doubao Seed 1.6 Thinking (250615)',
+        name: 'Doubao Seed 1.6 Thinking',

Also applies to: 198-206

src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts (1)

118-118: Standardize model names (remove date parentheses).

Keep naming consistent with other entries.

-        name: 'doubao-seed-1.6-flash (250615)',
+        name: 'doubao-seed-1.6-flash',
@@
-        name: 'doubao-seed-1.6-thinking (250615)',
+        name: 'doubao-seed-1.6-thinking',

Also applies to: 142-142

📜 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 19c5078 and 91bcec4.

📒 Files selected for processing (2)
  • src/main/presenter/configPresenter/providerModelSettings.ts (1 hunks)
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}

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

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

Files:

  • src/main/presenter/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.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/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.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/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.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/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
src/main/**/*.{ts,js,tsx,jsx}

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

主进程代码放在 src/main

Files:

  • src/main/presenter/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
src/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for all logs and comments

Files:

  • src/main/presenter/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • src/main/presenter/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
src/main/presenter/configPresenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Centralize configuration logic under configPresenter/

Files:

  • src/main/presenter/configPresenter/providerModelSettings.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/doubaoProvider.ts
🧠 Learnings (1)
📚 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/configPresenter/providerModelSettings.ts
  • src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts
🔇 Additional comments (1)
src/main/presenter/llmProviderPresenter/providers/doubaoProvider.ts (1)

18-78: Verify tool conversion and image support in DoubaoProvider
DoubaoProvider extends OpenAICompatibleProvider, but OpenAICompatibleProvider.coreStream must convert MCP tools (via convertToProviderTools) and include image payloads for vision-enabled models. Confirm coreStream applies mcpTools correctly and respects each model’s vision flag; if not, add provider-specific overrides (e.g. convertToProviderTools/formatMessages) in doubaoProvider.ts.

Comment on lines +143 to +207
id: 'doubao-seed-1-6-vision-250815',
name: 'Doubao Seed 1.6 Vision',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-vision-250815', 'doubao-seed-1.6-vision'],
vision: true,
functionCall: true,
reasoning: true
},
{
id: 'doubao-seed-1-6-250615',
name: 'Doubao Seed 1.6',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-250615', 'doubao-seed-1.6'],
vision: true,
functionCall: true,
reasoning: true
},
{
id: 'doubao-seed-1-6-flash-250715',
name: 'Doubao Seed 1.6 Flash',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-flash-250715', 'doubao-seed-1.6-flash'],
vision: true,
functionCall: true,
reasoning: true
},
{
id: 'doubao-seed-1-6-flash-250615',
name: 'Doubao Seed 1.6 Flash (250615)',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-flash-250615'],
vision: true,
functionCall: true,
reasoning: true
},
{
id: 'doubao-seed-1-6-thinking-250715',
name: 'Doubao Seed 1.6 Thinking',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-thinking-250715', 'doubao-seed-1.6-thinking'],
vision: true,
functionCall: true,
reasoning: true
},
{
id: 'doubao-seed-1-6-thinking-250615',
name: 'Doubao Seed 1.6 Thinking (250615)',
temperature: 0.7,
maxTokens: 32000,
contextLength: 256000,
match: ['doubao-seed-1-6-thinking-250615'],
vision: true,
functionCall: true,
reasoning: true
}
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

Verify capability flags against Doubao API (functionCall/vision/reasoning).

All Doubao Seed entries set functionCall: true and vision: true. Confirm these are natively supported and exercised by our provider path; otherwise we should disable or prompt-wrap.

Run:

Expected: Doubao path (or its base) handles tool conversion and image parts. If absent, we must either implement conversion/wrapping here or flip functionCall/vision to false for the affected models.


🏁 Script executed:

#!/bin/bash
# Check provider/tooling support for native function calling & vision under Doubao
rg -n -C2 -e 'convertToProviderTools|prepareFunctionCallPrompt|image_url|content: \[{ type: "image_url"' src/main/presenter/llmProviderPresenter/providers

Length of output: 400


🏁 Script executed:

#!/bin/bash
# Corrected patterns: list provider files and search for functionCall & vision support in Doubao provider

echo "Provider files under src/main/presenter/llmProviderPresenter/providers:"
fd -t f src/main/presenter/llmProviderPresenter/providers

echo -e "\nLooking for convertToProviderTools usage:"
rg -n -C2 'convertToProviderTools' src/main/presenter/llmProviderPresenter/providers

echo -e "\nLooking for prepareFunctionCallPrompt usage:"
rg -n -C2 'prepareFunctionCallPrompt' src/main/presenter/llmProviderPresenter/providers

echo -e "\nLooking for image_url or vision handling:"
rg -n -C2 'image_url' src/main/presenter/llmProviderPresenter/providers

Length of output: 21879


🏁 Script executed:

#!/bin/bash
# List all provider files
fd . src/main/presenter/llmProviderPresenter/providers

# Locate Doubao provider file(s)
echo "Doubao provider files:"
fd doubao src/main/presenter/llmProviderPresenter/providers

# Inspect Doubao provider for native tool conversion & vision support
for file in $(fd doubao src/main/presenter/llmProviderPresenter/providers); do
  echo -e "\n=== Inspecting $file ==="
  rg -n 'convertToProviderTools' $file || echo "⚠️ no convertToProviderTools usage"
  rg -n 'prepareFunctionCallPrompt' $file || echo "⚠️ no prepareFunctionCallPrompt usage"
  rg -n -C2 'vision' $file || echo "⚠️ no vision flag handling"
  rg -n -C2 'image_url' $file || echo "⚠️ no image_url handling"
done

Length of output: 4338


Implement Doubao native tooling/vision support or disable flags

providerModelSettings.ts (lines 143–207) defines all Doubao Seed entries with functionCall: true and vision: true, but doubaoProvider.ts lacks
– any use of convertToProviderTools or prepareFunctionCallPrompt
– handling of incoming image_url content
Either extend doubaoProvider.ts to convert tools and process images natively or set functionCall/vision to false for those models.

@zerob13 zerob13 merged commit f5c5099 into dev Aug 29, 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.

3 participants