@@ -13,6 +13,9 @@ import {
1313 CheckCircle ,
1414 AlertCircle ,
1515 Info ,
16+ Terminal ,
17+ Cloud ,
18+ FileCode ,
1619} from "lucide-react"
1720import { toast } from "sonner"
1821
@@ -35,6 +38,12 @@ import {
3538 AlertDescription ,
3639 AlertTitle ,
3740} from "@/components/ui/alert"
41+ import {
42+ Accordion ,
43+ AccordionContent ,
44+ AccordionItem ,
45+ AccordionTrigger ,
46+ } from "@/components/ui/accordion"
3847import { backendClient } from "@/lib/api-client"
3948
4049interface OpenAISettingsResponse {
@@ -560,6 +569,120 @@ export default function SettingsPage() {
560569 ) }
561570 </ CardContent >
562571 </ Card >
572+
573+ { /* Persistent Changes Instructions */ }
574+ < Card className = "md:col-span-2" >
575+ < CardHeader >
576+ < div className = "flex items-center gap-2" >
577+ < Info className = "h-5 w-5 text-muted-foreground" />
578+ < CardTitle > Making Changes Permanent</ CardTitle >
579+ </ div >
580+ < CardDescription >
581+ Runtime changes above are temporary. For persistent changes that survive container restarts, update your deployment configuration.
582+ </ CardDescription >
583+ </ CardHeader >
584+ < CardContent >
585+ < Alert className = "mb-6" >
586+ < AlertCircle className = "h-4 w-4" />
587+ < AlertTitle > Important</ AlertTitle >
588+ < AlertDescription >
589+ Settings configured above are stored in memory and will be reset when the container restarts.
590+ For production deployments, update the environment variables using one of the methods below.
591+ </ AlertDescription >
592+ </ Alert >
593+
594+ < Accordion type = "single" collapsible className = "w-full" >
595+ < AccordionItem value = "azure-portal" >
596+ < AccordionTrigger >
597+ < div className = "flex items-center gap-2" >
598+ < Cloud className = "h-4 w-4" />
599+ Option 1: Update via Azure Portal (Recommended)
600+ </ div >
601+ </ AccordionTrigger >
602+ < AccordionContent className = "space-y-3 text-sm" >
603+ < ol className = "list-decimal list-inside space-y-2 text-muted-foreground" >
604+ < li > Go to < strong > Azure Portal</ strong > → < strong > Container Apps</ strong > → < strong > Your Backend App</ strong > </ li >
605+ < li > Navigate to < strong > Settings</ strong > → < strong > Environment variables</ strong > </ li >
606+ < li > Update OpenAI variables:
607+ < ul className = "list-disc list-inside ml-4 mt-1" >
608+ < li > < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_ENDPOINT</ code > </ li >
609+ < li > < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_API_KEY</ code > </ li >
610+ < li > < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_DEPLOYMENT_NAME</ code > </ li >
611+ </ ul >
612+ </ li >
613+ < li > For OCR provider (optional):
614+ < ul className = "list-disc list-inside ml-4 mt-1" >
615+ < li > < code className = "bg-muted px-1 rounded" > OCR_PROVIDER</ code > - Set to < code className = "bg-muted px-1 rounded" > azure</ code > or < code className = "bg-muted px-1 rounded" > mistral</ code > </ li >
616+ < li > < code className = "bg-muted px-1 rounded" > MISTRAL_ENDPOINT</ code > - Mistral API endpoint (if using Mistral)</ li >
617+ < li > < code className = "bg-muted px-1 rounded" > MISTRAL_API_KEY</ code > - Mistral API key (if using Mistral)</ li >
618+ < li > < code className = "bg-muted px-1 rounded" > MISTRAL_DOC_AI_MODEL</ code > - Model name (default: mistral-document-ai-2505)</ li >
619+ </ ul >
620+ </ li >
621+ < li > < strong > Restart</ strong > the container app for changes to take effect</ li >
622+ </ ol >
623+ </ AccordionContent >
624+ </ AccordionItem >
625+
626+ < AccordionItem value = "azure-cli" >
627+ < AccordionTrigger >
628+ < div className = "flex items-center gap-2" >
629+ < Terminal className = "h-4 w-4" />
630+ Option 2: Update via Azure CLI
631+ </ div >
632+ </ AccordionTrigger >
633+ < AccordionContent className = "space-y-4" >
634+ < div >
635+ < p className = "text-sm text-muted-foreground mb-2" > Update OpenAI settings:</ p >
636+ < div className = "bg-muted rounded-lg p-4 font-mono text-sm overflow-x-auto" >
637+ < pre className = "whitespace-pre-wrap" > { `az containerapp update \\
638+ --name <your-backend-app-name> \\
639+ --resource-group <your-resource-group> \\
640+ --set-env-vars \\
641+ AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/" \\
642+ AZURE_OPENAI_API_KEY="your-api-key" \\
643+ AZURE_OPENAI_DEPLOYMENT_NAME="your-deployment-name"` } </ pre >
644+ </ div >
645+ </ div >
646+ < div >
647+ < p className = "text-sm text-muted-foreground mb-2" > Update OCR provider (optional - for Mistral):</ p >
648+ < div className = "bg-muted rounded-lg p-4 font-mono text-sm overflow-x-auto" >
649+ < pre className = "whitespace-pre-wrap" > { `az containerapp update \\
650+ --name <your-backend-app-name> \\
651+ --resource-group <your-resource-group> \\
652+ --set-env-vars \\
653+ OCR_PROVIDER="mistral" \\
654+ MISTRAL_ENDPOINT="https://your-endpoint.services.ai.azure.com/..." \\
655+ MISTRAL_API_KEY="your-mistral-key" \\
656+ MISTRAL_DOC_AI_MODEL="mistral-document-ai-2505"` } </ pre >
657+ </ div >
658+ </ div >
659+ </ AccordionContent >
660+ </ AccordionItem >
661+
662+ < AccordionItem value = "azd" >
663+ < AccordionTrigger >
664+ < div className = "flex items-center gap-2" >
665+ < FileCode className = "h-4 w-4" />
666+ Option 3: Update via Infrastructure (azd)
667+ </ div >
668+ </ AccordionTrigger >
669+ < AccordionContent className = "space-y-3 text-sm" >
670+ < p className = "text-muted-foreground" > If you're using Azure Developer CLI (azd):</ p >
671+ < ol className = "list-decimal list-inside space-y-2 text-muted-foreground" >
672+ < li > Update the environment variables in your < code className = "bg-muted px-1 rounded" > infra/main.parameters.json</ code > file</ li >
673+ < li > Available environment variables:
674+ < ul className = "list-disc list-inside ml-4 mt-1" >
675+ < li > < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_ENDPOINT</ code > , < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_API_KEY</ code > , < code className = "bg-muted px-1 rounded" > AZURE_OPENAI_DEPLOYMENT_NAME</ code > </ li >
676+ < li > < code className = "bg-muted px-1 rounded" > OCR_PROVIDER</ code > , < code className = "bg-muted px-1 rounded" > MISTRAL_ENDPOINT</ code > , < code className = "bg-muted px-1 rounded" > MISTRAL_API_KEY</ code > , < code className = "bg-muted px-1 rounded" > MISTRAL_DOC_AI_MODEL</ code > </ li >
677+ </ ul >
678+ </ li >
679+ < li > Run < code className = "bg-muted px-1 rounded" > azd up</ code > to redeploy with new settings</ li >
680+ </ ol >
681+ </ AccordionContent >
682+ </ AccordionItem >
683+ </ Accordion >
684+ </ CardContent >
685+ </ Card >
563686 </ div >
564687 </ PageContainer >
565688 )
0 commit comments