Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
66d6c80
refactor CI workflow to use Ubuntu runner and update installation met…
Harsh-Microsoft Jul 2, 2025
3f859a6
refactor Deployment Pipeline and integrate with Test Automation Pipeline
Harsh-Microsoft Jul 2, 2025
c53a2be
update uploadfiles script endpoint handling and failure notification …
Harsh-Microsoft Jul 2, 2025
572588d
add step to open Web App URL in the browser after deployment
Harsh-Microsoft Jul 3, 2025
9919452
update Web App URL opening step to use Google Chrome and simplify res…
Harsh-Microsoft Jul 3, 2025
68600d3
enhance Azure Web App validation with retry logic
Harsh-Microsoft Jul 3, 2025
915a7e7
refactor deployment validation and post-deployment script error handling
Harsh-Microsoft Jul 3, 2025
c753399
increase GPT capacity and enhance quota check logic in deployment scr…
Harsh-Microsoft Jul 3, 2025
e620cef
update GPT capacity in CI workflow and extend sleep duration in test …
Harsh-Microsoft Jul 3, 2025
15ea9f0
ci: fix deployment pipeline, integrate deployment pipeline with test …
Avijit-Microsoft Jul 3, 2025
4155664
but fix #20379
Bangarraju-Microsoft Jul 9, 2025
f91a138
style moved to global scss file
Bangarraju-Microsoft Jul 9, 2025
aaaafad
Merge pull request #412 from microsoft/PSL-Bug-20379
Roopan-Microsoft Jul 9, 2025
219d044
added logic on upload file dialogue close list of file should not vis…
Rohini-Microsoft Jul 9, 2025
6c08ca9
Merge pull request #414 from microsoft/psl-bug-20381-n
Roopan-Microsoft Jul 10, 2025
7243dc2
test: DKM-Fixed issues and updated script for validating response status
Ritesh-Microsoft Jul 10, 2025
9024f3f
Merge branch 'dev' of https://github.com/Ritesh-Microsoft/Document-Kn…
Ritesh-Microsoft Jul 10, 2025
0dd9491
test: DKM-Fixed issues and updated script for validating response status
Avijit-Microsoft Jul 10, 2025
95f9c09
Added isLoading checks to the follow-up suggestions to prevent multip…
Prasanjeet-Microsoft Jul 11, 2025
0273b06
Merge pull request #418 from microsoft/PSL-BUG-20378
Prajwal-Microsoft Jul 14, 2025
d7a312c
Merge branch 'main' into dev
Roopan-Microsoft Jul 14, 2025
cacba71
removed settimeout function
Rohini-Microsoft Jul 14, 2025
20e76f6
added comment
Rohini-Microsoft Jul 14, 2025
bf8ff0f
Merge pull request #421 from microsoft/checkfileupload
Prajwal-Microsoft Jul 15, 2025
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
351 changes: 249 additions & 102 deletions .github/workflows/CI.yml

Large diffs are not rendered by default.

56 changes: 21 additions & 35 deletions .github/workflows/test-automation.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: Test Automation DKM

on:
push:
branches:
- main
- dev
paths:
- 'tests/e2e-test/**'
schedule:
- cron: '0 13 * * *' # Runs at 1 PM UTC
workflow_dispatch:
workflow_call:
inputs:
DKM_URL:
required: true
type: string
description: "Web URL for DKM"
secrets:
EMAILNOTIFICATION_LOGICAPP_URL_TA:
required: false
description: "Logic App URL for email notifications"

env:
url: ${{ vars.DKM_URL }}
url: ${{ inputs.DKM_URL }}
accelerator_name: "DKM"

jobs:
Expand All @@ -27,20 +28,6 @@ jobs:
with:
python-version: '3.13'

- name: Azure CLI Login
uses: azure/login@v2
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Start AKS
id: start-aks
uses: azure/cli@v2
with:
azcliversion: 'latest'
inlineScript: |
az aks install-cli
if [ "$(az aks show --resource-group ${{ vars.DKM_RG }} --name ${{ vars.DKM_AKS_NAME }} --query "powerState.code" -o tsv)" = "Running" ]; then echo "AKS is running"; else az aks start --resource-group ${{ vars.DKM_RG }} --name ${{ vars.DKM_AKS_NAME }}; fi

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -49,6 +36,15 @@ jobs:
- name: Ensure browsers are installed
run: python -m playwright install --with-deps chromium

- name: Open URL
run: |
echo "Opening URL: ${{ env.url }}"
python -m webbrowser "${{ env.url }}"

- name: Sleep for 30 seconds
run: sleep 30s
shell: bash

