in src/ai/commands/scenario_wizard_command.cs [109:200]
private async Task ChatWithYourDataScenarioAsync(string scenario)
{
StartCommand();
var subscription = await AzCliConsoleGui.PickSubscriptionAsync(true, true);
var openAiResource = await AzCliConsoleGui.PickOrCreateAndConfigCognitiveServicesOpenAiKindResource(null, true, subscription.Id, skipChat: false, skipEmbeddings: false, skipRealTime: true);
var cogSearchResource = await AzCliConsoleGui.PickOrCreateAndConfigCogSearchResource(false, subscription.Id, openAiResource.RegionLocation, openAiResource.Group);
// var aiHubResource = await AiSdkConsoleGui.PickOrCreateAiHubResource(_values, subscription.Id);
// var aiHubProject = AiSdkConsoleGui.PickOrCreateAndConfigAiHubProject(true, true, _values, subscription.Id, aiHubResource.Id, openAiResource.Group, openAiResource.Endpoint, openAiResource.Key, cogSearchResource.Endpoint, cogSearchResource.Key);
ConsoleHelpers.WriteLineWithHighlight("\n`CONFIG AI SCENARIO DATA`");
Console.Write("\rWhere: ");
var source = ListBoxPicker.PickString(GetDataLocationChoices());
Console.WriteLine($"\rWhere: {source}");
if (!source.Contains("files"))
{
Console.WriteLine();
ConsoleHelpers.WriteLineError($"SCENARIO: {scenario} w/ source={source} is not yet implemented.");
return;
}
var getFiles = () => {
Console.WriteLine("\nPlease enter the path to the files you want to upload. You can use wildcards to upload multiple files. You can also use relative paths to upload files from your current working directory.");
Console.WriteLine("EXAMPLE: *.md\n");
while (true)
{
var path = AskPromptHelper.AskPrompt("Files: ");
var fi = new FileInfo(path);
var files = Directory.Exists(path)
? Directory.GetFiles(path)
: Directory.GetFiles(fi.DirectoryName, fi.Name);
var count = files.Count();
Console.WriteLine($"Found: {count}");
if (count > 0) return files;
Console.Write("\nTry again? ");
if (!ListBoxPickYesNo()) return null;
Console.WriteLine();
}
};
var files = getFiles();
ConsoleHelpers.WriteLineWithHighlight("\n`CREATE OR UPDATE AI SEARCH INDEX`");
var indexName = AskPromptHelper.AskPrompt("Search Index Name: ");
Console.WriteLine();
Console.Write("\r*** UPDATED *** ");
Console.WriteLine();
var systemPrompt = AskChatSystemPrompt(_values);
if (string.IsNullOrEmpty(systemPrompt)) return;
StartShellAiChatScenario(scenario, $"--index-name {indexName} --system-prompt @prompt.txt").WaitForExit();
ConsoleHelpers.WriteLineWithHighlight($"\n`NEXT STEPS: {scenario}`");
Console.WriteLine("");
Console.WriteLine(" To chat w/ your data as configured here, try:");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($" ai chat --interactive --index-name \"{indexName}\" --system-prompt @prompt.txt");
Console.ResetColor();
Console.WriteLine("");
Console.WriteLine(" To share with others, try:");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($" ai chat --interactive --index-name \"{indexName}\" --system-prompt @prompt.txt --zip \"{indexName}.zip\"");
Console.ResetColor();
Console.WriteLine("");
Console.WriteLine(" To generate code, try:");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($" ai wizard --scenario \"{scenario}\" --code --language C#");
Console.ResetColor();
Console.WriteLine("");
Console.WriteLine(" To chat using public data, try:");
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" ai wizard --scenario \"Chat (OpenAI)\" --explore");
Console.ResetColor();
Console.WriteLine("");
StopCommand();
DisposeAfterStop();
DeleteTemporaryFiles();
}