Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Moving public prefix within try-catch block (#486)

harini-venkataraman142174cf8dfe
diff --git a/backend/backend/public_urls.py b/backend/backend/public_urls.py
index ffeb5f02e..5eb9ab823 100644
--- a/backend/backend/public_urls.py
+++ b/backend/backend/public_urls.py
@@ -22,7 +22,6 @@ from django.urls import include, path
path_prefix = settings.PATH_PREFIX
api_path_prefix = settings.API_DEPLOYMENT_PATH_PREFIX
-share_path_prefix = settings.PUBLIC_PATH_PREFIX
urlpatterns = [
path(f"{path_prefix}/", include("account.urls")),
@@ -51,6 +50,8 @@ try:
import pluggable_apps.platform_admin.urls # noqa # pylint: disable=unused-import
import pluggable_apps.public_shares_share_controller.urls # noqa # pylint: disable=unused-import
+ share_path_prefix = settings.PUBLIC_PATH_PREFIX
+
urlpatterns += [
path(f"{path_prefix}/", include("pluggable_apps.platform_admin.urls")),
# Public Sharing
diff --git a/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js b/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
index 7bd9017c8..529c0f48c 100644
--- a/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
+++ b/frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
@@ -10,6 +10,13 @@ import { useSocketCustomToolStore } from "../../../store/socket-custom-tool";
import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";
import { useTokenUsageStore } from "../../../store/token-usage-store";
+let shareManagerToolSource;
+try {
+ shareManagerToolSource =
+ require("../../../plugins/prompt-studio-public-share/helpers/PublicShareAPIs").shareManagerToolSource;
+} catch (err) {
+ // Do nothing, Not-found Page will be triggered.
+}
function CustomToolsHelper() {
const [isLoading, setIsLoading] = useState(true);
const { id } = useParams();
@@ -82,11 +89,13 @@ function CustomToolsHelper() {
.then((res) => {
const data = res?.data;
updatedCusTool["llmProfiles"] = data;
- const reqOpsShare = {
- method: "GET",
- url: `/api/v1/unstract/${sessionDetails?.orgId}/share-manager/tool-source/?tool_id=${id}`,
- };
- return handleApiRequest(reqOpsShare);
+ if (shareManagerToolSource) {
+ const reqOpsShare = {
+ method: "GET",
+ url: shareManagerToolSource(id, sessionDetails?.orgId),
+ };
+ return handleApiRequest(reqOpsShare);
+ }
})
.then((res) => {
const data = res?.data;