- name: Run tests(1)
id: test1
run: |
Expand Down Expand Up @@ -117,14 +113,4 @@ jobs:
# Send the notification
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
-H "Content-Type: application/json" \
-d "$EMAIL_BODY" || echo "Failed to send notification"

- name: Stop AKS
if: always()
uses: azure/cli@v2
with:
azcliversion: 'latest'
inlineScript: |
az aks install-cli
if [ "$(az aks show --resource-group ${{ vars.DKM_RG }} --name ${{ vars.DKM_AKS_NAME }} --query "powerState.code" -o tsv)" = "Running" ]; then az aks stop --resource-group ${{ vars.DKM_RG }} --name ${{ vars.DKM_AKS_NAME }}; else echo "AKS is already stopped"; fi
az logout
-d "$EMAIL_BODY" || echo "Failed to send notification"
4 changes: 4 additions & 0 deletions App/frontend-app/src/assets/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ $max-content-width: 1600px;
._max-content-width {
max-width: $max-content-width;
}
}

.autoHeight {
height :auto !important;
}
80 changes: 42 additions & 38 deletions App/frontend-app/src/components/chat/chatRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface ChatRoomProps {
export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDocument, disableOptionsPanel, clearChatFlag }: ChatRoomProps) {
const customStyles = useStyles();
const { t } = useTranslation();
const [chatSessionId, setChatSessionId] = useState<string | null>(null);
const [chatSessionId, setChatSessionId] = useState<string | null>(null);
const [isLoading, setIsLoading] = useState<boolean>(false);
const [disableSources, setDisableSources] = useState<boolean>(false);
const [error, setError] = useState<unknown>();
Expand Down Expand Up @@ -99,16 +99,16 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
useEffect(() => {
handleModelChange(DefaultChatModel)
}, []);
// Effect to clear chat when clearChat prop changes

// Effect to clear chat when clearChat prop changes
useEffect(() => {
if (clearChatFlag) {
clearChat();
}
}, [clearChatFlag]); // Runs whenever clearChat changes



const chatContainerRef = useRef<HTMLDivElement>(null);
function scrollToBottom() {
if (chatContainerRef.current) {
Expand All @@ -128,23 +128,23 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
setTextareaKey(prev => prev + 1);
setDisableSources(true);
setIsLoading(true);

// A simple function to check if the text contains Markdown
const isMarkdown = (text: string) => {
const markdownPattern = /(^|\s)(#{1,6}|\*\*|__|[-*]|\d+\.\s|\[.*\]\(.*\)|```|`[^`]*`)/;
return markdownPattern.test(text);
};
};

const userTimestamp = new Date();
// Ensure we have a chatSessionId or create one if null/undefined


let currentSessionId = chatSessionId; // Get the current value of chatSessionId
if (!currentSessionId) {
const newSessionId = uuidv4(); // Generate a new UUID if no session exists
setChatSessionId(newSessionId); // Save it for future renders
currentSessionId = newSessionId; // Immediately use the new session ID in this function

}
const markdownToHtmlString = (markdown: string) => {
return renderToStaticMarkup(<ReactMarkdown>{markdown}</ReactMarkdown>);
Expand All @@ -170,7 +170,7 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
| Total NPLs sold by Enterprises through December 2023 | 168,364 | FHFA Non-Performing Loan Sales Report | Page 2 |
| Average delinquency of NPLs sold | 2.8 years | FHFA Non-Performing Loan Sales Report | Page 2 |
| Average current mark-to-market LTV ratio of NPLs | 83% | FHFA Non-Performing Loan Sales Report | Page 2 |`;

const htmlString = await marked.parse(markdown);
const htmlString2 = markdownToHtmlString(markdown);

Expand All @@ -183,18 +183,18 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
}],
]);





let filterByDocumentIds: string[] = [];


const transformDocuments = (documents: any[]) => {
return documents.map(doc => doc.documentId); // Extracting documentId from each document
};
const formattedDocuments = transformDocuments(selectedDocuments);


if (button === "Selected Document" && selectedDocument) {
filterByDocumentIds = [selectedDocument[0].documentId];
Expand All @@ -205,13 +205,13 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
}

try {



const request: ChatRequest = {
Question: question,
chatSessionId: currentSessionId,
DocumentIds: button === "All Documents" ? [] : formattedDocuments
DocumentIds: button === "All Documents" ? [] : formattedDocuments
// cha: history,
// options: {
// model: model,
Expand All @@ -221,25 +221,25 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
// },
// filterByDocumentIds: filterByDocumentIds,
};


const response: ChatApiResponse = await Completion(request);



setIsLoading(false);

const answerTimestamp = new Date();

try {
if (response && response.answer) {

const formattedAnswer = removeNewlines(response.answer)
const chatResp = await marked.parse(formattedAnswer) // Convert to HTML if Markdown detected




// Update the conversation with the formatted answer
setConversationAnswers((prevAnswers) => {
const newAnswers = [...prevAnswers];
Expand Down Expand Up @@ -279,7 +279,7 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
setChatSessionId(null);
};

const handleModelChange = (model: string) => {
const handleModelChange = (model: string) => {
setModel(model);
};

Expand All @@ -293,7 +293,7 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
};

function handleSend(ev: TextareaSubmitEvents, data: TextareaValueData) {
if (data.value.trim() !='') {
if (data.value.trim() != '') {
makeApiRequest(data.value);
}
}
Expand Down Expand Up @@ -340,10 +340,10 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
button === "Selected Documents"
? selectedDocuments.map((document) => document.documentId)
: button === "Search Results"
? searchResultDocuments.map((document) => document.documentId)
: button === "Selected Document"
? [selectedDocument[0]?.documentId || ""]
: [],
? searchResultDocuments.map((document) => document.documentId)
: button === "Selected Document"
? [selectedDocument[0]?.documentId || ""]
: [],
groundTruthAnswer: "",
documentURLs: [],
chunkTexts: [],
Expand Down Expand Up @@ -482,8 +482,12 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
{response.suggestingQuestions.map((followUp, index) => (
<Suggestion
key={index}
className="!mr-2 !mt-2 !text-base"
onClick={() => handleFollowUpQuestion(followUp)}
className={`!mr-2 !mt-2 !text-base ${isLoading ? "pointer-events-none text-gray-400" : ""}`}
onClick={() => {
if (!isLoading) {
handleFollowUpQuestion(followUp);
}
}}
>
{followUp}
</Suggestion>
Expand Down Expand Up @@ -594,11 +598,11 @@ export function ChatRoom({ searchResultDocuments, selectedDocuments, chatWithDoc
contentAfter={undefined}
/>
</div>
</div>
</div >
);
}
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function DialogContentComponent({
</div>
)}

<div className="mb-4 h-96 overflow-y-auto">
<div className="mb-4 h-96 overflow-y-auto autoHeight">
{allChunkTexts.map(
(item, index) =>
item && (
Expand Down
20 changes: 17 additions & 3 deletions App/frontend-app/src/components/uploadButton/uploadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const UploadDocumentsDialog = () => {

try {
// Simulate upload delay
await new Promise((resolve) => setTimeout(resolve, 2000));
//File upload is significantly slower than expected, so commented out the line below.
// await new Promise((resolve) => setTimeout(resolve, 2000));
await importDocuments(formData); // Replace with actual upload API

// Update file status to success
Expand Down Expand Up @@ -93,9 +94,22 @@ const UploadDocumentsDialog = () => {
noKeyboard: true,
});

// Add this function to handle dialog close
const handleDialogClose = () => {
setIsOpen(false);
setUploadingFiles([]); // Clear the uploaded files
setIsUploading(false); // Reset uploading state
};

return (<>
{isUploadBtnVisible == true ?
<Dialog open={isOpen} onOpenChange={(event, data) => setIsOpen(data.open)}>
<Dialog open={isOpen} onOpenChange={(event, data) => {
if (!data.open) {
handleDialogClose();
} else {
setIsOpen(data.open);
}
}}>
<DialogTrigger>
<Button icon={<ArrowUpload24Regular />} onClick={() => setIsOpen(true)}>
Upload documents
Expand All @@ -108,7 +122,7 @@ const UploadDocumentsDialog = () => {
<Button
icon={<DismissRegular />}
appearance="subtle"
onClick={() => setIsOpen(false)}
onClick={handleDialogClose}
style={{ position: "absolute", right: 20, top: 20 }}
/>
</DialogTitle>
Expand Down
5 changes: 3 additions & 2 deletions Deployment/checkquota.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ foreach ($REGION in $REGIONS) {

foreach ($MODEL in $MIN_CAPACITY.Keys) {

$MODEL_INFO = $QUOTA_INFO | Where-Object { $_.Name -eq $MODEL }
$MODEL_INFO = $QUOTA_INFO | Where-Object { $_.Name.Value -eq $MODEL }

if (-not $MODEL_INFO) {
Write-Host "⚠️ WARNING: No quota information found for model: $MODEL in $REGION. Skipping."
continue
$INSUFFICIENT_QUOTA = $true
break
}

$CURRENT_VALUE = [int]$MODEL_INFO.CurrentValue
Expand Down
1 change: 1 addition & 0 deletions tests/e2e-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This will create a virtual environment directory named microsoft inside your cur
Installing Playwright Pytest from Virtual Environment

- To install libraries run "pip install -r requirements.txt"
- To install Playwright run "playwright install"

Run test cases

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e-test/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import base
"""Initiate base package"""
Loading