AX Agent transcript 렌더 계획/적용 구조를 분리해 유지보수성을 높이고 문서를 갱신한다
Some checks failed
Release Gate / gate (push) Has been cancelled
Some checks failed
Release Gate / gate (push) Has been cancelled
- ChatWindow transcript 렌더를 planner/execution 단계로 분리해 RenderMessages 오케스트레이션을 단순화함 - TranscriptRenderPlanner/TranscriptRenderExecution partial을 추가해 planning과 host 적용 책임을 나눔 - README와 DEVELOPMENT 문서에 2026-04-09 09:37 (KST) 기준 구조 개선 이력을 반영함 - dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ 검증 결과 경고 0개 오류 0개
This commit is contained in:
65
src/AxCopilot/Views/ChatWindow.TranscriptRenderPlanner.cs
Normal file
65
src/AxCopilot/Views/ChatWindow.TranscriptRenderPlanner.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using AxCopilot.Models;
|
||||
|
||||
namespace AxCopilot.Views;
|
||||
|
||||
public partial class ChatWindow
|
||||
{
|
||||
private sealed class TranscriptRenderPlan
|
||||
{
|
||||
public required List<(string Key, DateTime Timestamp, int Order, Action Render)> VisibleTimeline { get; init; }
|
||||
public required List<string> NewKeys { get; init; }
|
||||
public required bool ShowHistory { get; init; }
|
||||
public required int HiddenCount { get; init; }
|
||||
public required bool CanIncremental { get; init; }
|
||||
public required int PreviousLiveCount { get; init; }
|
||||
public required int PreviousStableCount { get; init; }
|
||||
}
|
||||
|
||||
private TranscriptRenderPlan BuildTranscriptRenderPlan(
|
||||
ChatConversation conv,
|
||||
IReadOnlyList<ChatMessage> visibleMessages,
|
||||
IReadOnlyList<ChatExecutionEvent> visibleEvents)
|
||||
{
|
||||
var orderedTimeline = BuildTimelineRenderActions(visibleMessages, visibleEvents);
|
||||
var effectiveRenderLimit = GetActiveTimelineRenderLimit();
|
||||
var hiddenCount = Math.Max(0, orderedTimeline.Count - effectiveRenderLimit);
|
||||
var visibleTimeline = hiddenCount > 0
|
||||
? orderedTimeline.GetRange(hiddenCount, orderedTimeline.Count - hiddenCount)
|
||||
: orderedTimeline;
|
||||
|
||||
var newKeys = new List<string>(visibleTimeline.Count);
|
||||
foreach (var item in visibleTimeline)
|
||||
newKeys.Add(item.Key);
|
||||
|
||||
var hasExternalChildren = _agentLiveContainer != null && ContainsTranscriptElement(_agentLiveContainer);
|
||||
var expectedChildCount = _lastRenderedTimelineKeys.Count + (_lastRenderedHiddenCount > 0 ? 1 : 0);
|
||||
var canIncremental = !hasExternalChildren
|
||||
&& _lastRenderedTimelineKeys.Count > 0
|
||||
&& newKeys.Count >= _lastRenderedTimelineKeys.Count
|
||||
&& _lastRenderedHiddenCount == hiddenCount
|
||||
&& GetTranscriptElementCount() == expectedChildCount;
|
||||
|
||||
var previousLiveCount = 0;
|
||||
if (canIncremental)
|
||||
{
|
||||
for (var i = _lastRenderedTimelineKeys.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_lastRenderedTimelineKeys[i].StartsWith("_live_", StringComparison.Ordinal))
|
||||
previousLiveCount++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new TranscriptRenderPlan
|
||||
{
|
||||
VisibleTimeline = visibleTimeline,
|
||||
NewKeys = newKeys,
|
||||
ShowHistory = conv.ShowExecutionHistory,
|
||||
HiddenCount = hiddenCount,
|
||||
CanIncremental = canIncremental,
|
||||
PreviousLiveCount = previousLiveCount,
|
||||
PreviousStableCount = _lastRenderedTimelineKeys.Count - previousLiveCount,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user