Skip to content

Commit 6d4e9d3

Browse files
Merge remote-tracking branch 'upstream/main'
2 parents 3594ad0 + 3a019d7 commit 6d4e9d3

38 files changed

+404
-288
lines changed

.github/workflows/build-clientadvisor.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Build ClientAdvisor Docker Images
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, dev, demo]
66
paths:
77
- ClientAdvisor/**
88
pull_request:
9-
branches: [main]
9+
branches: [main, dev, demo]
1010
types:
1111
- opened
1212
- ready_for_review
@@ -35,5 +35,5 @@ jobs:
3535
password_secret: ${{ matrix.password_secret }}
3636
app_name: ${{ matrix.app_name }}
3737
dockerfile: ${{ matrix.dockerfile }}
38-
push: true # Adjust this logic as necessary
39-
secrets: inherit
38+
push: ${{ github.event_name == 'push' && github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
39+
secrets: inherit

.github/workflows/build-docker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
context: .
5555
file: ${{ inputs.dockerfile }}
5656
push: ${{ inputs.push }}
57-
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:latest
57+
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
5858
tags: |
59-
${{ inputs.registry }}/${{ inputs.app_name}}:dev
59+
${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
6060
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.date.outputs.date }}_${{ github.run_number }}

.github/workflows/build-researchassistant.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Build ResearchAssistant Docker Images
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, dev, demo]
66
paths:
77
- ResearchAssistant/**
88
pull_request:
9-
branches: [main]
9+
branches: [main, dev, demo]
1010
types:
1111
- opened
1212
- ready_for_review
@@ -32,5 +32,5 @@ jobs:
3232
password_secret: ${{ matrix.password_secret }}
3333
app_name: ${{ matrix.app_name }}
3434
dockerfile: ${{ matrix.dockerfile }}
35-
push: true # Adjust this logic as necessary
36-
secrets: inherit
35+
push: ${{ github.event_name == 'push' && github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
36+
secrets: inherit

.github/workflows/test_client_advisor.yml

+19-18
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Unit Tests - Client Advisor
22

33
on:
44
push:
5-
branches: main
5+
branches: [main, dev]
66
# Trigger on changes in these specific paths
77
paths:
88
- 'ClientAdvisor/**'
99
pull_request:
10-
branches: main
10+
branches: [main, dev]
1111
types:
1212
- opened
1313
- ready_for_review
@@ -29,22 +29,6 @@ jobs:
2929
uses: actions/setup-python@v5
3030
with:
3131
python-version: "3.11"
32-
- name: Install Backend Dependencies
33-
run: |
34-
cd ClientAdvisor/App
35-
python -m pip install -r requirements.txt
36-
python -m pip install coverage pytest-cov
37-
- name: Run Backend Tests with Coverage
38-
run: |
39-
cd ClientAdvisor/App
40-
python -m pytest -vv --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under=80 --junitxml=coverage-junit.xml
41-
- uses: actions/upload-artifact@v4
42-
with:
43-
name: client-advisor-coverage
44-
path: |
45-
ClientAdvisor/App/coverage.xml
46-
ClientAdvisor/App/coverage-junit.xml
47-
ClientAdvisor/App/htmlcov/
4832
- name: Set up Node.js
4933
uses: actions/setup-node@v3
5034
with:
@@ -63,3 +47,20 @@ jobs:
6347
path: |
6448
ClientAdvisor/App/frontend/coverage/
6549
ClientAdvisor/App/frontend/coverage/lcov-report/
50+
ClientAdvisor/App/htmlcov/
51+
- name: Install Backend Dependencies
52+
run: |
53+
cd ClientAdvisor/App
54+
python -m pip install -r requirements.txt
55+
python -m pip install coverage pytest-cov
56+
- name: Run Backend Tests with Coverage
57+
run: |
58+
cd ClientAdvisor/App
59+
python -m pytest -vv --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under=80 --junitxml=coverage-junit.xml
60+
- uses: actions/upload-artifact@v4
61+
with:
62+
name: client-advisor-coverage
63+
path: |
64+
ClientAdvisor/App/coverage.xml
65+
ClientAdvisor/App/coverage-junit.xml
66+
ClientAdvisor/App/htmlcov/

ClientAdvisor/App/.flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
max-line-length = 88
33
extend-ignore = E501, E203
4-
exclude = .venv, frontend,
4+
exclude = .venv, frontend,

ClientAdvisor/App/app.py

-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def create_app():
5555
app.config["TEMPLATES_AUTO_RELOAD"] = True
5656
# app.secret_key = secrets.token_hex(16)
5757
# app.session_interface = SecureCookieSessionInterface()
58-
# print(app.secret_key)
5958
return app
6059

6160

@@ -901,7 +900,6 @@ async def complete_chat_request(request_body, request_headers):
901900
# answer = "Sample response from Azure Function"
902901
# Construct the URL of your Azure Function endpoint
903902
# function_url = STREAMING_AZUREFUNCTION_ENDPOINT
904-
905903
# request_headers = {
906904
# "Content-Type": "application/json",
907905
# # 'Authorization': 'Bearer YOUR_TOKEN_HERE' # if applicable

ClientAdvisor/App/frontend/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ClientAdvisor/App/frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@
7878
"typescript": "^4.9.5",
7979
"vite": "^4.1.5"
8080
}
81-
}
81+
}

ClientAdvisor/App/frontend/src/api/models.ts

+4
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,7 @@ export interface GroupedChatHistory {
147147
}
148148

149149

150+
export interface GroupedChatHistory {
151+
month: string
152+
entries: Conversation[]
153+
}

ClientAdvisor/App/frontend/src/components/Answer/Answer.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,13 @@ export const Answer = ({ answer, onCitationClicked }: Props) => {
7878
} else {
7979
citationFilename = `${citation.filepath} - Part ${part_i}`
8080
}
81-
// } else if (citation.filepath && citation.reindex_id) {
82-
// citationFilename = `${citation.filepath} - Part ${citation.reindex_id}`
8381
} else {
8482
citationFilename = `Citation ${index}`
8583
}
8684
return citationFilename
8785
}
8886

8987
const onLikeResponseClicked = async () => {
90-
// if (answer.message_id == undefined) return
9188
if (answer.message_id) {
9289
let newFeedbackState = feedbackState
9390
// Set or unset the thumbs up state
@@ -108,7 +105,6 @@ export const Answer = ({ answer, onCitationClicked }: Props) => {
108105
}
109106

110107
const onDislikeResponseClicked = async () => {
111-
//if (answer.message_id == undefined) return
112108
if (answer.message_id) {
113109
let newFeedbackState = feedbackState
114110
if (feedbackState === undefined || feedbackState === Feedback.Neutral || feedbackState === Feedback.Positive) {
@@ -129,7 +125,6 @@ export const Answer = ({ answer, onCitationClicked }: Props) => {
129125
}
130126

131127
const updateFeedbackList = (ev?: FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean) => {
132-
//if (answer.message_id == undefined) return
133128
if (answer.message_id){
134129
const selectedFeedback = (ev?.target as HTMLInputElement)?.id as Feedback
135130

@@ -146,7 +141,6 @@ export const Answer = ({ answer, onCitationClicked }: Props) => {
146141
}
147142

148143
const onSubmitNegativeFeedback = async () => {
149-
//if (answer.message_id == undefined) return
150144
if (answer.message_id) {
151145
await historyMessageFeedback(answer.message_id, negativeFeedbackList.join(','))
152146
resetFeedbackDialog()

ClientAdvisor/App/frontend/src/components/QuestionInput/QuestionInput.module.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070
background-color: Window;
7171
color: WindowText;
7272
}
73-
}
73+
}

ClientAdvisor/App/frontend/src/components/common/Button.module.css

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
width: 180px;
2727
border: 1px solid #d1d1d1;
2828
border-radius: 5px;
29+
2930
}
3031

3132
.historyButtonRoot:hover {

ClientAdvisor/App/frontend/src/pages/chat/Chat.module.css

+7
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ a {
378378
}
379379
}
380380

381+
@media screen and (-ms-high-contrast: active), (forced-colors: active) {
382+
.chatContainer, .chatMessageError, .chatMessageUserMessage{
383+
border: 2px solid WindowText;
384+
background-color: Window;
385+
color: WindowText;
386+
}
387+
}
381388

382389
@media screen and (-ms-high-contrast: active), (forced-colors: active) {
383390
.chatContainer, .chatMessageError, .chatMessageUserMessage{

ClientAdvisor/App/frontend/src/pages/layout/Layout.module.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,5 @@
325325
background-color: Window;
326326
color: WindowText;
327327
}
328-
}
328+
}
329+

ClientAdvisor/App/requirements-dev.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ azure-search-documents==11.4.0b6
55
azure-storage-blob==12.17.0
66
python-dotenv==1.0.0
77
azure-cosmos==4.5.0
8-
quart==0.19.4
8+
quart==0.19.9
99
uvicorn==0.24.0
1010
aiohttp==3.9.2
1111
gunicorn==20.1.0
1212
quart-session==3.0.0
1313
pymssql==2.3.0
1414
httpx==0.27.0
15-
pytest-asyncio==0.24.0
16-
pytest-cov==5.0.0
1715
flake8==7.1.1
1816
black==24.8.0
1917
autoflake==2.3.1
20-
isort==5.13.2
18+
isort==5.13.2pytest-asyncio==0.24.0
19+
pytest-cov==5.0.0
20+
isort==5.13.2

ClientAdvisor/App/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ azure-search-documents==11.4.0b6
55
azure-storage-blob==12.17.0
66
python-dotenv==1.0.0
77
azure-cosmos==4.5.0
8-
quart==0.19.4
8+
quart==0.19.9
99
uvicorn==0.24.0
1010
aiohttp==3.9.2
1111
gunicorn==20.1.0
1212
quart-session==3.0.0
1313
pymssql==2.3.0
1414
httpx==0.27.0
15-
pytest-asyncio==0.24.0
16-
pytest-cov==5.0.0
1715
flake8==7.1.1
1816
black==24.8.0
1917
autoflake==2.3.1
2018
isort==5.13.2
19+
pytest-asyncio==0.24.0
20+
pytest-cov==5.0.0

ClientAdvisor/App/tools/data_collection.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
1515

1616

17+
1718
def load_env_into_module(module_name, prefix=""):
1819
load_dotenv()
1920
module = __import__(module_name)

ClientAdvisor/AzureFunction/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ COPY ./ClientAdvisor/AzureFunction/requirements.txt /requirements.txt
1010
RUN pip install -r /requirements.txt
1111

1212
# Copy the application files to the correct directory
13-
COPY ./ClientAdvisor/AzureFunction/ /home/site/wwwroot
13+
COPY ./ClientAdvisor/AzureFunction/ /home/site/wwwroot

ClientAdvisor/Deployment/bicep/deploy_app_service.bicep

+3-1
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,13 @@ param AZURE_COSMOSDB_ENABLE_FEEDBACK string = 'True'
163163
@description('Power BI Embed URL')
164164
param VITE_POWERBI_EMBED_URL string = ''
165165

166+
param Appversion string
167+
166168
// var WebAppImageName = 'DOCKER|byoaiacontainer.azurecr.io/byoaia-app:latest'
167169

168170
// var WebAppImageName = 'DOCKER|ncwaappcontainerreg1.azurecr.io/ncqaappimage:v1.0.0'
169171

170-
var WebAppImageName = 'DOCKER|bycwacontainerreg.azurecr.io/byc-wa-app:dev'
172+
var WebAppImageName = 'DOCKER|bycwacontainerreg.azurecr.io/byc-wa-app:${Appversion}'
171173

172174
resource HostingPlan 'Microsoft.Web/serverfarms@2020-06-01' = {
173175
name: HostingPlanName

ClientAdvisor/Deployment/bicep/main.bicep

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ var resourceGroupName = resourceGroup().name
1717
// var subscriptionId = subscription().subscriptionId
1818

1919
var solutionLocation = resourceGroupLocation
20-
var baseUrl = 'https://raw.githubusercontent.com/Roopan-Microsoft/psl-byo-main/main/ClientAdvisor/'
21-
var functionAppversion = 'dev'
20+
var baseUrl = 'https://raw.githubusercontent.com/microsoft/Build-your-own-copilot-Solution-Accelerator/main/ClientAdvisor/'
21+
var appversion = 'latest'
2222

2323
// ========== Managed Identity ========== //
2424
module managedIdentityModule 'deploy_managed_identity.bicep' = {
@@ -119,7 +119,7 @@ module azureFunctions 'deploy_azure_function_script.bicep' = {
119119
sqlDbPwd:sqlDBModule.outputs.sqlDbOutput.sqlDbPwd
120120
identity:managedIdentityModule.outputs.managedIdentityOutput.id
121121
baseUrl:baseUrl
122-
functionAppVersion: functionAppversion
122+
functionAppVersion: appversion
123123
}
124124
dependsOn:[storageAccountModule]
125125
}
@@ -236,6 +236,7 @@ module appserviceModule 'deploy_app_service.bicep' = {
236236
AZURE_COSMOSDB_DATABASE: cosmosDBModule.outputs.cosmosOutput.cosmosDatabaseName
237237
AZURE_COSMOSDB_ENABLE_FEEDBACK: 'True'
238238
VITE_POWERBI_EMBED_URL: 'TBD'
239+
Appversion: appversion
239240
}
240241
scope: resourceGroup(resourceGroup().name)
241242
dependsOn:[azOpenAI,azAIMultiServiceAccount,azSearchService,sqlDBModule,azureFunctionURL,cosmosDBModule]

0 commit comments

Comments
 (0)