This file contains hidden or 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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"regexp" | |
"gopkg.in/yaml.v2" |
This file contains hidden or 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
using Azure; | |
using Azure.AI.OpenAI; | |
var key = "0bc0xxxxxxxxxxxxxxxx7971"; | |
var endpoint = "https://my-demo-ai-app.openai.azure.com/"; | |
var deployment = "turbo-michael-35"; | |
Console.Write("Ask me anything: "); | |
var prompt = Console.ReadLine(); |
This file contains hidden or 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
@API_KEY = 0bc0xxxxxxxxxxxx7971 | |
@RESOURCE_NAME = my-demo-ai-app | |
@DEPLOYMENT_ID = turbo-michael-35 | |
### OpenAI Test | |
POST https://{{RESOURCE_NAME}}.openai.azure.com/openai/deployments/{{DEPLOYMENT_ID}}/chat/completions?api-version=2023-05-15 | |
api-key: {{API_KEY}} | |
{ | |
"messages": [ |
This file contains hidden or 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
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" /> | |
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" /> |
This file contains hidden or 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
@inherits LayoutComponentBase | |
<div class="page"> | |
<div class="sidebar"> | |
<NavMenu /> | |
</div> | |
<main> | |
<div class="top-row px-4"> | |
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a> |
This file contains hidden or 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
@page "/" | |
<PageTitle>Index</PageTitle> | |
<h1>Hello, world!</h1> | |
Welcome to your new app. | |
<SurveyPrompt Title="How is Blazor working for you?" /> |
This file contains hidden or 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
<Router AppAssembly="@typeof(App).Assembly"> | |
<Found Context="routeData"> | |
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | |
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | |
</Found> | |
<NotFound> | |
<PageTitle>Not found</PageTitle> | |
<LayoutView Layout="@typeof(MainLayout)"> | |
<p role="alert">Sorry, there's nothing at this address.</p> | |
</LayoutView> |
This file contains hidden or 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
using BlazorApp.Client; | |
using Microsoft.AspNetCore.Components.Web; | |
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | |
var builder = WebAssemblyHostBuilder.CreateDefault(args); | |
builder.RootComponents.Add<App>("#app"); | |
builder.RootComponents.Add<HeadOutlet>("head::after"); | |
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); |
This file contains hidden or 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
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
var secretToken = "XYZ"; // <--- Replace with your token. | |
HttpClient httpClient = new HttpClient(); | |
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded")); | |
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", secretToken); |
This file contains hidden or 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
private void Button1_Clicked(object sender, EventArgs e) | |
{ | |
var win = new Window | |
{ | |
Page = new NewPage1(), | |
Width = 1024, | |
Height = 300 // 亦可在此設定初始座標 X 和 Y | |
}; | |
Application.Current.OpenWindow(win); |
NewerOlder