Skip to content

Dev #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed

Dev #475

Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d5776d2
Downgrade msal[broker] to 1.24.0b1 and azure-mgmt-resource to 23.1.0b2
Prasanjeet-Microsoft Jan 10, 2025
56f4f45
Merge pull request #282 from microsoft/downgrade-msal-azure-mgmt-reso…
Prajwal-Microsoft Jan 10, 2025
02f68ca
Downgrade azure-ai-ml package to version 1.17.1 to resolve package ve…
Prasanjeet-Microsoft Jan 13, 2025
c39f609
Upgrade azure-ai-ml package to compatible version
Prasanjeet-Microsoft Jan 13, 2025
99b5270
Merge pull request #284 from microsoft/upgrade-azure-ai-ml-package
Prajwal-Microsoft Jan 13, 2025
94b4f4c
test: Research assistant backend unit test (#286)
Pradheep-Microsoft Jan 13, 2025
b785eb6
fix: Research Assistant Deployment Issue - Prompt Flow version update…
Pradheep-Microsoft Jan 20, 2025
07bac06
Implement Consistent Versioning and Tagging for Accelerator Images (#…
Pavan-Microsoft Jan 22, 2025
0d82faa
Dev image version check
Pavan-Microsoft Jan 27, 2025
ae75bd3
Merge pull request #291 from microsoft/PSL-PK-ImageVersion
Pavan-Microsoft Jan 27, 2025
fb30c09
Revert "feat: Dev Image Version Check Test"
Pavan-Microsoft Jan 27, 2025
a582ee1
Merge pull request #292 from microsoft/revert-291-PSL-PK-ImageVersion
Pavan-Microsoft Jan 27, 2025
2adf389
update history method changes (#295)
pradeepjha-microsoft Jan 30, 2025
951fa25
fix: Fixed Asset and retirement update query (#332)
AjitPadhi-Microsoft Feb 6, 2025
6b85ef2
fixed the UI issue in Chat history list section (#335)
Mohan-Microsoft Feb 14, 2025
c412c08
Merge branch 'main' into dev
Roopan-Microsoft Feb 26, 2025
24752c7
Added code changes to handle null object error in history generate me…
Abdul-Microsoft Feb 26, 2025
ba9eb2a
build: validated and updated dependency for BYOC-ResearchAssistant Ac…
VishalS-Microsoft Feb 28, 2025
b81be42
Upgraded Package For AI_Hub Script (#419)
UtkarshMishra-Microsoft Mar 26, 2025
0d1f835
Merge branch 'main' into dev
Roopan-Microsoft Apr 1, 2025
03d13f1
package and ai-script (#426)
UtkarshMishra-Microsoft Apr 1, 2025
5c27106
resolved bug:16535 (#468)
VishalS-Microsoft Apr 4, 2025
14c770f
feat: SFI SQL Policy Changes (#469)
Abdul-Microsoft Apr 9, 2025
9cbfca2
perf: Semantic Kernel and Prompt improvement (#415)
UtkarshMishra-Microsoft Apr 9, 2025
23cbe2c
Merge branch 'main' into dev
Roopan-Microsoft Apr 10, 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
4 changes: 2 additions & 2 deletions .github/workflows/build-clientadvisor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
password_secret: ${{ matrix.password_secret }}
app_name: ${{ matrix.app_name }}
dockerfile: ${{ matrix.dockerfile }}
push: ${{ github.event_name == 'push' && github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
secrets: inherit
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }}
secrets: inherit
4 changes: 3 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
echo "tagname=dev" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "demo" ]]; then
echo "tagname=demo" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "dependabotchanges" ]]; then
echo "tagname=dependabotchanges" >> $GITHUB_OUTPUT
else
echo "tagname=default" >> $GITHUB_OUTPUT

Expand All @@ -72,4 +74,4 @@ jobs:
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}
tags: |
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
4 changes: 2 additions & 2 deletions .github/workflows/build-researchassistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ jobs:
password_secret: ${{ matrix.password_secret }}
app_name: ${{ matrix.app_name }}
dockerfile: ${{ matrix.dockerfile }}
push: ${{ github.event_name == 'push' && github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
secrets: inherit
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }}
secrets: inherit
10 changes: 8 additions & 2 deletions ClientAdvisor/App/WebApp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ RUN apk add --no-cache --virtual .build-deps \
libffi-dev \
openssl-dev \
curl \
unixodbc-dev \
&& apk add --no-cache \
libpq
libpq \
&& curl -O https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_18.4.1.1-1_amd64.apk \
&& apk add --allow-untrusted msodbcsql18_18.4.1.1-1_amd64.apk \
&& rm msodbcsql18_18.4.1.1-1_amd64.apk

COPY ./ClientAdvisor/App/requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \

RUN pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir -r /usr/src/app/requirements.txt \
&& rm -rf /root/.cache

COPY ./ClientAdvisor/App/ /usr/src/app/
Expand Down
7 changes: 5 additions & 2 deletions ClientAdvisor/App/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
format_stream_response, generateFilterString,
parse_multi_columns)
from db import get_connection
from db import dict_cursor

bp = Blueprint("routes", __name__, static_folder="static", template_folder="static")

Expand Down Expand Up @@ -1583,7 +1584,8 @@ def get_users():
ORDER BY NextMeeting ASC;
"""
cursor.execute(sql_stmt)
rows = cursor.fetchall()
# Since pyodbc returns query results as a list of tuples, using `dict_cursor` function to convert these tuples into a list of dictionaries
rows = dict_cursor(cursor)

if len(rows) <= 6:
# update ClientMeetings,Assets,Retirement tables sample data to current date
Expand Down Expand Up @@ -1618,7 +1620,8 @@ def get_users():
FROM DaysDifference
"""
cursor.execute(combined_stmt)
date_diff_rows = cursor.fetchall()
# Since pyodbc returns query results as a list of tuples, using `dict_cursor` function to convert these tuples into a list of dictionaries
date_diff_rows = dict_cursor(cursor)

client_days = (
date_diff_rows[0]["ClientMeetingDaysDifference"]
Expand Down
50 changes: 45 additions & 5 deletions ClientAdvisor/App/db.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,60 @@
# db.py
import os

import pymssql
from dotenv import load_dotenv
from azure.identity import DefaultAzureCredential
import pyodbc
import struct
import logging


load_dotenv()

driver = "{ODBC Driver 18 for SQL Server}"
server = os.environ.get("SQLDB_SERVER")
database = os.environ.get("SQLDB_DATABASE")
username = os.environ.get("SQLDB_USERNAME")
password = os.environ.get("SQLDB_PASSWORD")
mid_id = os.environ.get("SQLDB_USER_MID")


def dict_cursor(cursor):
"""
Converts rows fetched by the cursor into a list of dictionaries.

Args:
cursor: A database cursor object.

Returns:
A list of dictionaries representing rows.
"""
columns = [column[0] for column in cursor.description]
return [dict(zip(columns, row)) for row in cursor.fetchall()]


def get_connection():
try:
credential = DefaultAzureCredential(managed_identity_client_id=mid_id)

token_bytes = credential.get_token(
"https://database.windows.net/.default"
).token.encode("utf-16-LE")
token_struct = struct.pack(f"<I{len(token_bytes)}s", len(token_bytes), token_bytes)
SQL_COPT_SS_ACCESS_TOKEN = (
1256 # This connection option is defined by Microsoft in msodbcsql.h
)

conn = pymssql.connect(
server=server, user=username, password=password, database=database, as_dict=True
)
return conn
# Set up the connection
connection_string = f"DRIVER={driver};SERVER={server};DATABASE={database};"
conn = pyodbc.connect(
connection_string, attrs_before={SQL_COPT_SS_ACCESS_TOKEN: token_struct}
)
return conn
except pyodbc.Error as e:
logging.error(f"Failed with Default Credential: {str(e)}")
conn = pyodbc.connect(
f"DRIVER={driver};SERVER={server};DATABASE={database};UID={username};PWD={password}",
timeout=5
)
logging.info("Connected using Username & Password")
return conn
Loading
Loading