7 | Get started by editing
8 | app/page.tsx
9 |
115 | Invalid LlamaCloud configuration. Check console logs. 116 |
117 | ); 118 | } 119 | const { projects, pipeline } = config; 120 | 121 | return ( 122 | 155 | ); 156 | } 157 | 158 | function isValid( 159 | projects: LLamaCloudProject[] | undefined, 160 | pipeline: PipelineConfig | undefined, 161 | logErrors: boolean = true, 162 | ): boolean { 163 | if (!projects?.length) return false; 164 | if (!pipeline) return false; 165 | const matchedProject = projects.find( 166 | (project: LLamaCloudProject) => project.name === pipeline.project, 167 | ); 168 | if (!matchedProject) { 169 | if (logErrors) { 170 | console.error( 171 | `LlamaCloud project ${pipeline.project} not found. Check LLAMA_CLOUD_PROJECT_NAME variable`, 172 | ); 173 | } 174 | return false; 175 | } 176 | const pipelineExists = matchedProject.pipelines.some( 177 | (p) => p.name === pipeline.pipeline, 178 | ); 179 | if (!pipelineExists) { 180 | if (logErrors) { 181 | console.error( 182 | `LlamaCloud pipeline ${pipeline.pipeline} not found. Check LLAMA_CLOUD_INDEX_NAME variable`, 183 | ); 184 | } 185 | return false; 186 | } 187 | return true; 188 | } 189 | -------------------------------------------------------------------------------- /app/components/ui/chat/custom/markdown.tsx: -------------------------------------------------------------------------------- 1 | import { SourceData } from "@llamaindex/chat-ui"; 2 | import { Markdown as MarkdownUI } from "@llamaindex/chat-ui/widgets"; 3 | import { useClientConfig } from "../hooks/use-config"; 4 | 5 | const preprocessMedia = (content: string) => { 6 | // Remove `sandbox:` from the beginning of the URL before rendering markdown 7 | // OpenAI models sometimes prepend `sandbox:` to relative URLs - this fixes it 8 | return content.replace(/(sandbox|attachment|snt):/g, ""); 9 | }; 10 | 11 | export function Markdown({ 12 | content, 13 | sources, 14 | }: { 15 | content: string; 16 | sources?: SourceData; 17 | }) { 18 | const { backend } = useClientConfig(); 19 | const processedContent = preprocessMedia(content); 20 | return ( 21 |