Conversation
Stock nginx (1.18-1.24 on Debian/Ubuntu) has no `.mjs` entry in mime.types, so the runtime-extension vendor shims the import map points at came back as application/octet-stream. Browsers refuse to execute an ES module with that type, so every runtime-loaded extension (WordPress, Git, Mail, Fail2ban, ...) failed on fresh installs with "Failed to fetch dynamically imported module: blob:..." (Chrome) or "'application/octet-stream' is not a valid JavaScript MIME type" (Safari). Add a location block to the shipped vhosts (and the container frontend config) that forces text/javascript for /serverkit-vendor/*.mjs. The regex is anchored to that folder: a bare `\.mjs$` would also capture the /api/v1/plugins/<slug>/assets/dist/index.mjs route and 404 every bundle. update.sh already re-copies these vhosts, so existing installs pick it up on their next update. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NWc84WDsWR7M55Mn7qtpie
…endor shim MIME The tree backup rsync copied backend/instance/serverkit.db even though the same database had just been written as the pre-upgrade copy, and rollback only ever restores from that copy. On a 450 MB database that made every update cost ~900 MB of backups, which is how small VPSes kept filling up. Exclude the SQLite files from the tree snapshot. Retention is unchanged (SERVERKIT_BACKUP_RETENTION, default 3, plus the 15% disk budget). Add a test that every shipped nginx vhost forces a JavaScript MIME type for /serverkit-vendor/*.mjs and that the regex cannot capture the /api/v1/plugins/<slug>/assets/... route. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NWc84WDsWR7M55Mn7qtpie
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of confirmed issues in the updated code (UI state handling and an inaccurate updater comment) that should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR upgrades the AI assistant configuration model from a single global provider/key to named, encrypted provider connections with per-chat affinity, and includes operational fixes for nginx .mjs MIME handling and update backup size.
Changes:
- Add backend connection catalog/save/probe plumbing (Prompture descriptor–driven) plus DB migration to pin conversations to a connection and widen model IDs.
- Update frontend settings + chat drawer to manage/select connections and models, and adjust i18n to the new
ai.connectionsnamespace. - Fix shipped nginx vhosts to serve
/serverkit-vendor/*.mjsas JavaScript and reduce updater backup footprint by excluding SQLite DB files from rsync tree snapshots.
File summaries
| File | Description |
|---|---|
| scripts/update.sh | Exclude SQLite DB files from rsync install-tree snapshot to avoid double backup size. |
| ROADMAP.md | Document implemented “Prompture Provider Connections” feature and scope notes. |
| nginx/sites-available/serverkit.conf | Force correct JS MIME for /serverkit-vendor/*.mjs shims. |
| nginx/sites-available/serverkit-insecure.conf | Force correct JS MIME for /serverkit-vendor/*.mjs shims. |
| frontend/src/styles/components/_ai-assistant.scss | Add styling for the in-chat connection/model selector row. |
| frontend/src/services/api/ai.js | Add API methods for connection CRUD and probe endpoints. |
| frontend/src/i18n/locales/ar.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/bn.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/de.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/en.json | Add ai.connections.* strings and remove old AI settings strings no longer used. |
| frontend/src/i18n/locales/es.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/fr.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/id.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/it.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/ko.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/pl.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/pt.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/ru.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/th.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/tr.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/vi.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/zh-Hans.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/i18n/locales/zh-Hant.json | Remove obsolete AI settings keys; rely on new namespace fallbacks. |
| frontend/src/contexts/AIContext.jsx | Track available connections + selected connection/model and send on first message. |
| frontend/src/components/settings/AISettingsTab.jsx | Replace legacy provider/key UI with the new AIConnectionsSettings panel. |
| frontend/src/components/settings/AIConnectionsSettings.jsx | New connection editor UI with provider-driven fields + discover/test/save flows. |
| frontend/src/components/ai/ConnectionSelector.jsx | New pre-chat selector to choose connection and optionally override model. |
| frontend/src/components/ai/ChatDrawer.jsx | Render the new connection selector before chat start. |
| frontend/nginx.conf | Force correct JS MIME for /serverkit-vendor/*.mjs shims (frontend container vhost). |
| docs/AI_PROVIDERS.md | New documentation for configuring providers/gateways and connection semantics. |
| CHANGELOG.md | Note nginx .mjs MIME fix for runtime-loaded extensions. |
| backend/tests/test_vendor_shim_mime.py | New tests asserting vhosts include correct .mjs location block and regex scope. |
| backend/tests/test_ai_connections.py | New tests for connection behavior, probes, migration, and driver boundary rules. |
| backend/requirements.txt | Pin Prompture + include OpenAI/Anthropic extras for supported drivers. |
| backend/migrations/versions/098_ai_provider_connections.py | New migration adding connection table, FK, indexes, and model_name widening + legacy import. |
| backend/app/services/ai_service.py | Route provider/model selection through saved connections and inject configured driver on resume. |
| backend/app/services/ai_connections.py | New service for provider catalog, draft validation, secret handling, driver build, and probe requests. |
| backend/app/models/ai.py | Add AiProviderConnection model; add conversation connection_id and widen model_name. |
| backend/app/api/ai.py | Add connection CRUD/probe endpoints and plumb connection/model into conversation creation/chat routes. |
Review details
- Files reviewed: 39/39 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Keep connection persistence behind the service boundary, use typed errors and shared JSON parsing, and refresh reviewed inventories. The new GET connection catalog accepts API keys so API clients managing connections can discover IDs without exposing credentials; existing JWT-only routes stay unchanged. Add regression coverage and release notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The AI assistant now supports named provider connections with encrypted credentials and a panel default. New chats choose a connection and model; existing conversations retain their original selection. This promotion releases ServerKit 1.10.0.
Changes
.mjsshims with a JavaScript MIME type in all shipped nginx vhosts, without intercepting plugin API assets.Validation
The backend dependency is pinned to
prompture[openai,anthropic]==1.11.0; upgrades must install the updated requirements and run migration098_ai_provider_connections.