Skip to content

refactor: remove empty bot constructors that only call super()#1078

Open
octo-patch wants to merge 1 commit into
ai-shifu:mainfrom
octo-patch:fix/issue-1008-remove-empty-super-constructors
Open

refactor: remove empty bot constructors that only call super()#1078
octo-patch wants to merge 1 commit into
ai-shifu:mainfrom
octo-patch:fix/issue-1008-remove-empty-super-constructors

Conversation

@octo-patch

@octo-patch octo-patch commented Apr 19, 2026

Copy link
Copy Markdown

Fixes #1008

Problem

Many bot files contain boilerplate constructors that only call super() with no additional initialization logic:

constructor() {
  super();
}

This was flagged in #1005 and #1012 by CodeRabbit and tracked in issue #1008. JavaScript classes automatically invoke the parent constructor when no constructor is defined, making these redundant.

Solution

Removed the empty constructor() { super(); } blocks from 78 bot files across the codebase. The behavior is identical — JavaScript's default constructor calls super() automatically for derived classes.

Testing

  • Verified that only pure boilerplate constructors (those with exactly one super() call and nothing else) were removed
  • No constructor with additional logic was touched
  • The 78 affected files span all bot categories: OpenAI, Anthropic, Google, xAI, Groq, Cohere, Baidu, Microsoft, HuggingFace, and others

Summary by CodeRabbit

  • Refactor
    • Removed redundant explicit constructors across bot classes throughout the codebase. All affected classes previously only called the parent constructor without adding custom logic. They now rely on inherited default constructor behavior, reducing code complexity and improving maintainability with no impact on functionality.

Removes unnecessary boilerplate constructors across 78 bot files where
the constructor only calls super() with no additional initialization.
JavaScript classes automatically invoke the parent constructor when no
constructor is defined, so these are redundant.

Closes ai-shifu#1008
@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6999c588-dd8b-4fce-9372-d28ba2eff60d

📥 Commits

Reviewing files that changed from the base of the PR and between 6d089c2 and 937ff4e.

