Skip to content

fix(adapter-openai-like): 支持按关键词隐藏模型#798

Open
CookSleep wants to merge 2 commits intoChatLunaLab:v1-devfrom
CookSleep:fix/openai-like-blacklist-models
Open

fix(adapter-openai-like): 支持按关键词隐藏模型#798
CookSleep wants to merge 2 commits intoChatLunaLab:v1-devfrom
CookSleep:fix/openai-like-blacklist-models

Conversation

@CookSleep
Copy link
Copy Markdown
Member

变更说明

  • chatluna-openai-like-adapter 中新增“关键词黑名单模型列表”配置项,支持按关键词过滤模型 ID。
  • 在模型刷新流程中加入黑名单过滤逻辑(大小写不敏感,按包含关系匹配)。
  • 补充中英文 schema 文案,确保控制台配置项可见且语义清晰。

验证

  • yarn fast-build adapter-openai-like

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此PR为 chatluna-openai-like-adapter 引入了一项新功能,允许用户通过配置关键词黑名单来隐藏特定模型。这项功能通过在模型检索过程中应用过滤逻辑实现,增强了用户对模型可见性的控制,并提升了适配器的灵活性。

Highlights

  • 新增模型过滤配置: 在 chatluna-openai-like-adapter 中新增了“关键词黑名单模型列表”配置项,允许用户通过关键词过滤模型ID。
  • 实现黑名单过滤逻辑: 在模型刷新流程中加入了黑名单过滤逻辑,该逻辑大小写不敏感,并按包含关系匹配模型ID。
  • 完善多语言配置描述: 补充了中英文的Schema文案,确保控制台中的配置项可见且语义清晰。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4245414e-c940-43cc-b893-287c5137ef90

📥 Commits

Reviewing files that changed from the base of the PR and between af3167d and 74280ad.

📒 Files selected for processing (1)
  • packages/adapter-openai-like/src/client.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/adapter-openai-like/src/client.ts

Walkthrough

向 OpenAI 兼容适配器添加了模型黑名单配置项 blacklistModels;在 refreshModels() 中对该黑名单进行规范化(trim + lowercase + 去空)并在生成返回模型列表前按子字符串匹配排除黑名单项。

Changes

Cohort / File(s) Summary
配置接口与模式
packages/adapter-openai-like/src/index.ts
新增 Config 接口与运行时 schema 的 blacklistModels: string[] 字段,默认值为 []
模型过滤逻辑
packages/adapter-openai-like/src/client.ts
refreshModels() 现在规范化 this._config.blacklistModels(trim、lowercase、移除空字符串),并在生成 formattedModels 前按子字符串匹配从候选模型中排除黑名单模型;保留对 additionalModels 的去重逻辑。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

庆祝诗

🐰 我在草丛里数代码,轻轻剪去不合拍,
黑名单像胡萝卜,悄悄藏进配置栈,
模型队列更整齐,适配器跳起欢快舞,
小小变更大改观,兔子鼓掌又点菜!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了主要变更:为OpenAI兼容适配器添加按关键词隐藏模型的功能。
Description check ✅ Passed 描述与变更集相关,详细说明了新增黑名单过滤功能、实现方式和验证步骤。
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.

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Code Review

这个 PR 新增了根据关键词黑名单隐藏模型的功能。代码实现清晰,过滤逻辑正确。我提出了一个建议,通过处理可能为 nullundefined 的配置值来增强代码的健壮性,以防止潜在的运行时错误。

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.

1 participant