Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b31286b
Add sample 4 webapp
craigomatic Mar 13, 2023
854e04b
Load the WebFileDownload skill
craigomatic Mar 14, 2023
8c4adfc
Replace old sample code convention. The sample can now successfully m…
craigomatic Mar 14, 2023
fe2b199
Add expansion of environment variables, override name to avoid the ca…
craigomatic Mar 14, 2023
db772fa
Fix bug in calling code passing in invalid paths
craigomatic Mar 14, 2023
e6f29e0
Merge branch 'microsoft:main' into sample4
craigomatic Mar 14, 2023
a44d1a1
Merge branch 'microsoft:main' into sample4
craigomatic Mar 14, 2023
eb1fbba
adding relevance slider and send button
teresaqhoang Mar 15, 2023
08c066f
Merge pull request #1 from craigomatic/tehoang/relevance-slider
teresaqhoang Mar 15, 2023
72de0ee
Merge branch 'microsoft:main' into sample4
craigomatic Mar 15, 2023
d044cab
Add the CodeSkill to Sample4
markwallace-microsoft Mar 15, 2023
6707047
Add the CodeSkill to Sample4
markwallace-microsoft Mar 15, 2023
53c456e
Remove IFileSystemConnector changes
markwallace-microsoft Mar 15, 2023
e353fb6
Update CodeSkill.cs
markwallace-microsoft Mar 15, 2023
b040d63
Update CodeSkill.cs
markwallace-microsoft Mar 15, 2023
5672050
Merge pull request #2 from markwallace-microsoft/users/markwallace/co…
craigomatic Mar 15, 2023
bb7d020
Better error msgs
TaoChenOSU Mar 16, 2023
40f58cf
Refactor and address TODO's
markwallace-microsoft Mar 16, 2023
8f33caa
Merge pull request #3 from craigomatic/users/taochen/sample4_better_e…
TaoChenOSU Mar 16, 2023
53c660a
Remove Code.Skill
markwallace-microsoft Mar 16, 2023
14b562a
Merge branch 'sample4' into users/markwallace/codeskill-todos
markwallace-microsoft Mar 16, 2023
b66edb2
Fix logic error
markwallace-microsoft Mar 16, 2023
199fbfb
Merge branch 'users/markwallace/codeskill-todos' of https://github.co…
markwallace-microsoft Mar 16, 2023
b0b445c
Update GitHubRepoSelection.tsx
markwallace-microsoft Mar 16, 2023
b068c1c
Use Path.GetTempPath()
markwallace-microsoft Mar 16, 2023
c28df58
Merge pull request #4 from markwallace-microsoft/users/markwallace/co…
craigomatic Mar 16, 2023
a9eee35
Merge branch 'microsoft:main' into sample4
craigomatic Mar 16, 2023
a6b5fd6
model configuration steps + load available models
teresaqhoang Mar 16, 2023
52277b0
fixing merge conflicts
teresaqhoang Mar 16, 2023
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
7 changes: 7 additions & 0 deletions dotnet/SK-dotnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuget", "nuget", "{F4243136
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KernelBuilder", "..\samples\dotnet\KernelBuilder\KernelBuilder.csproj", "{A52818AC-57FB-495F-818F-9E1E7BC5618C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHubSkillsExample", "..\samples\dotnet\github-skills\GitHubSkillsExample.csproj", "{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -110,6 +112,10 @@ Global
{A52818AC-57FB-495F-818F-9E1E7BC5618C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A52818AC-57FB-495F-818F-9E1E7BC5618C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A52818AC-57FB-495F-818F-9E1E7BC5618C}.Release|Any CPU.Build.0 = Release|Any CPU
{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -130,6 +136,7 @@ Global
{107156B4-5A8B-45C7-97A2-4544D7FA19DE} = {9ECD1AA0-75B3-4E25-B0B5-9F0945B64974}
{F4243136-252A-4459-A7C4-EE8C056D6B0B} = {158A4E5E-AEE0-4D60-83C7-8E089B2D881D}
{A52818AC-57FB-495F-818F-9E1E7BC5618C} = {FA3720F1-C99A-49B2-9577-A940257098BF}
{39E5F0F6-8B36-4ECA-A5F6-FC7522DC2ECF} = {FA3720F1-C99A-49B2-9577-A940257098BF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBDC56A3-86AD-4323-AA0F-201E59123B83}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public WebFileDownloadSkill(ILogger<WebFileDownloadSkill>? logger = null)
/// <returns>Task.</returns>
/// <exception cref="KeyNotFoundException">Thrown when the location where to download the file is not provided</exception>
[SKFunction("Downloads a file to local storage")]
[SKFunctionName("DownloadToFile")]
[SKFunctionInput(Description = "URL of file to download")]
[SKFunctionContextParameter(Name = Parameters.FilePath, Description = "Path where to save file locally")]
public async Task DownloadToFileAsync(string source, SKContext context)
Expand All @@ -73,7 +74,7 @@ public async Task DownloadToFileAsync(string source, SKContext context)
this._logger.LogDebug("Response received: {0}", response.StatusCode);

using Stream webStream = await response.Content.ReadAsStreamAsync();
using FileStream outputFileStream = new FileStream(filePath, FileMode.Create);
using FileStream outputFileStream = new FileStream(Environment.ExpandEnvironmentVariables(filePath), FileMode.Create);

await webStream.CopyToAsync(outputFileStream, context.CancellationToken);
}
Expand Down
8 changes: 8 additions & 0 deletions samples/apps/github-qna-webapp-react/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
REACT_APP_FUNCTION_URI=http://localhost:7071
REACT_APP_OPEN_AI_KEY=
REACT_APP_OPEN_AI_COMPLETION_MODEL=
REACT_APP_OPEN_AI_EMBEDDINGS_MODEL=
REACT_APP_AZURE_OPEN_AI_KEY=
REACT_APP_AZURE_OPEN_AI_DEPLOYMENT=
REACT_APP_AZURE_OPEN_AI_COMPLETION_DEPLOYMENT=
REACT_APP_AZURE_OPEN_AI_EMBEDDING_DEPLOYMENT=
28 changes: 28 additions & 0 deletions samples/apps/github-qna-webapp-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# GitHub Repo Q&A Bot Sample

> **!IMPORTANT**
> This learning sample is for educational purposes only and should not be used in any
> production use case. It is intended to highlight concepts of Semantic Kernel and not
> any architectural / security design practices to be used.

## Running the sample

1. You will need an [Open AI Key](https://openai.com/api/) or
[Azure Open AI Service key](https://learn.microsoft.com/azure/cognitive-services/openai/quickstart) for this sample.
2. Ensure the service API is already running `http://localhost:7071`. If not learn how to start it [here](../starter-api-azure-function/README.md).
3. **Run** the following command `yarn install` (if you have never run the sample before) and/or `yarn start` from the command line.
4. A browser will open or you can navigate to `http://localhost:3000` to use the sample.

## About the GitHub Repo Q&A Bot Sample

The GitHub Repo Q&A Bot sample allows you to pull in data from a public GitHub repo into a local memory store in order to ask questions about the project and to get answers about it. The sample highlights how [memory](TODO Link to memory) and [embeddings](TODO Link to embeddings) work along with X SK Functions when the size of the data is larger than the allowed token limited. Each SK function will call Open AI to perform the tasks you ask about.​

> [!CAUTION]
> Each function will call Open AI which will use tokens that you will be billed for.

## Next Steps

Create Skills and SK functions: Check out the [documentation](TODO link to documentation) for how to create Skills or watch the [video​](TODO Link to video)
Join the community: Join our [Discord community](https://aka.ms/SKDiscord) to share ideas and get help​
Contribute: We need your help to make this the best it can be. Learn how you can [contribute](TODO Link to contribute) to this project.​
## Troubleshooting Steps
45 changes: 45 additions & 0 deletions samples/apps/github-qna-webapp-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "starter-github-qna-webapp-react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@fluentui/react-components": "^9.11.1",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"openai": "^3.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.4.2",
"web-vitals": "^2.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file not shown.
37 changes: 37 additions & 0 deletions samples/apps/github-qna-webapp-react/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="GitHub Repo Q&A Bot" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>GitHub Repo Q&A Bot</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
45 changes: 45 additions & 0 deletions samples/apps/github-qna-webapp-react/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
body {
padding: 0px;
margin: 0px;
}

#container {
display: flex;
flex-direction: column;
align-items: stretch;
justify-content: space-between;
}

#header {
background-color: #9c2153;
width: 100%;
height: 40px;
color: #FFF;
display: flex;
}

#header h1 {
padding-left: 20px;
align-items: center;
display: flex;
}

#content {
display: flex;
align-items: stretch;
flex-direction: row;
padding-top: 12px;
gap: 80px;
}

#main {
display: flex;
align-items: stretch;
flex-direction: column;
gap: 10px;
}

#tipbar {
background-color: #FAF9F8;
width: 360px;
}
Loading