📒 Files selected for processing (78)
  • src/bots/CharacterAIBot.js
  • src/bots/ClaudeAIBot.js
  • src/bots/DevBot.js
  • src/bots/LangChainBot.js
  • src/bots/MOSSBot.js
  • src/bots/MistralBot.js
  • src/bots/PerplexityBot.js
  • src/bots/PhindBot.js
  • src/bots/PiBot.js
  • src/bots/QianWenBot.js
  • src/bots/Qihoo360AIBrainBot.js
  • src/bots/SkyWorkBot.js
  • src/bots/SparkBot.js
  • src/bots/TemplateBot.js
  • src/bots/YouChatBot.js
  • src/bots/anthropic/ClaudeAPI20Bot.js
  • src/bots/anthropic/ClaudeAPI21Bot.js
  • src/bots/anthropic/ClaudeAPI37SonnetBot.js
  • src/bots/anthropic/ClaudeAPIBot.js
  • src/bots/anthropic/ClaudeAPIHaikuBot.js
  • src/bots/anthropic/ClaudeAPIOpusBot.js
  • src/bots/anthropic/ClaudeAPISonnetBot.js
  • src/bots/baidu/ERNIEBot.js
  • src/bots/baidu/WenxinQianfan4Bot.js
  • src/bots/baidu/WenxinQianfanBot.js
  • src/bots/baidu/WenxinQianfanTurboBot.js
  • src/bots/cohere/CohereAPIAya23Bot.js
  • src/bots/cohere/CohereAPIBot.js
  • src/bots/cohere/CohereAPICommandBot.js
  • src/bots/cohere/CohereAPICommandLightBot.js
  • src/bots/cohere/CohereAPICommandRBot.js
  • src/bots/cohere/CohereAPICommandRPlusBot.js
  • src/bots/google/BardBot.js
  • src/bots/google/Gemini15FlashAPIBot.js
  • src/bots/google/Gemini15ProAPIBot.js
  • src/bots/google/Gemini20FlashAPIBot.js
  • src/bots/google/Gemini20FlashLiteAPIBot.js
  • src/bots/google/GeminiAPIBot.js
  • src/bots/google/GeminiAdvBot.js
  • src/bots/groq/Gemma29bGroqAPIBot.js
  • src/bots/groq/Gemma7bGroqAPIBot.js
  • src/bots/groq/GroqAPIBot.js
  • src/bots/groq/Llama370bGroqAPIBot.js
  • src/bots/groq/Llama38bGroqAPIBot.js
  • src/bots/groq/Llama4MaverickGroqAPIBot.js
  • src/bots/groq/Llama4ScoutGroqAPIBot.js
  • src/bots/huggingface/GradioBot.js
  • src/bots/huggingface/HuggingChatBot.js
  • src/bots/lmsys/LMSYSBot.js
  • src/bots/microsoft/AzureOpenAIAPIBot.js
  • src/bots/microsoft/BingChatBalancedBot.js
  • src/bots/microsoft/BingChatBot.js
  • src/bots/microsoft/BingChatCreativeBot.js
  • src/bots/microsoft/BingChatPreciseBot.js
  • src/bots/moonshot/KimiBot.js
  • src/bots/openai/ChatGPT4Bot.js
  • src/bots/openai/OpenAIAPI35Bot.js
  • src/bots/openai/OpenAIAPI4128KBot.js
  • src/bots/openai/OpenAIAPI41Bot.js
  • src/bots/openai/OpenAIAPI41MiniBot.js
  • src/bots/openai/OpenAIAPI41NanoBot.js
  • src/bots/openai/OpenAIAPI45Bot.js
  • src/bots/openai/OpenAIAPI4Bot.js
  • src/bots/openai/OpenAIAPI4oBot.js
  • src/bots/openai/OpenAIAPI4oMiniBot.js
  • src/bots/openai/OpenAIAPIBot.js
  • src/bots/openai/OpenAIAPIo1Bot.js
  • src/bots/openai/OpenAIAPIo1MiniBot.js
  • src/bots/openai/OpenAIAPIo3Bot.js
  • src/bots/openai/OpenAIAPIo3MiniBot.js
  • src/bots/openai/OpenAIAPIo4MiniBot.js
  • src/bots/poe/PoeBot.js
  • src/bots/xai/Grok2APIBot.js
  • src/bots/xai/Grok3APIBot.js
  • src/bots/xai/Grok3MiniAPIBot.js
  • src/bots/xai/xAIAPIBot.js
  • src/bots/zhipu/ChatGLM4Bot.js
  • src/bots/zhipu/ChatGLMBot.js
