Skip to content

Homework/04 avalonia - #128

Open
gbx-cyber2 wants to merge 4 commits into
eesast:homework/04-avaloniafrom
gbx-cyber2:homework/04-avalonia
Open

Homework/04 avalonia#128
gbx-cyber2 wants to merge 4 commits into
eesast:homework/04-avaloniafrom
gbx-cyber2:homework/04-avalonia

Conversation

@gbx-cyber2

Copy link
Copy Markdown

暑培:队式作业提交

基本信息

  • 姓名:龚伯熙
  • 班级:笃实56
  • 学号:2025013077

提交说明

Copilot AI lite review requested due to automatic review settings August 28, 2026 08:14
@mergify mergify Bot added the homework Homework PR, will not be merged label Aug 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 支持解析 requestinternal 类型日志
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));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

homework Homework PR, will not be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants