feat(dingtalk): per-frame wide-table grouping (stream keeps tables flowing while streaming)

This commit is contained in:
hermes
2026-09-18 11:55:45 +08:00
parent 92324b4242
commit dd229ec0ad
6 changed files with 117 additions and 50 deletions
+16 -12
View File
@@ -6,18 +6,22 @@ import (
"strings"
)
// cardWideTableGroupingDisabled reports whether the DingTalk final-frame
// normalizer must stop rewriting over-wide answer tables into grouped lists.
// Disabling it keeps real tables in the card, which is what the operator wants
// now that the PC client renders wide-screen cards; clients that still cannot
// lay out wide tables need the grouping, so the default stays enabled.
// DINGTALK_CARD_WIDE_TABLE_GROUP=off disables it.
func cardWideTableGroupingDisabled() bool {
switch strings.ToLower(strings.TrimSpace(os.Getenv("DINGTALK_CARD_WIDE_TABLE_GROUP"))) {
case "off", "0", "false", "no":
log.Printf("DingTalk wide-table grouping disabled by configuration")
return true
// cardWideTableGroupingMode returns the configured handling of over-wide answer
// tables (see dingtalk.tableGroupingForMode):
//
// unset / on → grouped list on every frame (historical behaviour)
// off → real tables on every frame
// stream → grouped list while streaming, real table on the final frame
//
// The default stays "on" so an environment without the variable renders exactly
// as before; DINGTALK_CARD_WIDE_TABLE_GROUP selects the other modes.
func cardWideTableGroupingMode() string {
mode := strings.ToLower(strings.TrimSpace(os.Getenv("DINGTALK_CARD_WIDE_TABLE_GROUP")))
switch mode {
case "off", "0", "false", "no", "stream", "streaming", "partial":
log.Printf("DingTalk wide-table grouping mode=%s", mode)
return mode
default:
return false
return ""
}
}