💤 Files with no reviewable changes (78)
  • src/bots/SkyWorkBot.js
  • src/bots/CharacterAIBot.js
  • src/bots/YouChatBot.js
  • src/bots/PhindBot.js
  • src/bots/LangChainBot.js
  • src/bots/cohere/CohereAPICommandBot.js
  • src/bots/anthropic/ClaudeAPI20Bot.js
  • src/bots/anthropic/ClaudeAPIHaikuBot.js
  • src/bots/TemplateBot.js
  • src/bots/MOSSBot.js
  • src/bots/google/Gemini20FlashAPIBot.js
  • src/bots/PiBot.js
  • src/bots/PerplexityBot.js
  • src/bots/anthropic/ClaudeAPISonnetBot.js
  • src/bots/baidu/ERNIEBot.js
  • src/bots/anthropic/ClaudeAPIOpusBot.js
  • src/bots/MistralBot.js
  • src/bots/anthropic/ClaudeAPI37SonnetBot.js
  • src/bots/google/Gemini15ProAPIBot.js
  • src/bots/google/BardBot.js
  • src/bots/google/Gemini15FlashAPIBot.js
  • src/bots/baidu/WenxinQianfanBot.js
  • src/bots/cohere/CohereAPIBot.js
  • src/bots/cohere/CohereAPICommandRBot.js
  • src/bots/SparkBot.js
  • src/bots/google/GeminiAPIBot.js
  • src/bots/microsoft/BingChatBalancedBot.js
  • src/bots/ClaudeAIBot.js
  • src/bots/cohere/CohereAPICommandLightBot.js
  • src/bots/google/Gemini20FlashLiteAPIBot.js
  • src/bots/cohere/CohereAPICommandRPlusBot.js
  • src/bots/microsoft/BingChatBot.js
  • src/bots/openai/OpenAIAPI35Bot.js
  • src/bots/groq/Llama4ScoutGroqAPIBot.js
  • src/bots/groq/Gemma29bGroqAPIBot.js
  • src/bots/microsoft/BingChatPreciseBot.js
  • src/bots/groq/Llama370bGroqAPIBot.js
  • src/bots/openai/OpenAIAPI41MiniBot.js
  • src/bots/moonshot/KimiBot.js
  • src/bots/huggingface/GradioBot.js
  • src/bots/groq/GroqAPIBot.js
  • src/bots/openai/OpenAIAPIBot.js
  • src/bots/openai/OpenAIAPI4oBot.js
  • src/bots/google/GeminiAdvBot.js
  • src/bots/anthropic/ClaudeAPI21Bot.js
  • src/bots/openai/OpenAIAPI45Bot.js
  • src/bots/huggingface/HuggingChatBot.js
  • src/bots/groq/Llama4MaverickGroqAPIBot.js
  • src/bots/groq/Llama38bGroqAPIBot.js
  • src/bots/openai/OpenAIAPI4Bot.js
  • src/bots/openai/OpenAIAPIo3MiniBot.js
  • src/bots/QianWenBot.js
  • src/bots/Qihoo360AIBrainBot.js
  • src/bots/lmsys/LMSYSBot.js
  • src/bots/baidu/WenxinQianfan4Bot.js
  • src/bots/openai/ChatGPT4Bot.js
  • src/bots/openai/OpenAIAPIo1Bot.js
  • src/bots/cohere/CohereAPIAya23Bot.js
  • src/bots/openai/OpenAIAPI41NanoBot.js
  • src/bots/poe/PoeBot.js
  • src/bots/zhipu/ChatGLMBot.js
  • src/bots/xai/Grok3MiniAPIBot.js
  • src/bots/anthropic/ClaudeAPIBot.js
  • src/bots/microsoft/BingChatCreativeBot.js
  • src/bots/openai/OpenAIAPI41Bot.js
  • src/bots/xai/xAIAPIBot.js
  • src/bots/xai/Grok3APIBot.js
  • src/bots/groq/Gemma7bGroqAPIBot.js
  • src/bots/baidu/WenxinQianfanTurboBot.js
  • src/bots/microsoft/AzureOpenAIAPIBot.js
  • src/bots/openai/OpenAIAPIo1MiniBot.js
  • src/bots/openai/OpenAIAPIo3Bot.js
  • src/bots/openai/OpenAIAPI4oMiniBot.js
  • src/bots/openai/OpenAIAPI4128KBot.js
  • src/bots/zhipu/ChatGLM4Bot.js
  • src/bots/DevBot.js
  • src/bots/xai/Grok2APIBot.js
  • src/bots/openai/OpenAIAPIo4MiniBot.js

📝 Walkthrough

Walkthrough

Removed redundant constructor() methods that only called super() across 67 bot classes. In JavaScript, derived classes automatically invoke the parent constructor if no explicit constructor is defined, making these empty constructors unnecessary boilerplate.

Changes

