(modalState map[string]any)
| 904 | } |
| 905 | |
| 906 | func FormatFullscreenModal(modalState map[string]any) string { |
| 907 | if len(modalState) == 0 { |
| 908 | return "" |
| 909 | } |
| 910 | riskLabel := displayRiskLabel(firstNonEmpty(stringFromAny(modalState["display_risk_level"]), "medium")) |
| 911 | var summaryLines []string |
| 912 | for _, line := range anyStringSlice(modalState["summary_lines"]) { |
| 913 | if line != "" { |
| 914 | summaryLines = append(summaryLines, "- "+line) |
| 915 | } |
| 916 | } |
| 917 | actionLabels := anyStringSlice(modalState["action_labels"]) |
| 918 | actionText := strings.Join(actionLabels, " / ") |
| 919 | if actionText == "" { |
| 920 | actionText = "允许一次 / 本会话总是允许 / 拒绝" |
| 921 | } |
| 922 | parts := []string{ |
| 923 | "权限请求", |
| 924 | "类型: " + stringFromAny(modalState["tool_name"]), |
| 925 | "目标: " + stringFromAny(modalState["target_summary"]), |
| 926 | "风险: " + riskLabel, |
| 927 | } |
| 928 | if len(summaryLines) > 0 { |
| 929 | parts = append(parts, "摘要:") |
| 930 | parts = append(parts, summaryLines...) |
| 931 | } |
| 932 | parts = append(parts, "操作: "+actionText, "请输入 y / a / n 并回车。") |
| 933 | return strings.Join(parts, "\n") |
| 934 | } |
| 935 | |
| 936 | func (b *FullscreenRendererBackend) renderTranscriptRegion() string { |
| 937 | lines := b.viewportLayout().TranscriptLines |
no test coverage detected