Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os

from account.models import PlatformKey
from platform_settings.platform_auth_service import (
PlatformAuthenticationService,
)
from prompt_studio.prompt_studio_core.constants import LogLevel, ToolStudioKeys
from unstract.sdk.tool.stream import StreamMixin

Expand Down Expand Up @@ -32,7 +34,11 @@ def get_env_or_die(self, env_key: str) -> str:
"""
# HACK: Adding platform key for multitenancy
if env_key == ToolStudioKeys.PLATFORM_SERVICE_API_KEY:
platform_key = PlatformKey.objects.get(organization=self.org_id)
platform_key = (
PlatformAuthenticationService.get_active_platform_key(
self.org_id
)
)
key: str = str(platform_key.key)
return key
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from pathlib import Path
from typing import Any, Optional

from account.models import Organization
from account.organization import OrganizationService
from django.conf import settings
from file_management.file_management_helper import FileManagerHelper
from prompt_studio.prompt_profile_manager.models import ProfileManager
Expand Down Expand Up @@ -218,14 +216,8 @@ def prompt_responder(
),
)
logger.info(f"Invoking prompt service for prompt id {id}")
org: Optional[
Organization
] = OrganizationService.get_organization_by_org_id(org_id=org_id)
response = PromptStudioHelper._fetch_response(
path=file_path,
tool=tool,
prompts=prompts,
org_id=org.id, # type:ignore
path=file_path, tool=tool, prompts=prompts, org_id=org_id
)
stream_log.publish(
tool.tool_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def get_env_or_die(self, env_key: str) -> str:
Returns:
str: Value of the env
"""
# HACK: Adding platform key for multitenancy
if env_key == PromptServiceContants.PLATFORM_SERVICE_API_KEY:
if not self.platform_key:
current_app.logger.error(f"{env_key} is required")
Expand Down