Skip to content

Commit c64479c

Browse files
authored
Merge pull request #1 from Zipstack/fix/prompt-studio-index-and-run
fix: Prompt studio index and run issues
2 parents 26ebb17 + b7d06cf commit c64479c

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

backend/prompt_studio/prompt_studio_core/prompt_ide_base_tool.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22

3-
from account.models import PlatformKey
3+
from platform_settings.platform_auth_service import (
4+
PlatformAuthenticationService,
5+
)
46
from prompt_studio.prompt_studio_core.constants import LogLevel, ToolStudioKeys
57
from unstract.sdk.tool.stream import StreamMixin
68

@@ -32,7 +34,11 @@ def get_env_or_die(self, env_key: str) -> str:
3234
"""
3335
# HACK: Adding platform key for multitenancy
3436
if env_key == ToolStudioKeys.PLATFORM_SERVICE_API_KEY:
35-
platform_key = PlatformKey.objects.get(organization=self.org_id)
37+
platform_key = (
38+
PlatformAuthenticationService.get_active_platform_key(
39+
self.org_id
40+
)
41+
)
3642
key: str = str(platform_key.key)
3743
return key
3844
else:

backend/prompt_studio/prompt_studio_core/prompt_studio_helper.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from pathlib import Path
55
from typing import Any, Optional
66

7-
from account.models import Organization
8-
from account.organization import OrganizationService
97
from django.conf import settings
108
from file_management.file_management_helper import FileManagerHelper
119
from prompt_studio.prompt_profile_manager.models import ProfileManager
@@ -218,14 +216,8 @@ def prompt_responder(
218216
),
219217
)
220218
logger.info(f"Invoking prompt service for prompt id {id}")
221-
org: Optional[
222-
Organization
223-
] = OrganizationService.get_organization_by_org_id(org_id=org_id)
224219
response = PromptStudioHelper._fetch_response(
225-
path=file_path,
226-
tool=tool,
227-
prompts=prompts,
228-
org_id=org.id, # type:ignore
220+
path=file_path, tool=tool, prompts=prompts, org_id=org_id
229221
)
230222
stream_log.publish(
231223
tool.tool_id,

prompt-service/src/unstract/prompt_service/prompt_ide_base_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def get_env_or_die(self, env_key: str) -> str:
3030
Returns:
3131
str: Value of the env
3232
"""
33+
# HACK: Adding platform key for multitenancy
3334
if env_key == PromptServiceContants.PLATFORM_SERVICE_API_KEY:
3435
if not self.platform_key:
3536
current_app.logger.error(f"{env_key} is required")

0 commit comments

Comments
 (0)