Skip to content

Commit

Permalink
Fix a typo in method name and a bug in saving config file (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw authored Oct 25, 2023
1 parent 318d3e3 commit 5d7490d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion shell/ShellCopilot.Kernel/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ internal static void WriteToConfigFile(Configuration config)
Utils.SetFilePermissions(ConfigFilePath, isDirectory: false);
}

using var stream = new FileStream(ConfigFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
using var stream = new FileStream(ConfigFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
var options = new JsonSerializerOptions
{
WriteIndented = true,
Expand Down
8 changes: 4 additions & 4 deletions shell/ShellCopilot.Kernel/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ internal bool EnsureKeyPresentForActiveModel()
return model.Key is not null;
}

internal async Task<ChatResponse> ChatWithSnipperAsync(string prompt, bool insertToHistory, bool useStderr)
internal async Task<ChatResponse> ChatWithSpinnerAsync(string prompt, bool insertToHistory, bool useStderr)
{
using var _ = useStderr ? ConsoleRender.UseErrorConsole() : null;
Capabilities caps = AnsiConsole.Profile.Capabilities;
Expand Down Expand Up @@ -277,7 +277,7 @@ internal async Task<ChatResponse> ChatWithSnipperAsync(string prompt, bool inser
}
}

internal async Task<StreamingChatCompletions> StreamingChatWithSnipperAsync(string prompt, bool insertToHistory, bool useStderr)
internal async Task<StreamingChatCompletions> StreamingChatWithSpinnerAsync(string prompt, bool insertToHistory, bool useStderr)
{
using var _ = useStderr ? ConsoleRender.UseErrorConsole() : null;
Capabilities caps = AnsiConsole.Profile.Capabilities;
Expand Down Expand Up @@ -325,7 +325,7 @@ internal async Task RunOnceAsync(string prompt)
{
ChatResponse response = Console.IsOutputRedirected && Console.IsErrorRedirected
? await _service.GetChatResponseAsync(prompt, insertToHistory: false, CancellationToken).ConfigureAwait(false)
: await ChatWithSnipperAsync(prompt, insertToHistory: false, Console.IsOutputRedirected).ConfigureAwait(false);
: await ChatWithSpinnerAsync(prompt, insertToHistory: false, Console.IsOutputRedirected).ConfigureAwait(false);

if (response is not null)
{
Expand Down Expand Up @@ -401,7 +401,7 @@ internal async Task RunREPLAsync()
}

StreamingChatCompletions response = await
StreamingChatWithSnipperAsync(input, insertToHistory: true, useStderr: false).ConfigureAwait(false);
StreamingChatWithSpinnerAsync(input, insertToHistory: true, useStderr: false).ConfigureAwait(false);

if (response is not null)
{
Expand Down

0 comments on commit 5d7490d

Please sign in to comment.