Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented May 2, 2025

各AIのモデル一覧を一つのファイルにまとめる

概要

各AIのモデルリストを一つのファイル(src/features/constants/aiModels.ts)にまとめました。
これにより、モデルリストの管理が容易になり、コードの重複が削減されました。

変更内容

  • 新しいファイル src/features/constants/aiModels.ts を作成し、すべてのAIモデルリストを集約
  • 既存のファイルでハードコードされていたモデルリストを、新しいファイルからのインポートに置き換え
  • 各AIサービス(OpenAI、Anthropic、Google、Groq、Cohere、Mistral AI、Perplexity、Fireworks、DeepSeek)のモデルリストを整理

関連Issue

Closes #374

タグ

devin

<slack_thread_ts>1746172205.291659</slack_thread_ts>

Summary by CodeRabbit

  • 新機能

    • 各AIサービスプロバイダーの利用可能なモデル選択肢が、より多くのモデルリストから動的に表示されるようになりました。
  • リファクタリング

    • モデル選択肢の管理が一元化され、今後のモデル追加や更新が容易になりました。

Co-Authored-By: ニケちゃん / nikechan <o3nike.teg.14@gmail.com>
@vercel
Copy link

vercel bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aituber-kit ❌ Failed (Inspect) May 2, 2025 8:02am

@coderabbitai
Copy link

coderabbitai bot commented May 2, 2025

Walkthrough

この変更は、各AIプロバイダーのモデル一覧とデフォルトモデルを一元管理するための新しい定数モジュール(src/features/constants/aiModels.ts)を導入し、ModelProviderコンポーネントや設定ストアでのモデルリストやデフォルト値のハードコーディングを廃止しています。これにより、モデルの選択肢やデフォルト値が集中管理され、各所でインポートして利用する形にリファクタリングされています。UIやロジックの制御フローには変更はありません。

Changes

ファイル/グループ 変更内容の概要
src/components/settings/modelProvider.tsx 各AIサービスのモデル選択肢およびデフォルト値のハードコーディングを廃止し、@/features/constants/aiModelsからインポートされた定数を利用するようリファクタリング。モデルの選択肢は配列からマッピングして動的に生成。
src/features/constants/aiModels.ts 各AIプロバイダーのモデル一覧配列、デフォルトモデル、マルチモーダル対応サービス、Google検索グラウンディングモデルなどを定義しエクスポートする新規ファイル。
src/features/stores/settings.ts multiModalAIServicesおよびgoogleSearchGroundingModelsの定義をインラインから../constants/aiModelsのインポートに切り替え。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ModelProvider
    participant aiModelsConstants

    User ->> ModelProvider: モデル選択UIを表示
    ModelProvider ->> aiModelsConstants: モデル一覧・デフォルト値をインポート
    ModelProvider -->> User: モデル選択肢を動的にレンダリング
Loading

Assessment against linked issues

