diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 48504204..9adff38c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -130,6 +130,7 @@ jobs: run: | cd Deployment $input = @" + ${{ secrets.AZURE_TENANT_ID }} ${{ secrets.AZURE_SUBSCRIPTION_ID }} ${{ env.ENVIRONMENT_NAME }} @@ -146,6 +147,7 @@ jobs: AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} + - name: Cleanup Resource Group if: always() # Ensures this step runs even if the deployment fails shell: pwsh diff --git a/App/frontend-app/src/components/chat/chatRoom.tsx b/App/frontend-app/src/components/chat/chatRoom.tsx index cbc04b8c..e726c601 100644 --- a/App/frontend-app/src/components/chat/chatRoom.tsx +++ b/App/frontend-app/src/components/chat/chatRoom.tsx @@ -124,6 +124,8 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc const makeApiRequest = async (question: string) => { setTextAreaValue(""); + //Force Textarea re-render to reset internal showCount + setTextareaKey(prev => prev + 1); setDisableSources(true); setIsLoading(true); @@ -249,6 +251,7 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc console.error("Error parsing response body:", error); } } catch (error) { + console.error("Error in makeApiRequest:", error); } finally { setIsLoading(false); setTimeout(() => { diff --git a/Deployment/resourcedeployment.ps1 b/Deployment/resourcedeployment.ps1 index 577e09ae..d6821771 100644 --- a/Deployment/resourcedeployment.ps1 +++ b/Deployment/resourcedeployment.ps1 @@ -73,6 +73,7 @@ function ValidateVariableIsNullOrEmpty { # Function to prompt for parameters with kind messages function PromptForParameters { param( + [string]$tenantId, [string]$subscriptionID, [string]$environmentName, [string]$resourceGroupName, @@ -102,6 +103,10 @@ function PromptForParameters { 'EastUS', 'EastUS2', 'SwedenCentral', 'WestUS3' ) + if (-not $tenantId) { + Write-Host "Please enter your Azure tenant ID" -ForegroundColor Cyan + $tenantId = Read-Host -Prompt '> ' + } if (-not $subscriptionID) { Write-Host "Please enter your Azure subscription ID to deploy your resources" -ForegroundColor Cyan $subscriptionID = Read-Host -Prompt '> ' @@ -137,6 +142,7 @@ function PromptForParameters { } return @{ + tenantId = $tenantId subscriptionID = $subscriptionID environmentName = $environmentName resourceGroupName = $resourceGroupName @@ -147,8 +153,9 @@ function PromptForParameters { } # Prompt for parameters with kind messages -$params = PromptForParameters -subscriptionID $subscriptionID -environmentName $environmentName -resourceGroupName $resourceGroupName -location $location -modelLocation $modelLocation -email $email +$params = PromptForParameters -tenantId $tenantId -subscriptionID $subscriptionID -environmentName $environmentName -resourceGroupName $resourceGroupName -location $location -modelLocation $modelLocation -email $email # Assign the parameters to variables +$tenantId = $params.tenantId $subscriptionID = $params.subscriptionID $environmentName = $params.environmentName $resourceGroupName = $params.resourceGroupName @@ -158,17 +165,24 @@ $email = $params.email function LoginAzure([string]$subscriptionID) { Write-Host "Log in to Azure.....`r`n" -ForegroundColor Yellow - if ($env:CI -eq "true"){ - + if ($env:CI -eq "true"){ az login --service-principal ` --username $env:AZURE_CLIENT_ID ` --password $env:AZURE_CLIENT_SECRET ` --tenant $env:AZURE_TENANT_ID - write-host "CI deployment mode" + Write-Host "CI deployment mode" } + else{ + az login --tenant $tenantId + if ($LASTEXITCODE -ne 0) { + Write-Host "Failed to log in to Azure with tenant ID '$tenantId'. Please check your credentials." -ForegroundColor Red + failureBanner + exit 1 + } else{ - az login - write-host "manual deployment mode" + Write-Host "Logged in to Azure with tenant ID '$tenantId' successfully." -ForegroundColor Green + } + Write-Host "manual deployment mode" } az account set --subscription $subscriptionID Write-Host "Switched subscription to '$subscriptionID' `r`n" -ForegroundColor Yellow @@ -284,6 +298,7 @@ function DisplayResult([pscustomobject]$jsonString) { Write-Host "********************************************************************************" -ForegroundColor Blue Write-Host "* Deployed Azure Resources Information *" -ForegroundColor Blue Write-Host "********************************************************************************" -ForegroundColor Blue + Write-Host "* Tenant Id: " -ForegroundColor Yellow -NoNewline; Write-Host "$tenantId" -ForegroundColor Green Write-Host "* Subscription Id: " -ForegroundColor Yellow -NoNewline; Write-Host "$subscriptionID" -ForegroundColor Green Write-Host "* Knowledge Mining Digital Asset resource group: " -ForegroundColor Yellow -NoNewline; Write-Host "$resourcegroupName" -ForegroundColor Green Write-Host "* Azure Kubernetes Account " -ForegroundColor Yellow -NoNewline; Write-Host "$aksName" -ForegroundColor Green