mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
fix: decouple org preference and ai model preferences
This commit is contained in:
parent
e26d902425
commit
01d898fc72
21 changed files with 460 additions and 238 deletions
|
|
@ -53,7 +53,7 @@ class InitiateCallRequest(BaseModel):
|
|||
workflow_run_id: int | None = None
|
||||
phone_number: str | None = None
|
||||
# Optional explicit telephony config to use for the test call. If omitted,
|
||||
# falls back to the user's per-user default (when set), then the org default.
|
||||
# falls back to the org default.
|
||||
telephony_configuration_id: int | None = None
|
||||
# Optional caller-ID phone number to dial out from. Must belong to the
|
||||
# resolved telephony configuration; otherwise the provider picks one.
|
||||
|
|
@ -82,12 +82,9 @@ async def initiate_call(
|
|||
"""Initiate a call using the configured telephony provider from web browser. This is
|
||||
supposed to be a test call method for the draft version of the agent."""
|
||||
|
||||
from api.services.configuration.ai_model_configuration import (
|
||||
get_organization_ai_model_configuration_preferences,
|
||||
)
|
||||
from api.services.organization_preferences import get_organization_preferences
|
||||
|
||||
user_configuration = await db_client.get_user_configurations(user.id)
|
||||
preferences = await get_organization_ai_model_configuration_preferences(
|
||||
preferences = await get_organization_preferences(
|
||||
user.selected_organization_id,
|
||||
db=db_client,
|
||||
)
|
||||
|
|
@ -124,17 +121,12 @@ async def initiate_call(
|
|||
detail="telephony_not_configured",
|
||||
)
|
||||
|
||||
phone_number = (
|
||||
request.phone_number
|
||||
or preferences.test_phone_number
|
||||
or user_configuration.test_phone_number
|
||||
)
|
||||
phone_number = request.phone_number or preferences.test_phone_number
|
||||
|
||||
if not phone_number:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="Phone number must be provided in request or set in user "
|
||||
"configuration",
|
||||
detail="Phone number must be provided in request or set in organization preferences",
|
||||
)
|
||||
|
||||
workflow = await db_client.get_workflow(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue