| | | 1 | | @using UIBlazor.Services.Settings |
| | | 2 | | @using UIBlazor.Models |
| | | 3 | | @using Shared.Contracts |
| | | 4 | | @inject IToolManager ToolManager |
| | | 5 | | |
| | | 6 | | <div class="tool-call-block" data-tool="@Segment.ToolName"> |
| | | 7 | | <div class="tool-call-header @statusClass"> |
| | 0 | 8 | | @SharedResource.CallingTool: <strong>@DisplayName</strong>@(Segment.IsClosed ? "" : " ...") |
| | | 9 | | </div> |
| | | 10 | | |
| | 0 | 11 | | @if (Segment.Lines.Count > 0) |
| | | 12 | | { |
| | | 13 | | <div class="tool-call-args"> |
| | 0 | 14 | | @if (Segment.ToolName == BuiltInToolEnum.ApplyDiff) |
| | | 15 | | { |
| | | 16 | | <DiffView Lines="@Segment.Lines" /> |
| | | 17 | | } |
| | | 18 | | else |
| | | 19 | | { |
| | 0 | 20 | | <pre>@string.Join("\n", Segment.Lines[0..])</pre> |
| | | 21 | | } |
| | | 22 | | </div> |
| | | 23 | | } |
| | | 24 | | |
| | 0 | 25 | | @if (Segment.IsClosed) |
| | | 26 | | { |
| | | 27 | | <div class="tool-approval-footer @statusClass"> |
| | 0 | 28 | | @if (Segment.ApprovalStatus == ToolApprovalStatus.Pending) |
| | | 29 | | { |
| | 0 | 30 | | <div class="tool-approval-label"><i class="rz-icon-notification rz-ml-2"></i>@SharedResource.ApproveRequ |
| | | 31 | | <div class="tool-approval-actions"> |
| | 0 | 32 | | <RadzenButton Icon="check" class="tool-approve-btn rz-m-2" Click="@(async () => await OnApproval.Inv |
| | 0 | 33 | | <RadzenButton Icon="close" class="tool-reject-btn rz-m-2" Click="@(async () => await OnApproval.Invo |
| | | 34 | | </div> |
| | | 35 | | } |
| | | 36 | | </div> |
| | | 37 | | } |
| | | 38 | | </div> |
| | | 39 | | |
| | | 40 | | @code { |
| | 0 | 41 | | [Parameter] public ContentSegment Segment { get; set; } = null!; |
| | 0 | 42 | | [Parameter] public EventCallback<(string SegmentId, bool Approved)> OnApproval { get; set; } |
| | | 43 | | |
| | 0 | 44 | | private string DisplayName => ToolManager.GetTool(Segment.ToolName)?.DisplayName ?? Segment.ToolName; |
| | | 45 | | |
| | 0 | 46 | | string statusClass => Segment.ApprovalStatus switch |
| | 0 | 47 | | { |
| | 0 | 48 | | ToolApprovalStatus.Approved => "approved", |
| | 0 | 49 | | ToolApprovalStatus.Rejected => "rejected", |
| | 0 | 50 | | _ => "pending" // класс по умолчанию |
| | 0 | 51 | | }; |
| | | 52 | | } |