Objective Addressed Explanation
各AIのモデル一覧を一つのファイルにまとめる (#374)
デフォルトのモデルも規定できるようにする (#374)

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@cloudflare-workers-and-pages
Copy link

Deploying aituber-kit-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ad872d
Status: ✅  Deploy successful!
Preview URL: https://8759a356.aituber-kit-4s1.pages.dev
Branch Preview URL: https://devin-1746172485-consolidate.aituber-kit-4s1.pages.dev

View logs

Copy link

@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

🧹 Nitpick comments (1)
src/features/constants/aiModels.ts (1)

1-16: 各AIサービスのデフォルトモデルを一元管理

AIサービスとそのデフォルトモデルのマッピングが明確に定義されています。このオブジェクトを中央化することで、アプリケーション全体でのデフォルトモデルの一貫性が確保されます。

TypeScriptの型定義を追加すると、より堅牢になります。例えば:

export type AIServiceKey = 'openai' | 'anthropic' | 'google' | /* ... その他のサービス */;
export const defaultModels: Record<AIServiceKey, string> = { /* ... */ }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 261504c and 4ad872d.

📒 Files selected for processing (3)
  • src/components/settings/modelProvider.tsx (13 hunks)
  • src/features/constants/aiModels.ts (1 hunks)
  • src/features/stores/settings.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/features/stores/settings.ts (1)
src/features/constants/aiModels.ts (2)
  • multiModalAIServices (101-101)
  • googleSearchGroundingModels (51-55)
src/components/settings/modelProvider.tsx (1)
src/features/constants/aiModels.ts (11)
  • openaiRealtimeModels (25-29)
  • openaiAudioModels (31-35)
  • openaiModels (18-23)
  • anthropicModels (37-42)
  • googleModels (44-49)
  • groqModels (57-62)
  • cohereModels (64-72)
  • mistralaiModels (74-79)
  • perplexityModels (81-87)
  • fireworksModels (89-97)
  • deepseekModels (99-99)
src/features/constants/aiModels.ts (1)
src/features/stores/settings.ts (2)
  • googleSearchGroundingModels (27-27)
  • multiModalAIServices (24-24)
🔇 Additional comments (17)
src/features/constants/aiModels.ts (3)

18-55: OpenAIとGoogleのモデルリストが適切に分類されています

通常モデル、リアルタイムモデル、オーディオモデルが明確に分離され、特定の機能に必要なモデルを簡単に選択できるようになっています。Google検索連携モデルも適切に定義されています。

モデルのバージョン変更や追加が発生した場合、この1ファイルだけを更新すれば良いのでメンテナンス性が向上しています。


57-99: 他のAIプロバイダーのモデルリストが整理されています

Groq、Cohere、Mistral AI、Perplexity、Fireworksなど、様々なAIプロバイダーのモデルが一覧化されており、各プロバイダーごとに明確に分類されています。

Fireworksのモデル名には長いプレフィックスが含まれていますが、表示時に処理されていることを確認しました(modelProvider.tsxの931行目)。


101-101: マルチモーダルAIサービスのリストを定義

このリストは、画像処理などのマルチモーダル機能をサポートするAIサービスを識別するために使用されています。

今後、他のプロバイダーがマルチモーダル機能をサポートした場合、このリストに追加するだけで良いので拡張性も確保されています。

src/features/stores/settings.ts (1)

19-28: 定数の中央管理化による再利用

AIモデルの定数をaiModels.tsからインポートして再エクスポートする形に変更され、一元管理されるようになりました。このパターンは名前空間の汚染を避けつつ、一貫性を保つのに有効です。

インポート名にimportedプレフィックスを付けることで、再エクスポートする際に名前の衝突を防いでいます。このパターンは変数のソースを明確にするので良い実践です。

src/components/settings/modelProvider.tsx (13)

21-34: AIモデルの一元管理されたインポート

モデルリストをaiModels.tsから直接インポートすることで、コードの重複を削減し、一貫性を確保しています。必要なモデルリストが明示的にインポートされているので、依存関係が明確になっています。


135-135: コメントによる説明追加

このコメントは、以前のコードでは直接定義されていたdefaultModelsが現在はインポートされていることを説明しています。コードの変更履歴や理解を助けるため、このような説明コメントは有用です。


370-374: 動的なモデルリスト生成(OpenAIリアルタイムモデル)

ハードコードされたオプションリストが、配列からの動的マッピングに置き換えられています。これにより、新しいモデルが追加された場合でも、このコードを変更する必要がなくなり、メンテナンス性が向上しています。


437-441: 動的なモデルリスト生成(OpenAIオーディオモデル)

オーディオモデルもリアルタイムモデルと同様に、中央管理された配列から動的に生成されるようになっています。一貫した実装パターンが使用されており、コードの予測可能性が向上しています。


468-472: 動的なモデルリスト生成(OpenAI標準モデル)

標準のOpenAIモデルも同様に、中央管理された配列から動的に生成されるようになっています。これにより、モデルの追加や変更が簡単になり、アプリケーション全体での一貫性が確保されています。


512-516: 動的なモデルリスト生成(Anthropicモデル)

Anthropicのモデルリストも、中央管理された配列から動的に生成されるようになっています。すべてのAIプロバイダーで同じパターンが適用されており、コードの一貫性が確保されています。


563-567: 動的なモデルリスト生成(Googleモデル)

Googleのモデルリストも、中央管理された配列から動的に生成されるようになっています。これにより、使用可能なモデルを簡単に更新でき、アプリケーション全体での一貫性が確保されています。


749-753: 動的なモデルリスト生成(Groqモデル)

Groqのモデルリストも、中央管理された配列から動的に生成されるようになっています。すべてのAIプロバイダーで一貫したパターンが使用されており、コードの予測可能性と保守性が向上しています。


794-798: 動的なモデルリスト生成(Cohereモデル)

Cohereのモデルリストも、中央管理された配列から動的に生成されるようになっています。コードの重複が削減され、モデルリストの管理が容易になっています。


839-843: 動的なモデルリスト生成(Mistral AIモデル)

Mistral AIのモデルリストも、中央管理された配列から動的に生成されるようになっています。一貫したパターンの適用により、コードのメンテナンス性と可読性が向上しています。


884-888: 動的なモデルリスト生成(Perplexityモデル)

Perplexityのモデルリストも、中央管理された配列から動的に生成されるようになっています。リストの追加や更新が簡単になり、アプリケーション全体での一貫性が確保されています。


929-933: Fireworksモデルの表示改善

Fireworksのモデルは、表示時にaccounts/fireworks/models/プレフィックスを削除して、より読みやすい形式で表示されています。ユーザーエクスペリエンスの観点から、これは良い改善です。

プレフィックス除去のロジックをより中央化することも検討できますが、現在の実装でも問題ありません。


1053-1057: 動的なモデルリスト生成(DeepSeekモデル)

DeepSeekのモデルリストも、中央管理された配列から動的に生成されるようになっています。これで、すべてのAIプロバイダーで一貫したパターンが適用され、コードの一貫性と保守性が確保されています。

@tegnike tegnike closed this May 7, 2025
@tegnike tegnike deleted the devin/1746172485-consolidate-ai-models branch May 7, 2025 11:43
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