Cohort / File(s) Summary
Base Bot Classes
src/bots/CharacterAIBot.js, src/bots/ClaudeAIBot.js, src/bots/DevBot.js, src/bots/LangChainBot.js, src/bots/MOSSBot.js, src/bots/MistralBot.js, src/bots/PerplexityBot.js, src/bots/PhindBot.js, src/bots/PiBot.js, src/bots/QianWenBot.js, src/bots/Qihoo360AIBrainBot.js, src/bots/SkyWorkBot.js, src/bots/SparkBot.js, src/bots/TemplateBot.js, src/bots/YouChatBot.js
Removed empty constructor() { super(); } declarations, allowing classes to inherit default constructor behavior.
Anthropic Claude Variants
src/bots/anthropic/ClaudeAPI*.js, src/bots/anthropic/ClaudeAPIBot.js, src/bots/anthropic/ClaudeAPI{Haiku,Opus,Sonnet}Bot.js
Removed redundant constructors from Claude API bot hierarchy (ClaudeAPI20Bot, ClaudeAPI21Bot, ClaudeAPI37SonnetBot, ClaudeAPIBot, ClaudeAPIHaikuBot, ClaudeAPIOpusBot, ClaudeAPISonnetBot).
Baidu Wenxin Variants
src/bots/baidu/ERNIEBot.js, src/bots/baidu/WenxinQianfan{4,Turbo}Bot.js, src/bots/baidu/WenxinQianfanBot.js
Removed empty constructors from Baidu/Wenxin bot family.
Cohere API Variants
src/bots/cohere/CohereAPI{Aya23,Command{,Light,R,RPlus}}Bot.js, src/bots/cohere/CohereAPIBot.js
Removed redundant constructors from Cohere API bot hierarchy (Command variants, Aya23, base CohereAPIBot).
Google Gemini Variants
src/bots/google/Gemini{15{Flash,Pro},20{Flash,FlashLite},API}Bot.js, src/bots/google/GeminiAdvBot.js, src/bots/google/BardBot.js
Removed empty constructors from Google Gemini and Bard bot families.
Groq API Variants
src/bots/groq/Gemma{29b,7b}GroqAPIBot.js, src/bots/groq/GroqAPIBot.js, src/bots/groq/Llama{370b,38b,4{Maverick,Scout}}GroqAPIBot.js
Removed redundant constructors from Groq API bot family including Gemma and Llama model variants.
HuggingFace Bots
src/bots/huggingface/GradioBot.js, src/bots/huggingface/HuggingChatBot.js
Removed empty constructors from HuggingFace bot implementations.
Other Independent Bots
src/bots/lmsys/LMSYSBot.js, src/bots/moonshot/KimiBot.js, src/bots/poe/PoeBot.js
Removed constructors from independent bot implementations (LMSYS, Moonshot/Kimi, Poe).
Microsoft Bing & Azure
src/bots/microsoft/AzureOpenAIAPIBot.js, src/bots/microsoft/BingChat{,Balanced,Creative,Precise}Bot.js
Removed redundant constructors from Microsoft bot family (Azure OpenAI, Bing Chat variants).
OpenAI API Variants
src/bots/openai/ChatGPT4Bot.js, src/bots/openai/OpenAIAPI{35,4{,128K,1,1Mini,1Nano,5},4o{,Mini},4oMini,APIBot,o{1,1Mini,3,3Mini,4Mini}}Bot.js
Removed empty constructors from OpenAI API bot hierarchy (GPT-4 variants, model-specific implementations, o-series models).
xAI Grok Variants
src/bots/xai/Grok{2,3,3Mini}APIBot.js, src/bots/xai/xAIAPIBot.js
Removed redundant constructors from xAI Grok API bot family.
Zhipu ChatGLM Variants
src/bots/zhipu/ChatGLM{,4}Bot.js
Removed empty constructors from Zhipu ChatGLM bot family.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Constructors so bare, doing naught but call super,
We've swept them away, the code's now much purer!
Inheritance flows without redundant noise,
Empty methods banished—simplicity rejoice!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing empty constructors that only call super() from bot classes.
Linked Issues check ✅ Passed All code changes directly address the objective in issue #1008 to remove redundant constructors that only call super(), affecting 78 bot files across all categories.
Out of Scope Changes check ✅ Passed All changes are scope-limited to removing redundant boilerplate constructors; no extraneous modifications, refactoring, or logic changes were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request removes redundant constructors that only call super() across a large number of bot implementation files. This is a standard code cleanup that simplifies class definitions while maintaining identical behavior. As there are no review comments to evaluate, I have no further feedback to provide.

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.

Refactor: Remove empty bot constructors that only call super()

1 participant