diff --git a/.azdo/pipelines/azure-dev.yml b/.azdo/pipelines/azure-dev.yml index 3498c25dc7..c5fe8319c1 100644 --- a/.azdo/pipelines/azure-dev.yml +++ b/.azdo/pipelines/azure-dev.yml @@ -111,7 +111,7 @@ steps: AZURE_ADLS_GEN2_FILESYSTEM: $(AZURE_ADLS_GEN2_FILESYSTEM) DEPLOYMENT_TARGET: $(DEPLOYMENT_TARGET) AZURE_CONTAINER_APPS_WORKLOAD_PROFILE: $(AZURE_CONTAINER_APPS_WORKLOAD_PROFILE) - + USE_CHAT_HISTORY_BROWSER: $(USE_CHAT_HISTORY_BROWSER) - task: AzureCLI@2 displayName: Deploy Application inputs: diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index d414609eb1..40ab577028 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -95,7 +95,7 @@ jobs: AZURE_ADLS_GEN2_FILESYSTEM: ${{ vars.AZURE_ADLS_GEN2_FILESYSTEM }} DEPLOYMENT_TARGET: ${{ vars.DEPLOYMENT_TARGET }} AZURE_CONTAINER_APPS_WORKLOAD_PROFILE: ${{ vars.AZURE_CONTAINER_APPS_WORKLOAD_PROFILE }} - + USE_CHAT_HISTORY_BROWSER: ${{ vars.USE_CHAT_HISTORY_BROWSER }} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d734be650d..55b7be4e4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -165,6 +165,7 @@ If you followed the steps above to install the pre-commit hooks, then you can ju ## Adding new azd environment variables When adding new azd environment variables, please remember to update: + 1. App Service's [azure.yaml](./azure.yaml) 1. [ADO pipeline](.azdo/pipelines/azure-dev.yml). 1. [Github workflows](.github/workflows/azure-dev.yml) diff --git a/app/backend/core/sessionhelper.py b/app/backend/core/sessionhelper.py index bb1e52fbe0..28dd0e811b 100644 --- a/app/backend/core/sessionhelper.py +++ b/app/backend/core/sessionhelper.py @@ -1,7 +1,8 @@ import uuid +from typing import Union -def create_session_id(config_chat_history_browser_enabled: bool) -> str | None: +def create_session_id(config_chat_history_browser_enabled: bool) -> Union[str, None]: if config_chat_history_browser_enabled: return str(uuid.uuid4()) return None diff --git a/azure.yaml b/azure.yaml index 6a999fd140..859c5a44ef 100644 --- a/azure.yaml +++ b/azure.yaml @@ -90,6 +90,7 @@ pipeline: - AZURE_ADLS_GEN2_FILESYSTEM - DEPLOYMENT_TARGET - AZURE_CONTAINER_APPS_WORKLOAD_PROFILE + - USE_CHAT_HISTORY_BROWSER secrets: - AZURE_SERVER_APP_SECRET - AZURE_CLIENT_APP_SECRET diff --git a/docs/deploy_features.md b/docs/deploy_features.md index e4628b1b80..b259e7e197 100644 --- a/docs/deploy_features.md +++ b/docs/deploy_features.md @@ -7,6 +7,7 @@ You should typically enable these features before running `azd up`. Once you've * [Using GPT-4](#using-gpt-4) * [Using text-embedding-3 models](#using-text-embedding-3-models) * [Enabling GPT-4 Turbo with Vision](#enabling-gpt-4-turbo-with-vision) +* [Enabling chat history](#enabling-chat-history) * [Enabling language picker](#enabling-language-picker) * [Enabling speech input/output](#enabling-speech-inputoutput) * [Enabling Integrated Vectorization](#enabling-integrated-vectorization) @@ -142,6 +143,16 @@ If you have already deployed: This section covers the integration of GPT-4 Vision with Azure AI Search. Learn how to enhance your search capabilities with the power of image and text indexing, enabling advanced search functionalities over diverse document types. For a detailed guide on setup and usage, visit our [Enabling GPT-4 Turbo with Vision](gpt4v.md) page. +## Enabling chat history + +This feature allows users to view the chat history of their conversation, stored in the browser using [IndexedDB](https://developer.mozilla.org/docs/Web/API/IndexedDB_API). That means the chat history will be available only on the device where the chat was initiated. To enable browser-stored chat history, run: + +```shell +azd env set USE_CHAT_HISTORY_BROWSER true +``` + +In the future, we plan to add support for optionally storing chat history in a server-side storage such as Cosmos DB. + ## Enabling language picker You can optionally enable the language picker to allow users to switch between different languages. Currently, it supports English, Spanish, French, and Japanese.