Skip to content

style:Run dotnet format #496

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

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 3 additions & 3 deletions src/Cli/src/Commands/DoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ private static async Task HandleAsync(string input, string inputPath, string out
var llm = await Helpers.GetChatModelAsync().ConfigureAwait(false);
llm.RequestSent += (_, request) => Console.WriteLine($"RequestSent: {request.Messages.AsHistory()}");
llm.ResponseReceived += (_, response) => Console.WriteLine($"ResponseReceived: {response}");

var fileSystemService = new FileSystemService();
llm.AddGlobalTools(fileSystemService.AsTools(), fileSystemService.AsCalls());

var response = await llm.GenerateAsync(inputText);

await Helpers.WriteOutputAsync(response, outputPath).ConfigureAwait(false);
}
}
18 changes: 9 additions & 9 deletions src/Cli/src/Commands/FileSystemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task<IList<string>> FindFilePathsByContentAsync(
CancellationToken cancellationToken = default)
{
var paths = new List<string>();

Console.WriteLine($"Searching for files in \"{directory}\" containing \"{content}\"...");

foreach (var path in Directory.EnumerateFiles(directory, "*.*", SearchOption.AllDirectories))
Expand All @@ -46,7 +46,7 @@ public async Task<IList<string>> FindFilePathsByContentAsync(
{
continue;
}

//FileInfo info = new FileInfo(path);
var text = await File.ReadAllTextAsync(path, cancellationToken).ConfigureAwait(false);

Expand All @@ -62,7 +62,7 @@ public async Task<IList<string>> FindFilePathsByContentAsync(
// ignore
}
}

Console.WriteLine($"Found {paths.Count} files:");
foreach (var path in paths)
{
Expand All @@ -71,16 +71,16 @@ public async Task<IList<string>> FindFilePathsByContentAsync(

return paths;
}

public async Task<string> ReadContentAsync(
string path,
CancellationToken cancellationToken = default)
{
Console.WriteLine($"Reading file at path: {path}");

return await File.ReadAllTextAsync(path, cancellationToken).ConfigureAwait(false);
}

public async Task<string> WriteContentAsync(
string path,
string newContent,
Expand All @@ -101,11 +101,11 @@ public async Task<string> WriteContentAsync(
break;
}
}

await File.WriteAllTextAsync(path, newContent, cancellationToken).ConfigureAwait(false);

Console.WriteLine("File written.");

return "File written.";
}
}
Loading