diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 06b5411b9..609632959 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,7 +12,7 @@ ARG USER_GID=$USER_UID # Set up non-root user COPY ./scripts/non-root-user.sh /tmp/ -RUN bash /tmp/non-root-user.sh "${USERNAME}" "${USER_UID}" "${USER_GID}" +RUN bash "/tmp/non-root-user.sh" "${USERNAME}" "${USER_UID}" "${USER_GID}" # Set env for tracking that we're running in a devcontainer ENV DEVCONTAINER=true diff --git a/.devcontainer/scripts/non-root-user.sh b/.devcontainer/scripts/non-root-user.sh index a4ad14172..2290f1f29 100755 --- a/.devcontainer/scripts/non-root-user.sh +++ b/.devcontainer/scripts/non-root-user.sh @@ -13,7 +13,6 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi - # If in automatic mode, determine if a user already exists, if not use vscode if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then USERNAME="" @@ -39,11 +38,11 @@ fi # Create or update a non-root user to match UID/GID. if id -u ${USERNAME} > /dev/null 2>&1; then # User exists, update if needed - if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -G $USERNAME)" ]; then + if [ "${USER_GID}" != "automatic" ] && [ "${USER_GID}" != "999" ] && [ "$USER_GID" != "$(id -G $USERNAME)" ]; then groupmod --gid $USER_GID $USERNAME usermod --gid $USER_GID $USERNAME fi - if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then + if [ "${USER_UID}" != "automatic" ] && [ "${USER_GID}" != "999" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then usermod --uid $USER_UID $USERNAME fi else diff --git a/app/backend/app.py b/app/backend/app.py index e94538a2f..374ad53ef 100644 --- a/app/backend/app.py +++ b/app/backend/app.py @@ -192,3 +192,10 @@ def get_all_upload_status(): logging.exception("Exception in /getalluploadstatus") return jsonify({"error": str(e)}), 500 return jsonify(results) + + +# Return AZURE_OPENAI_CHATGPT_DEPLOYMENT +@app.route("/getInfoData") +def get_info_data(): + response = jsonify({"AZURE_OPENAI_CHATGPT_DEPLOYMENT": f"{AZURE_OPENAI_CHATGPT_DEPLOYMENT}"}) + return response \ No newline at end of file diff --git a/app/frontend/src/api/api.ts b/app/frontend/src/api/api.ts index e21857f8e..a0dd12b81 100644 --- a/app/frontend/src/api/api.ts +++ b/app/frontend/src/api/api.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { AskRequest, AskResponse, ChatRequest, BlobClientUrlResponse, AllFilesUploadStatus, GetUploadStatusRequest } from "./models"; +import { AskRequest, AskResponse, ChatRequest, BlobClientUrlResponse, AllFilesUploadStatus, GetUploadStatusRequest, GetInfoResponse } from "./models"; export async function askApi(options: AskRequest): Promise { const response = await fetch("/ask", { @@ -110,4 +110,20 @@ export async function getAllUploadStatus(options: GetUploadStatusRequest): Promi } const results: AllFilesUploadStatus = {statuses: parsedResponse}; return results; +} + +export async function getInfoData(): Promise { + const response = await fetch("/getInfoData", { + method: "GET", + headers: { + "Content-Type": "application/json" + } + }); + const parsedResponse: GetInfoResponse = await response.json(); + if (response.status > 299 || !response.ok) { + console.log(response); + throw Error(parsedResponse.error || "Unknown error"); + } + console.log(parsedResponse); + return parsedResponse; } \ No newline at end of file diff --git a/app/frontend/src/api/models.ts b/app/frontend/src/api/models.ts index 6c65fd997..638d7b94f 100644 --- a/app/frontend/src/api/models.ts +++ b/app/frontend/src/api/models.ts @@ -76,6 +76,7 @@ export type GetUploadStatusRequest = { state: FileState } + // These keys need to match case with the defined Enum in the // shared code (functions/shared_code/status_log.py) export const enum FileState { @@ -86,3 +87,9 @@ export const enum FileState { Complete = "COMPLETE", Error = "ERROR" } + + +export type GetInfoResponse = { + AZURE_OPENAI_CHATGPT_DEPLOYMENT: string; + error?: string; +}; diff --git a/app/frontend/src/components/InfoButton/InfoButton.module.css b/app/frontend/src/components/InfoButton/InfoButton.module.css new file mode 100644 index 000000000..ed608cd05 --- /dev/null +++ b/app/frontend/src/components/InfoButton/InfoButton.module.css @@ -0,0 +1,9 @@ +/* Copyright (c) Microsoft Corporation. + Licensed under the MIT license. */ + +.container { + display: flex; + align-items: center; + gap: 6px; + cursor: pointer; +} diff --git a/app/frontend/src/components/InfoButton/InfoButton.tsx b/app/frontend/src/components/InfoButton/InfoButton.tsx new file mode 100644 index 000000000..1550b5d6e --- /dev/null +++ b/app/frontend/src/components/InfoButton/InfoButton.tsx @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Text } from "@fluentui/react"; +import { Info24Regular } from "@fluentui/react-icons"; +import styles from "./InfoButton.module.css"; + +interface Props { + className?: string; + onClick: () => void; +} + +export const InfoButton = ({ className, onClick }: Props) => { + return ( +
+ + {"Info"} +
+ ); +}; diff --git a/app/frontend/src/components/InfoButton/index.tsx b/app/frontend/src/components/InfoButton/index.tsx new file mode 100644 index 000000000..b29c8ff9a --- /dev/null +++ b/app/frontend/src/components/InfoButton/index.tsx @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export * from "./InfoButton"; diff --git a/app/frontend/src/components/QuestionInput/QuestionInput.tsx b/app/frontend/src/components/QuestionInput/QuestionInput.tsx index 3a050c675..70d4ae9f9 100644 --- a/app/frontend/src/components/QuestionInput/QuestionInput.tsx +++ b/app/frontend/src/components/QuestionInput/QuestionInput.tsx @@ -15,6 +15,7 @@ interface Props { placeholder?: string; clearOnSend?: boolean; onAdjustClick?: () => void; + onInfoClick?: () => void; showClearChat?: boolean; onClearClick?: () => void; } diff --git a/app/frontend/src/pages/chat/Chat.tsx b/app/frontend/src/pages/chat/Chat.tsx index 73c645b56..2b966687f 100644 --- a/app/frontend/src/pages/chat/Chat.tsx +++ b/app/frontend/src/pages/chat/Chat.tsx @@ -16,12 +16,15 @@ import { ExampleList } from "../../components/Example"; import { UserChatMessage } from "../../components/UserChatMessage"; import { AnalysisPanel, AnalysisPanelTabs } from "../../components/AnalysisPanel"; import { SettingsButton } from "../../components/SettingsButton"; +import { InfoButton } from "../../components/InfoButton"; import { ClearChatButton } from "../../components/ClearChatButton"; import { ResponseLengthButtonGroup } from "../../components/ResponseLengthButtonGroup"; import { ResponseTempButtonGroup } from "../../components/ResponseTempButtonGroup"; +import { InfoContent } from "./InfoContent"; const Chat = () => { const [isConfigPanelOpen, setIsConfigPanelOpen] = useState(false); + const [isInfoPanelOpen, setIsInfoPanelOpen] = useState(false); const [promptTemplate, setPromptTemplate] = useState(""); const [retrieveCount, setRetrieveCount] = useState(5); const [useSemanticRanker, setUseSemanticRanker] = useState(true); @@ -226,6 +229,7 @@ const Chat = () => {
setIsConfigPanelOpen(!isConfigPanelOpen)} /> + setIsInfoPanelOpen(!isInfoPanelOpen)} />
@@ -268,7 +272,7 @@ const Chat = () => { onSupportingContentClicked={() => onToggleTab(AnalysisPanelTabs.SupportingContentTab, index)} onFollowupQuestionClicked={q => makeApiRequest(q)} showFollowupQuestions={useSuggestFollowupQuestions && answers.length - 1 === index} - onAdjustClick={() => setIsConfigPanelOpen(!isConfigPanelOpen)} + onAdjustClick={() => setIsInfoPanelOpen(!isInfoPanelOpen)} />
@@ -300,6 +304,7 @@ const Chat = () => { disabled={isLoading} onSend={question => makeApiRequest(question)} onAdjustClick={() => setIsConfigPanelOpen(!isConfigPanelOpen)} + onInfoClick={() => setIsInfoPanelOpen(!isInfoPanelOpen)} showClearChat={true} onClearClick={clearChat} /> @@ -347,6 +352,19 @@ const Chat = () => { + + setIsInfoPanelOpen(false)} + closeButtonAriaLabel="Close" + onRenderFooterContent={() => setIsInfoPanelOpen(false)}>Close} + isFooterAtBottom={true} > +
+ +
+
); diff --git a/app/frontend/src/pages/chat/InfoContent.tsx b/app/frontend/src/pages/chat/InfoContent.tsx new file mode 100644 index 000000000..18931989b --- /dev/null +++ b/app/frontend/src/pages/chat/InfoContent.tsx @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import React, { useEffect, useState } from "react"; +import { Text } from "@fluentui/react"; +import { getInfoData, GetInfoResponse } from "../../api"; + +interface Props { + className?: string; +} + +export const InfoContent = ({ className }: Props) => { + const [infoData, setInfoData] = useState(null); + + async function fetchInfoData() { + console.log("InfoContent 1"); + try { + const fetchedInfoData = await getInfoData(); + setInfoData(fetchedInfoData); + } catch (error) { + // Handle the error here + console.log(error); + } + } + + useEffect(() => { + fetchInfoData(); + }, []); + + return ( +
+ Azure OpenAI model used: {infoData?.AZURE_OPENAI_CHATGPT_DEPLOYMENT} +
+ ); +}; \ No newline at end of file diff --git a/infra/core/host/appservice.bicep b/infra/core/host/appservice.bicep index b84c414d1..d6efb3482 100644 --- a/infra/core/host/appservice.bicep +++ b/infra/core/host/appservice.bicep @@ -138,7 +138,7 @@ resource diagnosticLogs 'Microsoft.Insights/diagnosticSettings@2021-05-01-previe category: 'AppServiceAppLogs' enabled: true retentionPolicy: { - days: 30 + days: 0 enabled: true } } @@ -146,7 +146,7 @@ resource diagnosticLogs 'Microsoft.Insights/diagnosticSettings@2021-05-01-previe category: 'AppServicePlatformLogs' enabled: true retentionPolicy: { - days: 30 + days: 0 enabled: true } } @@ -156,7 +156,7 @@ resource diagnosticLogs 'Microsoft.Insights/diagnosticSettings@2021-05-01-previe category: 'AllMetrics' enabled: true retentionPolicy: { - days: 30 + days: 0 enabled: true } } diff --git a/infra/core/storage/storage-account.bicep b/infra/core/storage/storage-account.bicep index bdf3cc11f..f4f3e3eaa 100644 --- a/infra/core/storage/storage-account.bicep +++ b/infra/core/storage/storage-account.bicep @@ -65,10 +65,6 @@ resource storage 'Microsoft.Storage/storageAccounts@2022-05-01' = { } - // resource queueServices 'queueServices' = [for queueName in queueNames: { - // name: queueName.name - // }] - resource queueServices 'queueServices' = { name: 'default' resource queue 'queues' = [for queueName in queueNames: { diff --git a/pipelines/templates/deploy-template.yml b/pipelines/templates/deploy-template.yml index 242e22567..314badbbb 100644 --- a/pipelines/templates/deploy-template.yml +++ b/pipelines/templates/deploy-template.yml @@ -38,7 +38,7 @@ steps: docker image tag info-asst-devcontainer:latest $(CONTAINER_REGISTRY_ADDRESS)/info-asst-devcontainer:latest docker image push $(CONTAINER_REGISTRY_ADDRESS)/info-asst-devcontainer:latest displayName: Push latest dev container image to container registry - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/0.2-Beta'))) + condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/vNext-Dev'))) - template: make-command.yml parameters: