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

Separate reference docs into different block #180

Merged
merged 8 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ Once in the web app:
* Explore citations and sources
* Click on the "settings" icon to try different options, tweak prompts, etc.

### Optional: Enabling Authentication

By default, the deployed Azure container app will have no authentication or access restrictions enabled, meaning anyone with routable network access to the container app can chat with your indexed data. You can require authentication to your Azure Active Directory by following the [Add container app authentication](https://learn.microsoft.com/en-us/azure/container-apps/authentication-azure-active-directory) tutorial and set it up against the deployed container app.

To then limit access to a specific set of users or groups, you can follow the steps from [Restrict your Azure AD app to a set of users](https://learn.microsoft.com/azure/active-directory/develop/howto-restrict-your-app-to-a-set-of-users) by changing "Assignment Required?" option under the Enterprise Application, and then assigning users/groups access. Users not granted explicit access will receive the error message -AADSTS50105: Your administrator has configured the application <app_name> to block users unless they are specifically granted ('assigned') access to the application.-

## Resources

* [Revolutionize your Enterprise Data with ChatGPT: Next-gen Apps w/ Azure OpenAI and Cognitive Search](https://aka.ms/entgptsearchblog)
Expand Down
20 changes: 19 additions & 1 deletion app/backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

builder.Configuration.ConfigureAzureKeyVault();

var allowMSIdentity = "_myAllowSpecificOrigins";

// See: https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
Expand Down Expand Up @@ -47,6 +49,20 @@
""";
options.InstanceName = "content";
});

builder.Services.AddCors(options =>
{
options.AddPolicy(name: allowMSIdentity,
policy =>
{
// add login.windows.net and login.microsoftonline.com
policy.WithOrigins("https://login.microsoftonline.com",
"https://login.windows.net")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}

var app = builder.Build();
Expand All @@ -62,9 +78,11 @@
app.UseHsts();
}



app.UseHttpsRedirection();
app.UseOutputCache();
app.UseCors();
app.UseCors(allowMSIdentity);
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();
app.UseRouting();
Expand Down
2 changes: 1 addition & 1 deletion app/backend/Services/ReadRetrieveReadChatService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ standard plan AND dental AND employee benefit.

You answer needs to be a json object with the following format.
{{
""answer"": // the answer to the question, add a source reference to the end of each sentence. e.g. Apple is a fruit [reference1.pdf]. If no source available, put the answer as I don't know.
""answer"": // the answer to the question, add a source reference to the end of each sentence. e.g. Apple is a fruit [reference1.pdf][reference2.pdf]. If no source available, put the answer as I don't know.
""thoughts"": // brief thoughts on how you came up with the answer, e.g. what sources you used, what you thought about, etc.
}}");

Expand Down