Homework/04 avalonia - #128
Open
gbx-cyber2 wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
本 PR 是一次“作业提交”,围绕日志解析/分析链路补全了缺失实现,并在 03-async-grpc 的基础上新增/完善 04-avalonia 的 GUI 客户端功能(MVVM + gRPC)。
Changes:
- 补全日志解析(
request/internal)与 Visitor 输出,并打通模型Accept访问者分发。 - 补全多线程分析(WorkQueue + worker 线程)与 gRPC Agent(类型转换、服务转发、会话层错误处理、RemoteCli 交互)。
- 完成 Avalonia 客户端的 Refresh/Analyze/GetResult 逻辑与 “Analyze All” UI 按钮,并补充各章节报告文档。
Reviewed changes
Copilot reviewed 18 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/RemoteCli/Program.cs | 实现远程 CLI 的文件列表/分析/结果查看交互逻辑 |
| src/LocalCli/Program.cs | 实现本地 CLI 的文件列表/分析/结果查看交互逻辑 |
| src/LogParser/Parser/LineParser.cs | 支持解析 request 与 internal 类型日志 |
| src/LogParser/Models/LogEntries.cs | 补全 RequestLogEntry/InternalLogEntry 的 visitor 分发 |
| src/LogParser/Visitors/KeyValueVisitor.cs | 为 request/internal 日志输出键值对摘要 |
| src/LogAnalyzer/WorkQueue.cs | 实现生产者-消费者队列(Monitor + lock) |
| src/LogAnalyzer/LogFileAnalyzer.cs | 完成 worker 线程调度、解析与结果写入(含加锁) |
| src/LogAnalyzerRpc/GrpcTypeConverter.cs | 实现枚举/LogEntry 的 gRPC 转换 |
| src/LogAnalyzerRpc/GrpcLogEntryVisitor.cs | 实现 LogEntry -> Protobuf message 的 visitor 转换 |
| src/LogAnalyzerAgent/Services/AgentService.cs | gRPC Service 层转发到会话层(含流式返回) |
| src/LogAnalyzerAgent/Applications/AgentSession.cs | 会话层实现目录切换/分析/结果读取与错误状态封装 |
| src/LogAnalyzerClient/LogAnalyzerClient/Views/MainView.axaml | GUI 增加 “Analyze All” 按钮布局 |
| src/LogAnalyzerClient/LogAnalyzerClient/ViewModels/MainViewModel.cs | GUI 端 Refresh/Analyze/GetResult 等命令实现 |
| src/LogAnalyzerClient/LogAnalyzerClient/Models/RemoteModels.cs | GUI 端结果摘要 Summary 拼接输出 |
| docs/01-basic/report.md | 增加/更新 01-basic 报告 |
| docs/02-multithreading/report.md | 增加/更新 02-multithreading 报告 |
| docs/03-async-grpc/report.md | 增加/更新 03-async-grpc 报告 |
| docs/04-avalonia/report.md | 增加/更新 04-avalonia 报告 |
Suppressed comments (1)
src/LogAnalyzerAgent/Applications/AgentSession.cs:218
- In the exception path, CreateInternalErrorOperationStatus(ex) returns a message mentioning "retrieving agent status", which is misleading for GetAnalysisResult failures. Use an InternalError status with a message specific to this operation.
responses.Add(new GetAnalysisResultResponse()
{
Status = CreateInternalErrorOperationStatus(ex),
});
_logger.LogError(ex, "An error occurred while retrieving analysis result.");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+52
to
+56
| var responses = _session.GetAnalysisResult(request, context.CancellationToken); | ||
| foreach (var response in responses) | ||
| { | ||
| await responseStream.WriteAsync(response); | ||
| } |
Comment on lines
+125
to
+129
| catch (Exception ex) | ||
| { | ||
| response.Status = CreateInternalErrorOperationStatus(ex); | ||
| _logger.LogError(ex, "An error occurred while changing directory."); | ||
| } |
Comment on lines
+292
to
+300
| foreach (var response in responses.Skip(1)) | ||
| { | ||
| var entry = GrpcTypeConverter.ConvertFromGrpc(response.LogEntry); | ||
| var kv = visitor.Dump(entry); | ||
| var fields = kv | ||
| .Select(pair => new LogFieldItem(pair.Key, pair.Value)) | ||
| .ToList(); | ||
| ResultEntries.Add(new LogFields(entry.LineNo, fields, null)); | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
暑培:队式作业提交
基本信息
提交说明
04-avalonia作业提交通道 #35