feat: add configurable share link base URL for container deployment [AC-IDMP-SHARE]
This commit is contained in:
parent
9198f4dfb3
commit
2504d6b955
|
|
@ -24,6 +24,7 @@ from app.api.mid.dialogue import (
|
|||
get_trace_logger,
|
||||
respond_dialogue,
|
||||
)
|
||||
from app.core.config import get_settings
|
||||
from app.core.database import get_session
|
||||
from app.core.tenant import clear_tenant_context, set_tenant_context
|
||||
from app.models.mid.schemas import DialogueRequest, HistoryMessage
|
||||
|
|
@ -78,6 +79,11 @@ async def create_public_share_token(request: Request, body: CreatePublicShareTok
|
|||
expires_in_minutes=body.expires_in_minutes,
|
||||
)
|
||||
|
||||
# Use configured base URL if available, otherwise fallback to request base_url
|
||||
settings = get_settings()
|
||||
if settings.share_link_base_url:
|
||||
base_url = settings.share_link_base_url.rstrip("/")
|
||||
else:
|
||||
base_url = str(request.base_url).rstrip("/")
|
||||
share_url = f"{base_url}/openapi/v1/share/chat?token={token}"
|
||||
return CreatePublicShareTokenResponse(
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ class Settings(BaseSettings):
|
|||
|
||||
frontend_base_url: str = "http://localhost:3000"
|
||||
|
||||
# Share link base URL (for container deployment, use external domain)
|
||||
share_link_base_url: str = ""
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
|
|
|
|||
Loading…
Reference in New Issue