forked from BryceAmackerLE/chat-copilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from LeadingEDJE/tommy/update
Tommy/update
- Loading branch information
Showing
114 changed files
with
3,424 additions
and
1,512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: copilot-build-plugins | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: ["main"] | ||
paths: | ||
- "plugins/**" | ||
workflow_call: | ||
outputs: | ||
artifact: | ||
description: "The name of the uploaded plugin artifacts." | ||
value: ${{jobs.plugins.outputs.artifact}} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
plugins: | ||
runs-on: windows-latest | ||
|
||
env: | ||
NUGET_CERT_REVOCATION_MODE: offline | ||
|
||
outputs: | ||
artifact: ${{steps.artifactoutput.outputs.artifactname}} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
clean: true | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/setup@v0 | ||
with: | ||
versionSpec: "5.x" | ||
|
||
- name: Determine version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/execute@v0 | ||
|
||
- name: Set version tag | ||
id: versiontag | ||
run: | | ||
$VERSION_TAG = "${{ steps.gitversion.outputs.Major }}." | ||
$VERSION_TAG += "${{ steps.gitversion.outputs.Minor }}." | ||
$VERSION_TAG += "${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" | ||
echo $VERSION_TAG | ||
Write-Output "versiontag=$VERSION_TAG" >> $env:GITHUB_OUTPUT | ||
- name: Set .Net Core version | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 6.0.x | ||
|
||
- name: Package Copilot Chat Plugins | ||
run: | | ||
scripts\deploy\package-plugins.ps1 ` | ||
-BuildConfiguration Release ` | ||
-DotNetFramework net6.0 ` | ||
-OutputDirectory ${{ github.workspace }}\scripts\deploy ` | ||
-Version ${{ steps.versiontag.outputs.versiontag }} ` | ||
-InformationalVersion "Built from commit ${{ steps.gitversion.outputs.ShortSha }} on $(Get-Date -Format "yyyy-MM-dd")" | ||
- name: Upload packages to artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: copilotchat-plugins-${{ steps.versiontag.outputs.versiontag }} | ||
path: ${{ github.workspace }}\scripts\deploy\out\plugins | ||
|
||
- name: "Set outputs" | ||
id: artifactoutput | ||
run: Write-Output "artifactname=copilotchat-plugins-${{ steps.versiontag.outputs.versiontag }}" >> $env:GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: copilot-deploy-plugins | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ARTIFACT_NAME: | ||
required: true | ||
type: string | ||
ENVIRONMENT: | ||
required: true | ||
type: string | ||
DEPLOYMENT_NAME: | ||
required: true | ||
type: string | ||
secrets: | ||
AZURE_CLIENT_ID: | ||
required: true | ||
AZURE_TENANT_ID: | ||
required: true | ||
AZURE_SUBSCRIPTION_ID: | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
plugins: | ||
environment: ${{inputs.ENVIRONMENT}} | ||
permissions: | ||
id-token: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { dotnet: "6.0", configuration: Release, os: ubuntu-latest } | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
clean: true | ||
|
||
- name: Install Azure CLI | ||
run: | | ||
sudo apt update && sudo apt-get install curl -y | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{inputs.ARTIFACT_NAME}} | ||
path: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}" | ||
|
||
- name: "Display downloaded content" | ||
run: ls -R | ||
working-directory: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}" | ||
|
||
- name: "Azure login" | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{secrets.AZURE_CLIENT_ID}} | ||
tenant-id: ${{secrets.AZURE_TENANT_ID}} | ||
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}} | ||
enable-AzPSSession: false | ||
|
||
- name: "Deploy" | ||
run: | | ||
scripts/deploy/deploy-plugins.sh \ | ||
--deployment-name ${{inputs.DEPLOYMENT_NAME}} \ | ||
--subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} \ | ||
--resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} \ | ||
--packages "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Plugins | ||
|
||
> **IMPORTANT:** This sample is for educational purposes only and is not recommended for production deployments. | ||
Plugins are cool! They allow Chat Copilot to talk to the internet. Read more about plugins here [Understanding AI plugins in Semantic Kernel](https://learn.microsoft.com/en-us/semantic-kernel/ai-orchestration/plugins/?tabs=Csharp) and here [ChatGPT Plugins](https://platform.openai.com/docs/plugins/introduction). | ||
|
||
## Available Plugins | ||
|
||
> These plugins in this project can be optionally deployed with the Chat Copilot [WebApi](../webapi/README.md) | ||
- [WebSearcher](./web-searcher/README.md): A plugin that allows the chat bot to perform Bing search. | ||
- More to come. Stay tuned! | ||
|
||
## Third Party plugins | ||
|
||
You can also configure Chat Copilot to use third party plugins. | ||
|
||
> All no-auth plugins will be supported. | ||
> All service-level-auth and user-level-auth plugins will be supported. | ||
> OAuth plugins will NOT be supported. | ||
Read more about plugin authentication here: [Plugin authentication](https://platform.openai.com/docs/plugins/authentication) | ||
|
||
## Plugin Configuration in Chat Copilot | ||
|
||
### Prerequisites | ||
|
||
1. The name of your plugin. This should be identical to the `NameForHuman` in your plugin manifest. | ||
> Please refer to OpenAI for the [manifest requirements](https://platform.openai.com/docs/plugins/getting-started/plugin-manifest). | ||
2. Url of your plugin. | ||
> This should be the root url to your API. Not the manifest url nor the OpenAPI spec url. | ||
3. (Optional) Key of the plugin if it requires one. | ||
|
||
### Local dev | ||
|
||
In `appsettings.json` or `appsettings.development.json` under `../webapi/`, add your plugin to the existing **Plugins** list with the required information. | ||
|
||
### Deployment | ||
|
||
1. Go to your webapi resource in Azure portal. | ||
2. Go to **Configuration** -> **Application settings**. | ||
3. Look for Plugins:[*index*]:\* in the names that has the largest index. | ||
4. Add the following names and their corresponding values: | ||
|
||
``` | ||
Plugins[*index+1*]:Name | ||
Plugins[*index+1*]:Url | ||
Plugins[*index+1*]:Key (only if the plugin requires it) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Plugins.PluginShared; | ||
|
||
/// <summary> | ||
/// This class represents the plugin API specification. | ||
/// </summary> | ||
public class PluginApi | ||
{ | ||
/// <summary> | ||
/// The API specification | ||
/// </summary> | ||
public string Type { get; set; } = "openapi"; | ||
|
||
/// <summary> | ||
/// URL used to fetch the specification | ||
/// </summary> | ||
public string Url { get; set; } = string.Empty; | ||
} |
Oops, something went wrong.