Repository navigation
Conversation
There was a problem hiding this comment.
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
| "custom_headers": {}, | ||
| }, | ||
| "bf16.ai": { | ||
| "id": "bf16", |
There was a problem hiding this comment.
🟡 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.|
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 |
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: registerbf16.aichat 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, anddocs/.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 --checkandruff checkon 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:
Documentation:
Tests: