diff --git a/.github/workflows/copilot-build.yml b/.github/workflows/copilot-build-backend.yml similarity index 67% rename from .github/workflows/copilot-build.yml rename to .github/workflows/copilot-build-backend.yml index 7f88f2080..0eed8fb3f 100644 --- a/.github/workflows/copilot-build.yml +++ b/.github/workflows/copilot-build-backend.yml @@ -1,17 +1,21 @@ -name: copilot-build +name: copilot-build-backend on: + pull_request: + branches: ["main"] + merge_group: + branches: ["main"] workflow_call: outputs: artifact: description: "The name of the uploaded artifact." - value: ${{jobs.web-api.outputs.artifact}} + value: ${{jobs.webapi.outputs.artifact}} permissions: contents: read jobs: - web-api: + webapi: strategy: fail-fast: false matrix: @@ -33,7 +37,12 @@ jobs: - name: Package Copilot Chat WebAPI run: | - deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\deploy + scripts\deploy\package-webapi.ps1 -Configuration Release -DotnetFramework net6.0 -TargetRuntime win-x64 -OutputDirectory ${{ github.workspace }}\scripts\deploy + + - name: Check formatting of Copilot Chat WebAPI + run: | + cd webapi/ + dotnet format --verify-no-changes --verbosity diagnostic - name: Set version tag id: versiontag @@ -46,7 +55,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: copilotchat-webapi-${{ steps.versiontag.outputs.versiontag }} - path: ${{ github.workspace }}\deploy\out\webapi.zip + path: ${{ github.workspace }}\scripts\deploy\out\webapi.zip - name: "Set outputs" id: artifactoutput diff --git a/.github/workflows/copilot-build-frontend.yml b/.github/workflows/copilot-build-frontend.yml new file mode 100644 index 000000000..c74e7e4cf --- /dev/null +++ b/.github/workflows/copilot-build-frontend.yml @@ -0,0 +1,33 @@ +name: copilot-build-frontend + +on: + workflow_dispatch: + pull_request: + branches: ["main"] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + webapp: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "yarn" + cache-dependency-path: "webapp/yarn.lock" + + - name: Run yarn install, yarn build, & yarn format + run: | + #!/bin/bash + set -e # exit with nonzero exit code if anything fails + echo "Running yarn install, yarn build, & yarn format" + yarn install --frozen-lockfile # install dependencies and ensure lockfile is unchanged. + yarn build # run build script + yarn format # run format script + working-directory: webapp diff --git a/.github/workflows/copilot-chat-package.yml b/.github/workflows/copilot-chat-package.yml deleted file mode 100644 index 7f02a25bb..000000000 --- a/.github/workflows/copilot-chat-package.yml +++ /dev/null @@ -1,55 +0,0 @@ -# -# This workflow will package the Copilot Chat application for deployment. -# - -name: copilot-chat-package - -on: - pull_request: - branches: ["main"] - merge_group: - branches: ["main"] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - copilot-chat-package: - strategy: - fail-fast: false - matrix: - include: - - { dotnet: "6.0", configuration: Release, os: ubuntu-latest } - - runs-on: ${{ matrix.os }} - env: - NUGET_CERT_REVOCATION_MODE: offline - steps: - - uses: actions/checkout@v3 - with: - clean: true - - - name: Pull container dotnet/sdk:${{ matrix.dotnet }} - run: docker pull mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} - - - name: Package Copilot Chat WebAPI - run: | - chmod +x $(pwd)/scripts/deploy/package-webapi.sh; - docker run --rm -v $(pwd):/app -w /app -e GITHUB_ACTIONS='true' mcr.microsoft.com/dotnet/sdk:${{ matrix.dotnet }} /bin/sh -c "/app/scripts/deploy/package-webapi.sh --no-zip"; - - - name: Set version tag - id: versiontag - run: | - VERSION_TAG="$(date +'%Y%m%d').${{ github.run_number }}.${{ github.run_attempt }}" - echo $VERSION_TAG - echo "versiontag=$VERSION_TAG" >> $GITHUB_OUTPUT - - - name: Upload package to artifacts - uses: actions/upload-artifact@v3 - with: - name: copilotchat-webapi-${{ steps.versiontag.outputs.versiontag }} - path: ./scripts/deploy/publish diff --git a/.github/workflows/copilot-deploy-backend.yml b/.github/workflows/copilot-deploy-backend.yml index 9ceb4e47e..464426bf4 100644 --- a/.github/workflows/copilot-deploy-backend.yml +++ b/.github/workflows/copilot-deploy-backend.yml @@ -24,7 +24,7 @@ permissions: contents: read jobs: - web-api: + webapi: environment: ${{inputs.ENVIRONMENT}} permissions: id-token: write diff --git a/.github/workflows/copilot-deploy-frontend.yml b/.github/workflows/copilot-deploy-frontend.yml index 311ad371d..77ee5fb9c 100644 --- a/.github/workflows/copilot-deploy-frontend.yml +++ b/.github/workflows/copilot-deploy-frontend.yml @@ -1,4 +1,4 @@ -name: copilot-deploy-backend +name: copilot-deploy-frontend on: workflow_call: @@ -23,7 +23,7 @@ permissions: contents: read jobs: - web-app: + webapp: environment: ${{inputs.ENVIRONMENT}} permissions: id-token: write diff --git a/.github/workflows/copilot-deploy-pipeline.yml b/.github/workflows/copilot-deploy-pipeline.yml index ca66a4af5..8ef467a1a 100644 --- a/.github/workflows/copilot-deploy-pipeline.yml +++ b/.github/workflows/copilot-deploy-pipeline.yml @@ -15,7 +15,7 @@ permissions: jobs: build: - uses: ./.github/workflows/copilot-build.yml + uses: ./.github/workflows/copilot-build-backend.yml int: needs: build diff --git a/.github/workflows/copilot-chat-tests.yml b/.github/workflows/copilot-test-e2e.yml similarity index 99% rename from .github/workflows/copilot-chat-tests.yml rename to .github/workflows/copilot-test-e2e.yml index 3c4bc9d46..d82167c93 100644 --- a/.github/workflows/copilot-chat-tests.yml +++ b/.github/workflows/copilot-test-e2e.yml @@ -8,7 +8,7 @@ permissions: contents: read jobs: - test: + e2e: defaults: run: working-directory: webapp diff --git a/.github/workflows/node-pr.yml b/.github/workflows/node-pr.yml deleted file mode 100644 index 9b4066c26..000000000 --- a/.github/workflows/node-pr.yml +++ /dev/null @@ -1,70 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: node-pr - -on: - workflow_dispatch: - pull_request: - branches: ["main"] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - find-yarn-projects: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-yarn-folders.outputs.matrix }} - - steps: - - uses: actions/checkout@v3 - - - name: Find yarn projects - id: set-yarn-folders - # This step uses a bash script to find all subfolders that contain a yarn.lock file - run: | - #!/bin/bash - set -e # exit with nonzero exit code if anything fails - shopt -s globstar # enable globstar option to use ** for recursive matching - yarndirs=() - for lockfile in **/yarn.lock; do # loop over all yarn.lock files - dir=$(dirname "$lockfile") # get the directory of the lock file - echo "Found yarn project in $dir" - yarndirs+=("$dir") # add the directory to the yarndirs array - done - - echo "All yarn projects found: '${yarndirs[*]}'" - yarndirs_json=$(echo -n "${yarndirs[*]%\n}" | jq -R -s -j --compact-output 'split(" ")') - matrix_json="{\"node_version\":[18], \"yarn_folder\":$yarndirs_json}" - echo "Setting output matrix to $matrix_json" - echo "matrix=$matrix_json" >> $GITHUB_OUTPUT - - build: - runs-on: ubuntu-latest - needs: find-yarn-projects - - strategy: - matrix: ${{ fromJson(needs.find-yarn-projects.outputs.matrix) }} - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node_version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node_version }} - cache: "yarn" - cache-dependency-path: "**/yarn.lock" - - - name: Run yarn install & yarn build - # This step runs yarn install and yarn build for each project. - # The --frozen-lockfile option ensures that the dependencies are installed exactly as specified in the lock file. - # The -cwd option sets the current working directory to the folder where the yarn.lock file is located. - run: | - #!/bin/bash - set -e # exit with nonzero exit code if anything fails - dir=${{ matrix.yarn_folder }} # get the directory of the lock file - echo "Running yarn install and yarn build for $dir" - yarn --cwd "$dir" install --frozen-lockfile # install dependencies - yarn --cwd "$dir" build # run build script diff --git a/README.md b/README.md index 9a3360be8..cf1d6acf9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Chat Copilot Sample Application -This sample allows you to build your own integrated large language model (LLM) chat copilot. The sample is built on Microsoft Semantic Kernel and has two components: a frontend [React web app](./webapp/) and a backend [.NET web API service](./webapi/). +This sample allows you to build your own integrated large language model (LLM) chat copilot. The sample is built on Microsoft Semantic Kernel and has two components: a frontend [React web app](./webapp/) and a backend [.NET web API service](./webapi/). -These quick-start instructions run the sample locally. To deploy the sample to Azure, please view [Deploying Chat Copilot](https://github.com/microsoft/chat-copilot/blob/main/deploy/README.md). +These quick-start instructions run the sample locally. To deploy the sample to Azure, please view [Deploying Chat Copilot](./scripts/deploy/README.md). > **IMPORTANT:** This sample is for educational purposes only and is not recommended for production deployments. @@ -11,6 +11,7 @@ These quick-start instructions run the sample locally. To deploy the sample to A ![ChatCopilot](https://github.com/microsoft/chat-copilot/assets/64985898/4b5b4ddd-0ba5-4da1-9769-1bc4a74f1996) # Requirements + You will need the following items to run the sample: - [.NET 7.0 SDK](https://dotnet.microsoft.com/download/dotnet/7.0) _(via Setup script)_ @@ -26,92 +27,95 @@ You will need the following items to run the sample: # Instructions ## Windows + 1. Open PowerShell as an administrator. 2. Setup your environment. - ```powershell - cd \scripts\ - .\Install.ps1 - ``` + ```powershell + cd \scripts\ + .\Install.ps1 + ``` - > NOTE: This script will install `Chocolatey`, `dotnet-7.0-sdk`, `nodejs`, and `yarn`. + > NOTE: This script will install `Chocolatey`, `dotnet-7.0-sdk`, `nodejs`, and `yarn`. 3. Configure Chat Copilot. - - ```powershell - .\Configure.ps1 -AIService {AI_SERVICE} -APIKey {API_KEY} -Endpoint {AZURE_OPENAI_ENDPOINT} - ``` - - `AI_SERVICE`: `AzureOpenAI` or `OpenAI`. - - `API_KEY`: The `API key` for Azure OpenAI or for OpenAI. - - `AZURE_OPENAI_ENDPOINT`: The Azure OpenAI resource `Endpoint` address. Omit `-Endpoint` if using OpenAI. + ```powershell + .\Configure.ps1 -AIService {AI_SERVICE} -APIKey {API_KEY} -Endpoint {AZURE_OPENAI_ENDPOINT} + ``` + + - `AI_SERVICE`: `AzureOpenAI` or `OpenAI`. + - `API_KEY`: The `API key` for Azure OpenAI or for OpenAI. + - `AZURE_OPENAI_ENDPOINT`: The Azure OpenAI resource `Endpoint` address. Omit `-Endpoint` if using OpenAI. - - > **IMPORTANT:** For `AzureOpenAI`, if you deployed models `gpt-35-turbo` and `text-embedding-ada-002` with custom names (instead of each own's given name), also use the parameters: + - > **IMPORTANT:** For `AzureOpenAI`, if you deployed models `gpt-35-turbo` and `text-embedding-ada-002` with custom names (instead of each own's given name), also use the parameters: - ```powershell - -CompletionModel {DEPLOYMENT_NAME} -EmbeddingModel {DEPLOYMENT_NAME} -PlannerModel {DEPLOYMENT_NAME} - ``` + ```powershell + -CompletionModel {DEPLOYMENT_NAME} -EmbeddingModel {DEPLOYMENT_NAME} -PlannerModel {DEPLOYMENT_NAME} + ``` 4. Run Chat Copilot locally. This step starts both the backend API and frontend application. - - ```powershell - .\Start.ps1 - ``` - It may take a few minutes for Yarn packages to install on the first run. + ```powershell + .\Start.ps1 + ``` - > NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application. + It may take a few minutes for Yarn packages to install on the first run. + + > NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application. ## Linux/macOS + 1. Open Bash as an administrator. 2. Configure environment. - - ```bash - cd /scripts/ - chmod +x *.sh - ``` + + ```bash + cd /scripts/ + chmod +x *.sh + ``` **Ubuntu/Debian Linux** - ```bash - ./Install-apt.sh - ``` + ```bash + ./Install-apt.sh + ``` - > NOTE: This script uses `apt` to install `dotnet-sdk-7.0`, `nodejs`, and `yarn`. + > NOTE: This script uses `apt` to install `dotnet-sdk-7.0`, `nodejs`, and `yarn`. - **macOS** + **macOS** - ```bash - ./Install-brew.sh - ``` + ```bash + ./Install-brew.sh + ``` - > NOTE: This script uses `homebrew` to install `dotnet-sdk`, `nodejs`, and `yarn`. + > NOTE: This script uses `homebrew` to install `dotnet-sdk`, `nodejs`, and `yarn`. 3. Configure Chat Copilot. - ```bash - ./Configure.sh --aiservice {AI_SERVICE} --apikey {API_KEY} --endpoint {AZURE_OPENAI_ENDPOINT} - ``` + ```bash + ./Configure.sh --aiservice {AI_SERVICE} --apikey {API_KEY} --endpoint {AZURE_OPENAI_ENDPOINT} + ``` + + - `AI_SERVICE`: `AzureOpenAI` or `OpenAI`. + - `API_KEY`: The `API key` for Azure OpenAI or for OpenAI. + - `AZURE_OPENAI_ENDPOINT`: The Azure OpenAI resource `Endpoint` address. Omit `--endpoint` if using OpenAI. - - `AI_SERVICE`: `AzureOpenAI` or `OpenAI`. - - `API_KEY`: The `API key` for Azure OpenAI or for OpenAI. - - `AZURE_OPENAI_ENDPOINT`: The Azure OpenAI resource `Endpoint` address. Omit `--endpoint` if using OpenAI. - - > **IMPORTANT:** For `AzureOpenAI`, if you deployed models `gpt-35-turbo` and `text-embedding-ada-002` with custom names (instead of each own's given name), also use the parameters: + - > **IMPORTANT:** For `AzureOpenAI`, if you deployed models `gpt-35-turbo` and `text-embedding-ada-002` with custom names (instead of each own's given name), also use the parameters: - ```bash - --completionmodel {DEPLOYMENT_NAME} --embeddingmodel {DEPLOYMENT_NAME} --plannermodel {DEPLOYMENT_NAME} - ``` + ```bash + --completionmodel {DEPLOYMENT_NAME} --embeddingmodel {DEPLOYMENT_NAME} --plannermodel {DEPLOYMENT_NAME} + ``` 4. Run Chat Copilot locally. This step starts both the backend API and frontend application. - ```bash - ./Start.sh - ``` + ```bash + ./Start.sh + ``` - It may take a few minutes for Yarn packages to install on the first run. + It may take a few minutes for Yarn packages to install on the first run. - > NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application. + > NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application. ## (Optional) Enable backend authentication via Azure AD @@ -136,38 +140,42 @@ By default, Chat Copilot runs locally without authentication, using a guest user > Take note of the `Application (client) ID` for both app registrations as you will need them in future steps. 3. Expose an API within the second app registration - 1. Select *Expose an API* from the menu - 2. Add an *Application ID URI* + 1. Select _Expose an API_ from the menu + + 2. Add an _Application ID URI_ + 1. This will generate an `api://` URI with a generated for you - 2. Click *Save* to store the generated URI + 2. Click _Save_ to store the generated URI 3. Add a scope for `access_as_user` - 1. Click *Add scope* - 2. Set *Scope name* to `access_as_user` + 1. Click _Add scope_ - 3. Set *Who can consent* to *Admins and users* + 2. Set _Scope name_ to `access_as_user` - 4. Set *Admin consent display name* and *User consent display name* to `Access copilot chat as a user` + 3. Set _Who can consent_ to _Admins and users_ - 5. Set *Admin consent description* and *User consent description* to `Allows the accesses to the Copilot chat web API as a user` + 4. Set _Admin consent display name_ and _User consent display name_ to `Access copilot chat as a user` + + 5. Set _Admin consent description_ and _User consent description_ to `Allows the accesses to the Copilot chat web API as a user` 4. Add permissions to web app frontend to access web api as user + 1. Open app registration for web app frontend - 2. Go to *API Permissions* + 2. Go to _API Permissions_ - 3. Click *Add a permission* + 3. Click _Add a permission_ - 4. Select the tab *My APIs* + 4. Select the tab _My APIs_ 5. Choose the app registration representing the web api backend 6. Select permissions `access_as_user` - 7. Click *Add permissions* + 7. Click _Add permissions_ 5. Run the Configure script with additional parameters to set up authentication. @@ -206,61 +214,61 @@ By default, Chat Copilot runs locally without authentication, using a guest user # Troubleshooting -1. **_Issue:_** Unable to load chats. - - _Details_: interaction_in_progress: Interaction is currently in progress._ +1. **_Issue:_** Unable to load chats. - _Explanation_: The WebApp can display this error when the application is configured for a different AAD tenant from the browser, (e.g., personal/MSA account vs work/school account). + _Details_: interaction*in_progress: Interaction is currently in progress.* - _Solution_: Either use a private/incognito browser tab or clear your browser credentials/cookies. Confirm you are logged in with the same account used to register the application. + _Explanation_: The WebApp can display this error when the application is configured for a different AAD tenant from the browser, (e.g., personal/MSA account vs work/school account). + + _Solution_: Either use a private/incognito browser tab or clear your browser credentials/cookies. Confirm you are logged in with the same account used to register the application. 2. **_Issue:_**: Challenges using text completion models, such as `text-davinci-003` - _Solution_: For OpenAI, see [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility) for - the complete list of current models supporting chat completions. For Azure OpenAI, see [model summary table and region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability). + _Solution_: For OpenAI, see [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility) for + the complete list of current models supporting chat completions. For Azure OpenAI, see [model summary table and region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability). 3. **_Issue:_** Localhost SSL certificate errors / CORS errors - ![Cert-Issue](https://github.com/microsoft/chat-copilot/assets/64985898/e9072af1-e43c-472d-bebc-d0082d0c9180) + ![Cert-Issue](https://github.com/microsoft/chat-copilot/assets/64985898/e9072af1-e43c-472d-bebc-d0082d0c9180) - _Explanation_: Your browser may be blocking the frontend access to the backend while waiting for your permission to connect. + _Explanation_: Your browser may be blocking the frontend access to the backend while waiting for your permission to connect. - _Solution_: + _Solution_: - 1. Confirm the backend service is running. Open a web browser and navigate to `https://localhost:40443/healthz` - - You should see a confirmation message: `Healthy` - - If your browser asks you to acknowledge the risks of visiting an insecure website, you must acknowledge this before the frontend can connect to the backend server. - 2. Navigate to `http://localhost:3000` or refresh the page to use the Chat Copilot application. + 1. Confirm the backend service is running. Open a web browser and navigate to `https://localhost:40443/healthz` + - You should see a confirmation message: `Healthy` + - If your browser asks you to acknowledge the risks of visiting an insecure website, you must acknowledge this before the frontend can connect to the backend server. + 2. Navigate to `http://localhost:3000` or refresh the page to use the Chat Copilot application. 4. **_Issue:_** Yarn is not working. - _Explanation_: You may have the wrong Yarn version installed such as v2.x+. + _Explanation_: You may have the wrong Yarn version installed such as v2.x+. - _Solution_: Use the classic version. + _Solution_: Use the classic version. - ```bash - npm install -g yarn - yarn set version classic - ``` + ```bash + npm install -g yarn + yarn set version classic + ``` 5. **_Issue:_** Missing `/usr/share/dotnet/host/fxr` folder. - _Details_: "A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist" when running dotnet commands on Linux. + _Details_: "A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist" when running dotnet commands on Linux. - _Explanation_: When .NET (Core) was first released for Linux, it was not yet available in the official Ubuntu repo. So instead, many of us added the Microsoft APT repo in order to install it. Now, the packages are part of the Ubuntu repo, and they are conflicting with the Microsoft packages. This error is a result of mixed packages. ([Source: StackOverflow](https://stackoverflow.com/questions/73753672/a-fatal-error-occurred-the-folder-usr-share-dotnet-host-fxr-does-not-exist)) + _Explanation_: When .NET (Core) was first released for Linux, it was not yet available in the official Ubuntu repo. So instead, many of us added the Microsoft APT repo in order to install it. Now, the packages are part of the Ubuntu repo, and they are conflicting with the Microsoft packages. This error is a result of mixed packages. ([Source: StackOverflow](https://stackoverflow.com/questions/73753672/a-fatal-error-occurred-the-folder-usr-share-dotnet-host-fxr-does-not-exist)) - _Solution_: + _Solution_: - ```bash - # Remove all existing packages to get to a clean state: - sudo apt remove --assume-yes dotnet*; - sudo apt remove --assume-yes aspnetcore*; - sudo apt remove --assume-yes netstandard*; + ```bash + # Remove all existing packages to get to a clean state: + sudo apt remove --assume-yes dotnet*; + sudo apt remove --assume-yes aspnetcore*; + sudo apt remove --assume-yes netstandard*; - # Set the Microsoft package provider priority - echo -e "Package: *\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 1001" | sudo tee /etc/apt/preferences.d/99microsoft-dotnet.pref; + # Set the Microsoft package provider priority + echo -e "Package: *\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 1001" | sudo tee /etc/apt/preferences.d/99microsoft-dotnet.pref; - # Update and install dotnet - sudo apt update; - sudo apt install --assume-yes dotnet-sdk-7.0; - ``` + # Update and install dotnet + sudo apt update; + sudo apt install --assume-yes dotnet-sdk-7.0; + ``` diff --git a/scripts/README.md b/scripts/README.md index a13f13732..5f5e3eb19 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,2 +1,3 @@ # Chat Copilot setup scripts - Local deployment -To use these scripts, please follow the quick-start guide found [here](https://github.com/microsoft/chat-copilot/blob/main/README.md). + +To use these scripts, please follow the quick-start guide found [here](../README.md). diff --git a/webapp/package.json b/webapp/package.json index 44c26d734..221994b98 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -4,9 +4,10 @@ "version": "0.0.0", "type": "module", "scripts": { + "format": "prettier src --check", + "format:fix": "prettier src --write", "lint": "eslint src", "lint:fix": "eslint src --fix", - "prettify": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,scss,css,html,svg}\"", "serve": "serve -s build", "start": "react-scripts start", "build": "react-scripts build", diff --git a/webapp/src/components/chat/chat-list/ListItemActions.tsx b/webapp/src/components/chat/chat-list/ListItemActions.tsx index 438c9992d..48391dcbf 100644 --- a/webapp/src/components/chat/chat-list/ListItemActions.tsx +++ b/webapp/src/components/chat/chat-list/ListItemActions.tsx @@ -65,7 +65,9 @@ export const ListItemActions: React.FC = ({ chatId, chatN icon={} appearance="transparent" aria-label="Edit" - onClick={() => { setIsGettingInvitationId(true); }} + onClick={() => { + setIsGettingInvitationId(true); + }} /> {features[FeatureKeys.DeleteChats].enabled && } diff --git a/webapp/src/components/chat/controls/ShareBotMenu.tsx b/webapp/src/components/chat/controls/ShareBotMenu.tsx index 869b8eab7..3163dbe24 100644 --- a/webapp/src/components/chat/controls/ShareBotMenu.tsx +++ b/webapp/src/components/chat/controls/ShareBotMenu.tsx @@ -54,7 +54,9 @@ export const ShareBotMenu: FC = ({ chatId, chatTitle }) => { } - onClick={() => { setIsGettingInvitationId(true); }} + onClick={() => { + setIsGettingInvitationId(true); + }} disabled={!features[FeatureKeys.MultiUserChat].enabled} > Invite others to your Bot diff --git a/webapp/src/components/chat/invitation-dialog/InvitationCreateDialog.tsx b/webapp/src/components/chat/invitation-dialog/InvitationCreateDialog.tsx index b72807250..6c812ddbe 100644 --- a/webapp/src/components/chat/invitation-dialog/InvitationCreateDialog.tsx +++ b/webapp/src/components/chat/invitation-dialog/InvitationCreateDialog.tsx @@ -50,13 +50,20 @@ export const InvitationCreateDialog: React.FC = ({ Invite others to your Bot - + - - diff --git a/webapp/src/components/chat/invitation-dialog/InvitationJoinDialog.tsx b/webapp/src/components/chat/invitation-dialog/InvitationJoinDialog.tsx index 9a2acfc4a..bedca4e43 100644 --- a/webapp/src/components/chat/invitation-dialog/InvitationJoinDialog.tsx +++ b/webapp/src/components/chat/invitation-dialog/InvitationJoinDialog.tsx @@ -68,8 +68,12 @@ export const InvitationJoinDialog: React.FC = ({ onCl - - + + diff --git a/webapp/src/components/header/settings-dialog/SettingSection.tsx b/webapp/src/components/header/settings-dialog/SettingSection.tsx index ecf1e5a3b..b34180472 100644 --- a/webapp/src/components/header/settings-dialog/SettingSection.tsx +++ b/webapp/src/components/header/settings-dialog/SettingSection.tsx @@ -53,7 +53,9 @@ export const SettingSection: React.FC = ({ setting, conte label={feature.label} checked={feature.enabled} disabled={feature.inactive} - onChange={() => { onFeatureChange(key); }} + onChange={() => { + onFeatureChange(key); + }} /> = ({ manifestDomainError, }) => { const classes = useClasses(); - const [input, setInput] = useState( manifestDomain ?? ''); + const [input, setInput] = useState(manifestDomain ?? ''); const keyStrokeTimeout = useRef(-1); diff --git a/webapp/src/components/shared/BundledIcons.tsx b/webapp/src/components/shared/BundledIcons.tsx index 81a90efb4..7a10d1f96 100644 --- a/webapp/src/components/shared/BundledIcons.tsx +++ b/webapp/src/components/shared/BundledIcons.tsx @@ -46,4 +46,4 @@ export const Filter20 = bundleIcon(Filter20Filled, Filter20Regular); export const Info16 = bundleIcon(Info16Filled, Info16Regular); export const Share20 = bundleIcon(Share20Filled, Share20Regular); export const ThumbLike16 = bundleIcon(ThumbLike16Filled, ThumbLike16Regular); -export const ThumbDislike16 = bundleIcon(ThumbDislike16Filled, ThumbDislike16Regular); \ No newline at end of file +export const ThumbDislike16 = bundleIcon(ThumbDislike16Filled, ThumbDislike16Regular); diff --git a/webapp/src/components/utils/PluginUtils.ts b/webapp/src/components/utils/PluginUtils.ts index 65dfcd636..94dc7ad1d 100644 --- a/webapp/src/components/utils/PluginUtils.ts +++ b/webapp/src/components/utils/PluginUtils.ts @@ -1,10 +1,10 @@ -import { +import { PluginManifest, PluginManifestKeys, isManifestAuthType, isHttpAuthorizationType, - requiresUserLevelAuth -} from "../../libs/models/PluginManifest"; + requiresUserLevelAuth, +} from '../../libs/models/PluginManifest'; export const isValidPluginManifest = (manifest: PluginManifest) => { const missingKeys: string[] = []; diff --git a/webapp/src/components/views/BackendProbe.tsx b/webapp/src/components/views/BackendProbe.tsx index 1a27f2018..a4eec1239 100644 --- a/webapp/src/components/views/BackendProbe.tsx +++ b/webapp/src/components/views/BackendProbe.tsx @@ -33,8 +33,8 @@ const BackendProbe: FC = ({ uri, onBackendFound }) => { Looking for your backend - This sample expects to find a Semantic Kernel service from{' '} - webapi/ running at {uri} + This sample expects to find a Semantic Kernel service from webapi/ running at{' '} + {uri} Run your Semantic Kernel service locally using Visual Studio, Visual Studio Code or by typing the diff --git a/webapp/src/components/views/Login.tsx b/webapp/src/components/views/Login.tsx index 5442b7491..33ffdd4a5 100644 --- a/webapp/src/components/views/Login.tsx +++ b/webapp/src/components/views/Login.tsx @@ -12,13 +12,19 @@ export const Login: React.FC = () => {
Login with your Microsoft Account - {'Don\'t have an account? Create one for free at'}{' '} + {"Don't have an account? Create one for free at"}{' '} https://account.microsoft.com/ -
diff --git a/webapp/src/components/views/MissingEnvVariablesError.tsx b/webapp/src/components/views/MissingEnvVariablesError.tsx index e1b4d42b4..bcdbe84e0 100644 --- a/webapp/src/components/views/MissingEnvVariablesError.tsx +++ b/webapp/src/components/views/MissingEnvVariablesError.tsx @@ -18,7 +18,9 @@ const MissingEnvVariablesError: FC = ({ missingVariables }) => {
- {'Please ensure your ".env" file is set up correctly with all environment variables defined in ".env.example" then restart the app.'} + { + 'Please ensure your ".env" file is set up correctly with all environment variables defined in ".env.example" then restart the app.' + } You are missing the following variables: {missingVariables.join(', ')}
diff --git a/webapp/src/index.css b/webapp/src/index.css index 95a9b18f5..5b4bd078e 100644 --- a/webapp/src/index.css +++ b/webapp/src/index.css @@ -19,9 +19,9 @@ body, } ::-webkit-scrollbar { - width: .4rem; + width: 0.4rem; } ::-webkit-scrollbar-thumb { border-radius: 12px; - visibility: 'hidden', -} \ No newline at end of file + visibility: 'hidden'; +} diff --git a/webapp/src/redux/features/conversations/ConversationsState.ts b/webapp/src/redux/features/conversations/ConversationsState.ts index 5aabffec2..60a90ca0d 100644 --- a/webapp/src/redux/features/conversations/ConversationsState.ts +++ b/webapp/src/redux/features/conversations/ConversationsState.ts @@ -33,4 +33,4 @@ export interface ConversationInputChange { export interface ConversationSystemDescriptionChange { id: string; newSystemDescription: string; -} \ No newline at end of file +}