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
4 changes: 2 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
- APPLICATION_NAME=unstract-backend
labels:
- traefik.enable=true
- traefik.http.routers.backend.rule=Host(`frontend.unstract.localhost`) && (PathPrefix(`/api/v1`) || PathPrefix(`/deployment`))
- traefik.http.routers.backend.rule=Host(`frontend.unstract.localhost`) && (PathPrefix(`/api/v1`) || PathPrefix(`/deployment`) || PathPrefix(`/public`))
- traefik.http.services.backend.loadbalancer.server.port=8000
extra_hosts:
# "host-gateway" is a special string that translates to host docker0 i/f IP.
Expand Down Expand Up @@ -134,7 +134,7 @@ services:
- ENVIRONMENT=development
labels:
- traefik.enable=true
- traefik.http.routers.frontend.rule=Host(`frontend.unstract.localhost`) && !PathPrefix(`/api/v1`) && !PathPrefix(`/deployment`)
- traefik.http.routers.frontend.rule=Host(`frontend.unstract.localhost`) && !PathPrefix(`/api/v1`) && !PathPrefix(`/deployment`) && !PathPrefix(`/public`)
- traefik.http.services.frontend.loadbalancer.server.port=80

platform-service:
Expand Down
2 changes: 1 addition & 1 deletion docker/sample.proxy_overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http:
rule: Host(`frontend.unstract.localhost`)
backend:
service: backend
rule: Host(`frontend.unstract.localhost`) && (PathPrefix(`/api/v1`) || PathPrefix(`/deployment`))
rule: Host(`frontend.unstract.localhost`) && (PathPrefix(`/api/v1`) || PathPrefix(`/deployment`) || PathPrefix(`/public`))

services:
frontend:
Expand Down
23 changes: 19 additions & 4 deletions frontend/src/components/custom-tools/combined-output/JsonView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Tabs } from "antd";
import TabPane from "antd/es/tabs/TabPane";
import Prism from "prismjs";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
import { useEffect, useRef, useState } from "react";

import { useCustomToolStore } from "../../../store/custom-tool-store";
import { JsonViewBody } from "./JsonViewBody";

let EnrichedOutputToggle;
Expand All @@ -27,17 +28,31 @@ function JsonView({
isSinglePass,
isLoading,
}) {
const [activeView, setActiveView] = useState("Raw");
// Read-only viewers default to the enriched value.
const isPublicSource = useCustomToolStore((s) => s.isPublicSource);
const [activeView, setActiveView] = useState(
isPublicSource ? "Enriched" : "Raw",
);
Comment thread
greptile-apps[bot] marked this conversation as resolved.
const didInitTab = useRef(false);

useEffect(() => {
Prism.highlightAll();
}, [combinedOutput, enrichedOutput, activeView]);

useEffect(() => {
if (!enrichedOutput || Object.keys(enrichedOutput).length === 0) {
const hasEnriched =
enrichedOutput && Object.keys(enrichedOutput).length > 0;
if (!hasEnriched) {
setActiveView("Raw");
didInitTab.current = false;
return;
}
// Public viewer default fires once so a manual Raw toggle isn't stomped on re-renders.
if (isPublicSource && !didInitTab.current) {
setActiveView("Enriched");
didInitTab.current = true;
}
}, [enrichedOutput]);
}, [enrichedOutput, isPublicSource]);
Comment thread
chandrasekharan-zipstack marked this conversation as resolved.

const displayOutput =
activeView === "Enriched" &&
Expand Down
16 changes: 14 additions & 2 deletions frontend/src/hooks/useAxiosPrivate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@ function useAxiosPrivate() {
},
async (error) => {
if (error?.response?.status === 401) {
// TODO: Implement Session Expired Modal
logout();
// Skip logout on routes that intentionally render without a session.
const onPublicShare =
typeof globalThis !== "undefined" &&
globalThis.location?.pathname.startsWith("/promptStudio/share/");
if (onPublicShare) {
// Keep a breadcrumb so a stray authenticated probe doesn't go silent.
console.warn("[useAxiosPrivate] Suppressed 401 on public share", {
url: error?.config?.url,
path: globalThis.location?.pathname,
});
} else {
// TODO: Implement Session Expired Modal
logout();
}
Comment thread
chandrasekharan-zipstack marked this conversation as resolved.
}
return Promise.reject(error);
},
Expand Down