Skip to content
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

*nix codestyle #282

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ root = true
indent_style = space
end_of_line = lf

# Bash scripts
[*.sh]
indent_size = 2

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Run yarn install, yarn build, & yarn format
run: |
#!/bin/bash
#!/usr/bin/env 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.
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@
"**/Thumbs.db": true,
"**.lock": true,
},
"dotnet.defaultSolution": "CopilotChat.sln",
"editor.tabSize": 2,
}
52 changes: 35 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,46 +73,64 @@ You will need the following items to run the sample:

```bash
cd <path to chat-copilot>/scripts/
chmod +x *.sh
```
```

**Ubuntu/Debian Linux**

```bash
./Install-apt.sh
./install-apt.sh
```

> NOTE: This script uses `apt` to install `dotnet-sdk-7.0`, `nodejs`, and `yarn`.

**macOS**

```bash
./Install-brew.sh
./install-brew.sh
```

> 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}
```
1. For 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.
```bash
./configure.sh --aiservice OpenAI --apikey {API_KEY}
```

- `API_KEY`: The `API key` for 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:

```bash
--completionmodel {DEPLOYMENT_NAME} --embeddingmodel {DEPLOYMENT_NAME} --plannermodel {DEPLOYMENT_NAME}
```
2. For Azure OpenAI

```bash
./configure.sh --aiservice AzureOpenAI \
--endpoint {AZURE_OPENAI_ENDPOINT} \
--apikey {API_KEY}
```

- `AZURE_OPENAI_ENDPOINT`: The Azure OpenAI resource `Endpoint` address.
- `API_KEY`: The `API key` for Azure OpenAI.


**IMPORTANT:** If you deployed models `gpt-35-turbo` and `text-embedding-ada-002`
with custom names (instead of each own's given name), you need to specify
the deployment names with three additional parameters:

```bash
./configure.sh --aiservice AzureOpenAI \
--endpoint {AZURE_OPENAI_ENDPOINT} \
--apikey {API_KEY} \
--completionmodel {DEPLOYMENT_NAME} \
--plannermodel {DEPLOYMENT_NAME} \
--embeddingmodel {DEPLOYMENT_NAME}
```

4. Run Chat Copilot locally. This step starts both the backend API and frontend application.

```bash
./Start.sh
./start.sh
```

It may take a few minutes for Yarn packages to install on the first run.
Expand Down Expand Up @@ -199,7 +217,7 @@ By default, Chat Copilot runs locally without authentication, using a guest user

**Bash**
```bash
./Configure.sh --aiservice {AI_SERVICE} --apikey {API_KEY} --endpoint {AZURE_OPENAI_ENDPOINT} --frontend-clientid {FRONTEND_APPLICATION_ID} --backend-clientid {BACKEND_APPLICATION_ID} --tenantid {TENANT_ID} --instance {AZURE_AD_INSTANCE}
./configure.sh --aiservice {AI_SERVICE} --apikey {API_KEY} --endpoint {AZURE_OPENAI_ENDPOINT} --frontend-clientid {FRONTEND_APPLICATION_ID} --backend-clientid {BACKEND_APPLICATION_ID} --tenantid {TENANT_ID} --instance {AZURE_AD_INSTANCE}
```

- `AI_SERVICE`: `AzureOpenAI` or `OpenAI`.
Expand All @@ -221,7 +239,7 @@ By default, Chat Copilot runs locally without authentication, using a guest user
**Bash**

```bash
./Start.sh
./start.sh
```

# Troubleshooting
Expand Down
2 changes: 1 addition & 1 deletion scripts/Configure.sh → scripts/configure.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Configure user secrets, appsettings.Development.json, and webapp/.env for Chat Copilot.

set -e
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy-azure.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Deploy Chat Copilot Azure resources.

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy-webapi.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Deploy CopilotChat's WebAPI to Azure.

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy-webapp.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Deploy CopilotChat's WebApp to Azure

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/package-webapi.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Package CiopilotChat's WebAPI for deployment to Azure

Expand Down
2 changes: 1 addition & 1 deletion scripts/Install-apt.sh → scripts/install-apt.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Installs the requirements for running Chat Copilot.

Expand Down
2 changes: 1 addition & 1 deletion scripts/Install-brew.sh → scripts/install-brew.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Installs the requirements for running Chat Copilot.

Expand Down
6 changes: 3 additions & 3 deletions scripts/Start-Backend.sh → scripts/start-backend.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash

# Builds and runs the Chat Copilot backend.

set -e

# Stop any existing backend API process
while pid=$(pgrep CopilotChatWebA); do
while pid=$(pgrep CopilotChatWebA); do
echo $pid | sed 's/\([0-9]\{4\}\) .*/\1/' | xargs kill
done

Expand All @@ -14,7 +14,7 @@ SCRIPT_DIRECTORY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. $SCRIPT_DIRECTORY/.env
cd "$SCRIPT_DIRECTORY/../webapi"

# Environment variable `ASPNETCORE_ENVIRONMENT` required to override appsettings.json with
# Environment variable `ASPNETCORE_ENVIRONMENT` required to override appsettings.json with
# appsettings.$ENV_ASPNETCORE.json. See `webapi/ConfigurationExtensions.cs`
export ASPNETCORE_ENVIRONMENT=$ENV_ASPNETCORE

Expand Down
2 changes: 1 addition & 1 deletion scripts/Start-Frontend.sh → scripts/start-frontend.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Builds and runs the Chat Copilot frontend.

Expand Down
6 changes: 3 additions & 3 deletions scripts/Start.sh → scripts/start.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Initializes and runs both the backend and frontend for Copilot Chat.

Expand All @@ -8,7 +8,7 @@ ScriptDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ScriptDir"

# Start backend (in background)
./Start-Backend.sh &
./start-backend.sh &

# Start frontend
./Start-Frontend.sh
./start-frontend.sh