mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 17:05:56 +03:00
[PR #420] [MERGED] Add tenant-aware provider resolution for text/image/video/audio facades #725
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#725
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/420
Author: @AJaySi
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @AJaySi
Base:
main← Head:codex/add-tenant-config-resolver-module📝 Commits (1)
feacbc6Add tenant-aware provider config resolver across LLM facades📊 Changes
5 files changed (+241 additions, -84 deletions)
View changed files
📝
backend/services/llm_providers/main_audio_generation.py(+10 -6)📝
backend/services/llm_providers/main_image_generation.py(+18 -24)📝
backend/services/llm_providers/main_text_generation.py(+31 -41)📝
backend/services/llm_providers/main_video_generation.py(+14 -13)➕
backend/services/llm_providers/tenant_provider_config.py(+168 -0)📄 Description
Motivation
user_idwhile keeping env vars as fallbacks.Description
backend/services/llm_providers/tenant_provider_config.pywhich implementsTenantProviderConfigResolverto resolve selected providers, model defaults, and credential source with priority: tenant DB (onboarding API keys) -> environment variables.main_text_generation.py) to call the resolver for modality="text", to pick a provider/model per request, to passuser_idinto provider key lookup, and to inject resolved keys into env variables consumed by provider clients when available.main_image_generation.py) to resolve provider per-request (viatenant_provider_config_resolver) and to instantiate provider clients with tenant-resolvedapi_keywhere supported (HF/WaveSpeed/Stability/Gemini injection).main_video_generation.py) to resolve provider/credentials per-request and to passuser_idinto the HuggingFace key lookup path (_get_api_keyand_generate_with_huggingface) and to use resolved provider selection before dispatch.main_audio_generation.py) to create WaveSpeed clients with tenant-resolved keys via a_get_wavespeed_client(user_id)helper and replaced direct env-onlyWaveSpeedClient()usage.get_api_key/_get_api_keysignatures accept optionaluser_idto allow tenant-scoped resolution.Testing
python -m py_compile backend/services/llm_providers/tenant_provider_config.py backend/services/llm_providers/main_text_generation.py backend/services/llm_providers/main_image_generation.py backend/services/llm_providers/main_video_generation.py backend/services/llm_providers/main_audio_generation.pyand the compilation succeeded.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.