feat(credentials): add Azure OpenAI credential type to the project dashboard - #14
Open
Rahulkaushik01 wants to merge 1 commit into
Open
feat(credentials): add Azure OpenAI credential type to the project dashboard#14Rahulkaushik01 wants to merge 1 commit into
Rahulkaushik01 wants to merge 1 commit into
Conversation
…shboard Adds a per-project Azure OpenAI credential (endpoint, deployment, api_key, api_version), mirroring the existing STT credential types. Stored encrypted in the existing Credentials model and read back via get_credentials(); this is the storage foundation for upcoming meeting title/summary generation. Dashboard + storage only — no consumer wired yet. - bots/models.py: add AZURE_OPENAI credential type + DEFAULT_AZURE_OPENAI_API_VERSION constant - bots/projects_views.py: create/save branch (endpoint+deployment+api_key required, api_version defaults to the constant), partial dispatch, and credentials-page context - bots/templates/projects/partials/azure_openai_credentials.html: Add/Edit card + modal (masked API key, non-secret fields prefilled on edit) - bots/templates/projects/project_credentials.html: include the Azure OpenAI card - bots/migrations/0095_alter_credentials_credential_type.py: additive choice migration - bots/tests/test_azure_openai_credentials.py: create/default/validation/edit/delete/ page-render/encryption round-trip tests
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.
What & why
Adds a per-project Azure OpenAI credential to the project dashboard, alongside the
existing STT providers. This is the storage foundation for upcoming meeting title +
summary generation — a separate concern from the transcription
OpenAIcredential(chat/completions needs endpoint + deployment + api-version, which a plain key can't hold).
Scope: dashboard + encrypted storage only. No consumer is wired yet (the summarization
task lands in a later phase), so this changes no runtime behaviour — a project without an
Azure credential is simply unaffected.
How it works
endpoint,deployment,api_key,api_version(optional → defaults tothe
DEFAULT_AZURE_OPENAI_API_VERSIONconstant).get_or_create(project, type)+set_credentials(dict)— Fernet-encrypted atrest, exactly like every other provider (verified: the stored blob is ciphertext, no plaintext).
…credentials.filter(credential_type=AZURE_OPENAI).first().get_credentials().DeleteCredentialsView(no type-specific code).fields are pre-filled on edit so editing never silently drops them.
Per-file changes
bots/models.py— addAZURE_OPENAI = 12credential type +DEFAULT_AZURE_OPENAI_API_VERSIONconstant.bots/projects_views.py— Azure branch inget_partial_for_credential_type; save branch inCreateCredentialsView.post(require endpoint+deployment+api_key → 400, default api_version);Azure query + two context keys in
ProjectCredentialsView; import the constant.bots/templates/projects/partials/azure_openai_credentials.html(new) — Add/Edit card + modal(masked key display, htmx save).
bots/templates/projects/project_credentials.html— include the Azure card.bots/migrations/0095_alter_credentials_credential_type.py(new) — additiveAlterFieldfor thenew choice (no data change).
bots/tests/test_azure_openai_credentials.py(new) — 9 tests.Testing
python manage.py makemigrations --check→ No changes detected (migration matches the model).python manage.py test bots.tests.test_azure_openai_credentials→ 9 passed; existingtest_delete_credentials→ 8 passed (no regression).ruff check/ruff format --check→ clean.delete. Encryption-at-rest confirmed.
Notes
Credentialsrow — never in code, env, or a bundle.