LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
[MISC] Centralize internal link org-prefix resolution in CustomMarkdown (#1884)
Chandrasekharan Mfd84260e108d
diff --git a/frontend/src/components/helpers/custom-markdown/CustomMarkdown.jsx b/frontend/src/components/helpers/custom-markdown/CustomMarkdown.jsxindex ff9bfe73e..9e895674b 100644--- a/frontend/src/components/helpers/custom-markdown/CustomMarkdown.jsx+++ b/frontend/src/components/helpers/custom-markdown/CustomMarkdown.jsx@@ -3,6 +3,8 @@ import PropTypes from "prop-types";import { useMemo } from "react";import { Link as RouterLink } from "react-router-dom";+import { useSessionStore } from "../../../store/session-store";+const { Text, Link, Paragraph } = Typography;const CustomMarkdown = ({@@ -11,6 +13,8 @@ const CustomMarkdown = ({isSecondary = false,styleClassName,}) => {+ const { sessionDetails } = useSessionStore();+ const orgName = sessionDetails?.orgName;const textType = isSecondary ? "secondary" : undefined;/*@@ -52,7 +56,8 @@ const CustomMarkdown = ({case "link": {const isInternal = url?.startsWith("/");if (isInternal) {- return <RouterLink to={url}>{content}</RouterLink>;+ const resolvedUrl = orgName ? `/${orgName}${url}` : url;+ return <RouterLink to={resolvedUrl}>{content}</RouterLink>;}return (<Link href={url} target="_blank" rel="noopener noreferrer">@@ -99,7 +104,7 @@ const CustomMarkdown = ({});return elements;- }, [text, renderNewLines, textType]);+ }, [text, renderNewLines, textType, orgName]);return (<Text type={textType} className={styleClassName}>diff --git a/frontend/src/hooks/useExceptionHandler.jsx b/frontend/src/hooks/useExceptionHandler.jsxindex 54037820f..1a43811d3 100644--- a/frontend/src/hooks/useExceptionHandler.jsx+++ b/frontend/src/hooks/useExceptionHandler.jsx@@ -1,30 +1,12 @@import PropTypes from "prop-types";import { useNavigate } from "react-router-dom";-import { useSessionStore } from "../store/session-store.js";-const useExceptionHandler = () => {const navigate = useNavigate();- const { sessionDetails } = useSessionStore();-- // Resolves relative markdown links [text](/path) to [text](/{orgName}/path)- const enrichMarkdownLinks = (message) => {- if (typeof message !== "string") {- return message;- }- const orgName = sessionDetails?.orgName;- if (!orgName) {- return message;- }- return message.replace(- /\[([^\]]+)\]\(\/((?!\/)[^)]+)\)/g,- (_, text, path) => `[${text}](/${orgName}/${path})`,- );- };const buildAlert = (content, title, duration) => ({type: "error",- content: enrichMarkdownLinks(content),+ content,title,duration,});