Skip to content

feat(provider): add bf16.ai chat completion provider preset - #11348

Closed
FiendSaws wants to merge 2 commits into
AstrBotDevs:masterfrom
FiendSaws:feat/bf16-provider
Closed

FiendSaws wants to merge 2 commits into
AstrBotDevs:masterfrom
FiendSaws:feat/bf16-provider

Conversation

@FiendSaws

@FiendSaws FiendSaws commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

Adds bf16.ai as a built-in OpenAI-compatible Chat Completion provider preset in AstrBot, enabling one-click setup from WebUI (Providers → Chat Completion → Add → bf16.ai).

Why bf16.ai for AstrBot agents

bf16.ai serves uncensored open-weight models (refusal behavior removed from the model weights rather than papered over with system prompts) with 1M-token context windows, native multimodal vision, deterministic function/tool calling, and ultra-low false-positive refusal rates over https://api.bf16.ai/v1. For autonomous AstrBot IM workflows, technical group bots, and Agent Sandbox tasks, this prevents multi-step tool chains from stalling on benign security/code/colloquial prompts while AstrBot's own local permissions and Docker sandboxes govern execution.

Changes

  • astrbot/core/config/default.py: register bf16.ai chat completion provider template (api_base: https://api.bf16.ai/v1, type: openai_chat_completion, id: bf16).
  • dashboard/src/assets/images/provider_logos/bf16.svg & dashboard/src/utils/providerUtils.js: add the bf16.ai provider icon.
  • docs/en/providers/bf16.md, docs/zh/providers/bf16.md, and docs/.vitepress/config.mjs: add bilingual setup guides and sidebar entries.
  • tests/unit/test_bf16_provider_config.py: add unit test verifying template registration.

Verification

  • ruff format --check and ruff check on all modified/added Python files: passed.
  • pytest tests/unit/test_bf16_provider_config.py: passed.
  • node -c docs/.vitepress/config.mjs: syntax verified.

Disclosure: I work on bf16.ai.

Summary by Sourcery

Add a built-in bf16.ai chat completion provider preset with WebUI branding, documentation, and registration coverage.

New Features:

  • Add bf16.ai as a built-in OpenAI-compatible chat completion provider available for WebUI setup.
  • Add bf16.ai branding to the provider selector and document configuration in English and Chinese.

Documentation:

  • Add bilingual bf16.ai provider setup guides and documentation navigation entries.

Tests:

  • Add unit coverage confirming the bf16.ai provider template is registered.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="astrbot/core/config/default.py" line_range="1686" />
<code_context>
                         "custom_headers": {},
                     },
+                    "bf16.ai": {
+                        "id": "bf16",
+                        "provider": "bf16",
+                        "type": "openai_chat_completion",
</code_context>
<issue_to_address>
**Concurrent setup overwrites provider**

When two dashboards with the same initially loaded provider list add and save a bf16.ai source before either refreshes, both dashboards generate `bf16` from their local provider-source lists, and the later `upsert_provider_source` call finds that ID and replaces the stored source instead of rejecting the create. The first dashboard’s API key and settings are lost, and both users see a single provider source.

Make source creation enforce ID uniqueness atomically on the server, or generate IDs that remain unique across dashboards.
</issue_to_address>

### Comment 2
<location path="tests/unit/test_bf16_provider_config.py" line_range="1" />
<code_context>
+from astrbot.core.config.default import CONFIG_METADATA_2
+
+
</code_context>
<issue_to_address>
**Prohibited test file added**

The new test module violates the repository's instruction not to generate test files, introducing a prohibited file in the change.

Remove the newly added test file.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: astrbot/core/config/default.py:1686


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

"custom_headers": {},
},
"bf16.ai": {
"id": "bf16",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium · Concurrent setup overwrites provider

When two dashboards with the same initially loaded provider list add and save a bf16.ai source before either refreshes, both dashboards generate bf16 from their local provider-source lists, and the later upsert_provider_source call finds that ID and replaces the stored source instead of rejecting the create. The first dashboard’s API key and settings are lost, and both users see a single provider source.

Make source creation enforce ID uniqueness atomically on the server, or generate IDs that remain unique across dashboards.

Prompt for AI agents
In `astrbot/core/config/default.py` at line 1686:

**Concurrent setup overwrites provider**

When two dashboards with the same initially loaded provider list add and save a bf16.ai source before either refreshes, both dashboards generate `bf16` from their local provider-source lists, and the later `upsert_provider_source` call finds that ID and replaces the stored source instead of rejecting the create. The first dashboard’s API key and settings are lost, and both users see a single provider source.

Make source creation enforce ID uniqueness atomically on the server, or generate IDs that remain unique across dashboards.

Comment thread tests/unit/test_bf16_provider_config.py Resolved
@FiendSaws

Copy link
Copy Markdown
Author

Removed the extra test file per Sourcery feedback so the PR stays strictly scoped to the provider template, icon, and bilingual docs (matching existing provider template PRs such as #10987). Note: the static id: "bf16" field matches every other built-in template in astrbot/core/config/default.py (e.g., openrouter, compshare, tokenpony).

@Soulter Soulter closed this Nov 24, 2026
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