Skip to content

Commit

Permalink
Abstracting Cloud share APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
harini-venkataraman committed Jul 16, 2024
1 parent 8d8a74a commit c3c9dd3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions frontend/src/components/helpers/custom-tools/CustomToolsHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c3c9dd3

Please sign in to comment.